1 /* Common target operations for GDB and gdbserver.
3 Copyright (C) 1990-2013 Free Software Foundation, Inc.
5 Contributed by Cygnus Support.
6 Contributed by MontaVista Software.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
29 /* Return a pretty printed form of target_waitstatus.
30 Space for the result is malloc'd, caller must free. */
32 #include "target-common.h"
34 /* Return a pretty printed form of target_waitstatus.
35 Space for the result is malloc'd, caller must free. */
38 target_waitstatus_to_string (const struct target_waitstatus
*ws
)
40 const char *kind_str
= "status->kind = ";
44 case TARGET_WAITKIND_EXITED
:
45 return xstrprintf ("%sexited, status = %d",
46 kind_str
, ws
->value
.integer
);
47 case TARGET_WAITKIND_STOPPED
:
48 return xstrprintf ("%sstopped, signal = %s",
49 kind_str
, gdb_signal_to_name (ws
->value
.sig
));
50 case TARGET_WAITKIND_SIGNALLED
:
51 return xstrprintf ("%ssignalled, signal = %s",
52 kind_str
, gdb_signal_to_name (ws
->value
.sig
));
53 case TARGET_WAITKIND_LOADED
:
54 return xstrprintf ("%sloaded", kind_str
);
55 case TARGET_WAITKIND_FORKED
:
56 return xstrprintf ("%sforked", kind_str
);
57 case TARGET_WAITKIND_VFORKED
:
58 return xstrprintf ("%svforked", kind_str
);
59 case TARGET_WAITKIND_EXECD
:
60 return xstrprintf ("%sexecd", kind_str
);
61 case TARGET_WAITKIND_VFORK_DONE
:
62 return xstrprintf ("%svfork-done", kind_str
);
63 case TARGET_WAITKIND_SYSCALL_ENTRY
:
64 return xstrprintf ("%sentered syscall", kind_str
);
65 case TARGET_WAITKIND_SYSCALL_RETURN
:
66 return xstrprintf ("%sexited syscall", kind_str
);
67 case TARGET_WAITKIND_SPURIOUS
:
68 return xstrprintf ("%sspurious", kind_str
);
69 case TARGET_WAITKIND_IGNORE
:
70 return xstrprintf ("%signore", kind_str
);
71 case TARGET_WAITKIND_NO_HISTORY
:
72 return xstrprintf ("%sno-history", kind_str
);
73 case TARGET_WAITKIND_NO_RESUMED
:
74 return xstrprintf ("%sno-resumed", kind_str
);
76 return xstrprintf ("%sunknown???", kind_str
);