GDB (API)
/home/stan/gdb/src/gdb/target/waitstatus.c
Go to the documentation of this file.
00001 /* Target waitstatus implementations.
00002 
00003    Copyright (C) 1990-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #ifdef GDBSERVER
00021 #include "server.h"
00022 #else
00023 #include "defs.h"
00024 #endif
00025 
00026 #include "waitstatus.h"
00027 
00028 /* Return a pretty printed form of target_waitstatus.
00029    Space for the result is malloc'd, caller must free.  */
00030 
00031 char *
00032 target_waitstatus_to_string (const struct target_waitstatus *ws)
00033 {
00034   const char *kind_str = "status->kind = ";
00035 
00036   switch (ws->kind)
00037     {
00038     case TARGET_WAITKIND_EXITED:
00039       return xstrprintf ("%sexited, status = %d",
00040                          kind_str, ws->value.integer);
00041     case TARGET_WAITKIND_STOPPED:
00042       return xstrprintf ("%sstopped, signal = %s",
00043                          kind_str, gdb_signal_to_name (ws->value.sig));
00044     case TARGET_WAITKIND_SIGNALLED:
00045       return xstrprintf ("%ssignalled, signal = %s",
00046                          kind_str, gdb_signal_to_name (ws->value.sig));
00047     case TARGET_WAITKIND_LOADED:
00048       return xstrprintf ("%sloaded", kind_str);
00049     case TARGET_WAITKIND_FORKED:
00050       return xstrprintf ("%sforked", kind_str);
00051     case TARGET_WAITKIND_VFORKED:
00052       return xstrprintf ("%svforked", kind_str);
00053     case TARGET_WAITKIND_EXECD:
00054       return xstrprintf ("%sexecd", kind_str);
00055     case TARGET_WAITKIND_VFORK_DONE:
00056       return xstrprintf ("%svfork-done", kind_str);
00057     case TARGET_WAITKIND_SYSCALL_ENTRY:
00058       return xstrprintf ("%sentered syscall", kind_str);
00059     case TARGET_WAITKIND_SYSCALL_RETURN:
00060       return xstrprintf ("%sexited syscall", kind_str);
00061     case TARGET_WAITKIND_SPURIOUS:
00062       return xstrprintf ("%sspurious", kind_str);
00063     case TARGET_WAITKIND_IGNORE:
00064       return xstrprintf ("%signore", kind_str);
00065     case TARGET_WAITKIND_NO_HISTORY:
00066       return xstrprintf ("%sno-history", kind_str);
00067     case TARGET_WAITKIND_NO_RESUMED:
00068       return xstrprintf ("%sno-resumed", kind_str);
00069     default:
00070       return xstrprintf ("%sunknown???", kind_str);
00071     }
00072 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines