GDB (xrefs)

waitstatus.c
Go to the documentation of this file.
1 /* Target waitstatus implementations.
2
3 Copyright (C) 1990-2018 Free Software Foundation, Inc.
4
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 #include "common-defs.h"
21 #include "waitstatus.h"
22
23 /* Return a pretty printed form of target_waitstatus.
24 Space for the result is malloc'd, caller must free. */
25
26 std::string
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:
34 return string_printf ("%sexited, status = %d",
35 kind_str, ws->value.integer);
36 case TARGET_WAITKIND_STOPPED:
37 return string_printf ("%sstopped, signal = %s",
38 kind_str,
39 gdb_signal_to_symbol_string (ws->value.sig));
40 case TARGET_WAITKIND_SIGNALLED:
41 return string_printf ("%ssignalled, signal = %s",
42 kind_str,
43 gdb_signal_to_symbol_string (ws->value.sig));
44 case TARGET_WAITKIND_LOADED:
45 return string_printf ("%sloaded", kind_str);
46 case TARGET_WAITKIND_FORKED:
47 return string_printf ("%sforked", kind_str);
48 case TARGET_WAITKIND_VFORKED:
49 return string_printf ("%svforked", kind_str);
50 case TARGET_WAITKIND_EXECD:
51 return string_printf ("%sexecd", kind_str);
52 case TARGET_WAITKIND_VFORK_DONE:
53 return string_printf ("%svfork-done", kind_str);
54 case TARGET_WAITKIND_SYSCALL_ENTRY:
55 return string_printf ("%sentered syscall", kind_str);
56 case TARGET_WAITKIND_SYSCALL_RETURN:
57 return string_printf ("%sexited syscall", kind_str);
58 case TARGET_WAITKIND_SPURIOUS:
59 return string_printf ("%sspurious", kind_str);
60 case TARGET_WAITKIND_IGNORE:
61 return string_printf ("%signore", kind_str);
62 case TARGET_WAITKIND_NO_HISTORY:
63 return string_printf ("%sno-history", kind_str);
64 case TARGET_WAITKIND_NO_RESUMED:
65 return string_printf ("%sno-resumed", kind_str);
66 case TARGET_WAITKIND_THREAD_CREATED:
67 return string_printf ("%sthread created", kind_str);
68 case TARGET_WAITKIND_THREAD_EXITED:
69 return string_printf ("%sthread exited, status = %d",
70 kind_str, ws->value.integer);
71 default:
72 return string_printf ("%sunknown???", kind_str);
73 }
74 }
string
const char * string
Definition: signals.c:50
TARGET_WAITKIND_SYSCALL_RETURN
Definition: waitstatus.h:72
target_waitstatus
Definition: waitstatus.h:104
TARGET_WAITKIND_SYSCALL_ENTRY
Definition: waitstatus.h:71
target_waitstatus::value
union target_waitstatus::@174 value
TARGET_WAITKIND_THREAD_CREATED
Definition: waitstatus.h:98
TARGET_WAITKIND_EXECD
Definition: waitstatus.h:56
TARGET_WAITKIND_FORKED
Definition: waitstatus.h:48
TARGET_WAITKIND_VFORK_DONE
Definition: waitstatus.h:65
target_waitstatus_to_string
std::string target_waitstatus_to_string(const struct target_waitstatus *ws)
Definition: waitstatus.c:27
TARGET_WAITKIND_SIGNALLED
Definition: waitstatus.h:39
target_waitstatus::sig
enum gdb_signal sig
Definition: waitstatus.h:114
common-defs.h
TARGET_WAITKIND_NO_HISTORY
Definition: waitstatus.h:92
waitstatus.h
target_waitstatus::integer
int integer
Definition: waitstatus.h:112
target_waitstatus::kind
enum target_waitkind kind
Definition: waitstatus.h:106
TARGET_WAITKIND_SPURIOUS
Definition: waitstatus.h:77
TARGET_WAITKIND_EXITED
Definition: waitstatus.h:31
gdb_signal_to_symbol_string
const char * gdb_signal_to_symbol_string(enum gdb_signal sig)
Definition: signals.c:59
string_printf
std::string string_printf(const char *fmt,...)
Definition: common-utils.c:150
TARGET_WAITKIND_VFORKED
Definition: waitstatus.h:52
TARGET_WAITKIND_LOADED
Definition: waitstatus.h:43
TARGET_WAITKIND_NO_RESUMED
Definition: waitstatus.h:95
TARGET_WAITKIND_THREAD_EXITED
Definition: waitstatus.h:101
TARGET_WAITKIND_IGNORE
Definition: waitstatus.h:88
TARGET_WAITKIND_STOPPED
Definition: waitstatus.h:35