Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / target / waitstatus.c
CommitLineData
33b60d58 1/* Target waitstatus implementations.
3360c0bf 2
88b9d363 3 Copyright (C) 1990-2022 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
268a13a5 20#include "gdbsupport/common-defs.h"
33b60d58 21#include "waitstatus.h"
3360c0bf 22
c29705b7 23/* Return a pretty printed form of target_waitstatus. */
3360c0bf 24
23fdd69e 25std::string
3360c0bf
LM
26target_waitstatus_to_string (const struct target_waitstatus *ws)
27{
28 const char *kind_str = "status->kind = ";
29
30 switch (ws->kind)
31 {
32 case TARGET_WAITKIND_EXITED:
23fdd69e
SM
33 return string_printf ("%sexited, status = %d",
34 kind_str, ws->value.integer);
3360c0bf 35 case TARGET_WAITKIND_STOPPED:
23fdd69e
SM
36 return string_printf ("%sstopped, signal = %s",
37 kind_str,
38 gdb_signal_to_symbol_string (ws->value.sig));
3360c0bf 39 case TARGET_WAITKIND_SIGNALLED:
23fdd69e
SM
40 return string_printf ("%ssignalled, signal = %s",
41 kind_str,
42 gdb_signal_to_symbol_string (ws->value.sig));
3360c0bf 43 case TARGET_WAITKIND_LOADED:
23fdd69e 44 return string_printf ("%sloaded", kind_str);
3360c0bf 45 case TARGET_WAITKIND_FORKED:
23fdd69e 46 return string_printf ("%sforked", kind_str);
3360c0bf 47 case TARGET_WAITKIND_VFORKED:
23fdd69e 48 return string_printf ("%svforked", kind_str);
3360c0bf 49 case TARGET_WAITKIND_EXECD:
23fdd69e 50 return string_printf ("%sexecd", kind_str);
3360c0bf 51 case TARGET_WAITKIND_VFORK_DONE:
23fdd69e 52 return string_printf ("%svfork-done", kind_str);
3360c0bf 53 case TARGET_WAITKIND_SYSCALL_ENTRY:
23fdd69e 54 return string_printf ("%sentered syscall", kind_str);
3360c0bf 55 case TARGET_WAITKIND_SYSCALL_RETURN:
23fdd69e 56 return string_printf ("%sexited syscall", kind_str);
3360c0bf 57 case TARGET_WAITKIND_SPURIOUS:
23fdd69e 58 return string_printf ("%sspurious", kind_str);
3360c0bf 59 case TARGET_WAITKIND_IGNORE:
23fdd69e 60 return string_printf ("%signore", kind_str);
3360c0bf 61 case TARGET_WAITKIND_NO_HISTORY:
23fdd69e 62 return string_printf ("%sno-history", kind_str);
3360c0bf 63 case TARGET_WAITKIND_NO_RESUMED:
23fdd69e 64 return string_printf ("%sno-resumed", kind_str);
65706a29 65 case TARGET_WAITKIND_THREAD_CREATED:
23fdd69e 66 return string_printf ("%sthread created", kind_str);
65706a29 67 case TARGET_WAITKIND_THREAD_EXITED:
23fdd69e
SM
68 return string_printf ("%sthread exited, status = %d",
69 kind_str, ws->value.integer);
3360c0bf 70 default:
23fdd69e 71 return string_printf ("%sunknown???", kind_str);
3360c0bf
LM
72 }
73}
This page took 1.452671 seconds and 4 git commands to generate.