Commit | Line | Data |
---|---|---|
33b60d58 | 1 | /* Target waitstatus implementations. |
3360c0bf LM |
2 | |
3 | Copyright (C) 1990-2013 Free Software Foundation, Inc. | |
4 | ||
3360c0bf LM |
5 | This file is part of GDB. |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #ifdef GDBSERVER | |
21 | #include "server.h" | |
22 | #else | |
23 | #include "defs.h" | |
24 | #endif | |
25 | ||
33b60d58 | 26 | #include "waitstatus.h" |
3360c0bf LM |
27 | |
28 | /* Return a pretty printed form of target_waitstatus. | |
29 | Space for the result is malloc'd, caller must free. */ | |
30 | ||
31 | char * | |
32 | target_waitstatus_to_string (const struct target_waitstatus *ws) | |
33 | { | |
34 | const char *kind_str = "status->kind = "; | |
35 | ||
36 | switch (ws->kind) | |
37 | { | |
38 | case TARGET_WAITKIND_EXITED: | |
39 | return xstrprintf ("%sexited, status = %d", | |
40 | kind_str, ws->value.integer); | |
41 | case TARGET_WAITKIND_STOPPED: | |
42 | return xstrprintf ("%sstopped, signal = %s", | |
c9737c08 PA |
43 | kind_str, |
44 | gdb_signal_to_symbol_string (ws->value.sig)); | |
3360c0bf LM |
45 | case TARGET_WAITKIND_SIGNALLED: |
46 | return xstrprintf ("%ssignalled, signal = %s", | |
c9737c08 PA |
47 | kind_str, |
48 | gdb_signal_to_symbol_string (ws->value.sig)); | |
3360c0bf LM |
49 | case TARGET_WAITKIND_LOADED: |
50 | return xstrprintf ("%sloaded", kind_str); | |
51 | case TARGET_WAITKIND_FORKED: | |
52 | return xstrprintf ("%sforked", kind_str); | |
53 | case TARGET_WAITKIND_VFORKED: | |
54 | return xstrprintf ("%svforked", kind_str); | |
55 | case TARGET_WAITKIND_EXECD: | |
56 | return xstrprintf ("%sexecd", kind_str); | |
57 | case TARGET_WAITKIND_VFORK_DONE: | |
58 | return xstrprintf ("%svfork-done", kind_str); | |
59 | case TARGET_WAITKIND_SYSCALL_ENTRY: | |
60 | return xstrprintf ("%sentered syscall", kind_str); | |
61 | case TARGET_WAITKIND_SYSCALL_RETURN: | |
62 | return xstrprintf ("%sexited syscall", kind_str); | |
63 | case TARGET_WAITKIND_SPURIOUS: | |
64 | return xstrprintf ("%sspurious", kind_str); | |
65 | case TARGET_WAITKIND_IGNORE: | |
66 | return xstrprintf ("%signore", kind_str); | |
67 | case TARGET_WAITKIND_NO_HISTORY: | |
68 | return xstrprintf ("%sno-history", kind_str); | |
69 | case TARGET_WAITKIND_NO_RESUMED: | |
70 | return xstrprintf ("%sno-resumed", kind_str); | |
71 | default: | |
72 | return xstrprintf ("%sunknown???", kind_str); | |
73 | } | |
74 | } |