Commit | Line | Data |
---|---|---|
33b60d58 | 1 | /* Target waitstatus implementations. |
3360c0bf | 2 | |
42a4f53d | 3 | Copyright (C) 1990-2019 Free Software Foundation, Inc. |
3360c0bf | 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 | ||
0747795c | 20 | #include "common/common-defs.h" |
33b60d58 | 21 | #include "waitstatus.h" |
3360c0bf LM |
22 | |
23 | /* Return a pretty printed form of target_waitstatus. | |
24 | Space for the result is malloc'd, caller must free. */ | |
25 | ||
23fdd69e | 26 | std::string |
3360c0bf LM |
27 | target_waitstatus_to_string (const struct target_waitstatus *ws) |
28 | { | |
29 | const char *kind_str = "status->kind = "; | |
30 | ||
31 | switch (ws->kind) | |
32 | { | |
33 | case TARGET_WAITKIND_EXITED: | |
23fdd69e SM |
34 | return string_printf ("%sexited, status = %d", |
35 | kind_str, ws->value.integer); | |
3360c0bf | 36 | case TARGET_WAITKIND_STOPPED: |
23fdd69e SM |
37 | return string_printf ("%sstopped, signal = %s", |
38 | kind_str, | |
39 | gdb_signal_to_symbol_string (ws->value.sig)); | |
3360c0bf | 40 | case TARGET_WAITKIND_SIGNALLED: |
23fdd69e SM |
41 | return string_printf ("%ssignalled, signal = %s", |
42 | kind_str, | |
43 | gdb_signal_to_symbol_string (ws->value.sig)); | |
3360c0bf | 44 | case TARGET_WAITKIND_LOADED: |
23fdd69e | 45 | return string_printf ("%sloaded", kind_str); |
3360c0bf | 46 | case TARGET_WAITKIND_FORKED: |
23fdd69e | 47 | return string_printf ("%sforked", kind_str); |
3360c0bf | 48 | case TARGET_WAITKIND_VFORKED: |
23fdd69e | 49 | return string_printf ("%svforked", kind_str); |
3360c0bf | 50 | case TARGET_WAITKIND_EXECD: |
23fdd69e | 51 | return string_printf ("%sexecd", kind_str); |
3360c0bf | 52 | case TARGET_WAITKIND_VFORK_DONE: |
23fdd69e | 53 | return string_printf ("%svfork-done", kind_str); |
3360c0bf | 54 | case TARGET_WAITKIND_SYSCALL_ENTRY: |
23fdd69e | 55 | return string_printf ("%sentered syscall", kind_str); |
3360c0bf | 56 | case TARGET_WAITKIND_SYSCALL_RETURN: |
23fdd69e | 57 | return string_printf ("%sexited syscall", kind_str); |
3360c0bf | 58 | case TARGET_WAITKIND_SPURIOUS: |
23fdd69e | 59 | return string_printf ("%sspurious", kind_str); |
3360c0bf | 60 | case TARGET_WAITKIND_IGNORE: |
23fdd69e | 61 | return string_printf ("%signore", kind_str); |
3360c0bf | 62 | case TARGET_WAITKIND_NO_HISTORY: |
23fdd69e | 63 | return string_printf ("%sno-history", kind_str); |
3360c0bf | 64 | case TARGET_WAITKIND_NO_RESUMED: |
23fdd69e | 65 | return string_printf ("%sno-resumed", kind_str); |
65706a29 | 66 | case TARGET_WAITKIND_THREAD_CREATED: |
23fdd69e | 67 | return string_printf ("%sthread created", kind_str); |
65706a29 | 68 | case TARGET_WAITKIND_THREAD_EXITED: |
23fdd69e SM |
69 | return string_printf ("%sthread exited, status = %d", |
70 | kind_str, ws->value.integer); | |
3360c0bf | 71 | default: |
23fdd69e | 72 | return string_printf ("%sunknown???", kind_str); |
3360c0bf LM |
73 | } |
74 | } |