gdbserver: Fix non-stop / fork / step-over issues
[deliverable/binutils-gdb.git] / gdb / target / waitstatus.h
CommitLineData
33b60d58 1/* Target waitstatus definitions and prototypes.
3360c0bf 2
32d0add0 3 Copyright (C) 1990-2015 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
33b60d58
LM
20#ifndef WAITSTATUS_H
21#define WAITSTATUS_H
3360c0bf 22
3360c0bf
LM
23#include "gdb_signals.h"
24
3360c0bf
LM
25/* Stuff for target_wait. */
26
27/* Generally, what has the program done? */
28enum target_waitkind
29{
30 /* The program has exited. The exit status is in value.integer. */
31 TARGET_WAITKIND_EXITED,
32
33 /* The program has stopped with a signal. Which signal is in
34 value.sig. */
35 TARGET_WAITKIND_STOPPED,
36
37 /* The program has terminated with a signal. Which signal is in
38 value.sig. */
39 TARGET_WAITKIND_SIGNALLED,
40
33b60d58
LM
41 /* The program is letting us know that it dynamically loaded
42 something (e.g. it called load(2) on AIX). */
3360c0bf
LM
43 TARGET_WAITKIND_LOADED,
44
45 /* The program has forked. A "related" process' PTID is in
46 value.related_pid. I.e., if the child forks, value.related_pid
47 is the parent's ID. */
48 TARGET_WAITKIND_FORKED,
49
50 /* The program has vforked. A "related" process's PTID is in
51 value.related_pid. */
52 TARGET_WAITKIND_VFORKED,
53
54 /* The program has exec'ed a new executable file. The new file's
55 pathname is pointed to by value.execd_pathname. */
56 TARGET_WAITKIND_EXECD,
57
58 /* The program had previously vforked, and now the child is done
59 with the shared memory region, because it exec'ed or exited.
60 Note that the event is reported to the vfork parent. This is
61 only used if GDB did not stay attached to the vfork child,
62 otherwise, a TARGET_WAITKIND_EXECD or
63 TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child
64 has the same effect. */
65 TARGET_WAITKIND_VFORK_DONE,
66
67 /* The program has entered or returned from a system call. On
68 HP-UX, this is used in the hardware watchpoint implementation.
33b60d58
LM
69 The syscall's unique integer ID number is in
70 value.syscall_id. */
3360c0bf
LM
71 TARGET_WAITKIND_SYSCALL_ENTRY,
72 TARGET_WAITKIND_SYSCALL_RETURN,
73
33b60d58
LM
74 /* Nothing happened, but we stopped anyway. This perhaps should
75 be handled within target_wait, but I'm not sure target_wait
76 should be resuming the inferior. */
3360c0bf
LM
77 TARGET_WAITKIND_SPURIOUS,
78
79 /* An event has occured, but we should wait again.
80 Remote_async_wait() returns this when there is an event
81 on the inferior, but the rest of the world is not interested in
82 it. The inferior has not stopped, but has just sent some output
83 to the console, for instance. In this case, we want to go back
84 to the event loop and wait there for another event from the
85 inferior, rather than being stuck in the remote_async_wait()
c8a62302 86 function. This way the event loop is responsive to other events,
3360c0bf
LM
87 like for instance the user typing. */
88 TARGET_WAITKIND_IGNORE,
89
90 /* The target has run out of history information,
91 and cannot run backward any further. */
92 TARGET_WAITKIND_NO_HISTORY,
93
94 /* There are no resumed children left in the program. */
95 TARGET_WAITKIND_NO_RESUMED
96};
97
98struct target_waitstatus
99{
100 enum target_waitkind kind;
101
102 /* Additional information about the event. */
103 union
104 {
105 /* Exit status */
106 int integer;
107 /* Signal number */
108 enum gdb_signal sig;
109 /* Forked child pid */
110 ptid_t related_pid;
111 /* execd pathname */
112 char *execd_pathname;
113 /* Syscall number */
114 int syscall_number;
115 } value;
116};
117
15c66dd6
PA
118/* Extended reasons that can explain why a target/thread stopped for a
119 trap signal. */
120
121enum target_stop_reason
122{
123 /* Either not stopped, or stopped for a reason that doesn't require
124 special tracking. */
125 TARGET_STOPPED_BY_NO_REASON,
126
127 /* Stopped by a software breakpoint. */
128 TARGET_STOPPED_BY_SW_BREAKPOINT,
129
130 /* Stopped by a hardware breakpoint. */
131 TARGET_STOPPED_BY_HW_BREAKPOINT,
132
133 /* Stopped by a watchpoint. */
863d01bd
PA
134 TARGET_STOPPED_BY_WATCHPOINT,
135
136 /* Stopped by a single step finishing. */
137 TARGET_STOPPED_BY_SINGLE_STEP
15c66dd6
PA
138};
139
3360c0bf
LM
140/* Prototypes */
141
142/* Return a pretty printed form of target_waitstatus.
143 Space for the result is malloc'd, caller must free. */
144extern char *target_waitstatus_to_string (const struct target_waitstatus *);
145
33b60d58 146#endif /* WAITSTATUS_H */
This page took 0.262813 seconds and 4 git commands to generate.