Commit | Line | Data |
---|---|---|
3360c0bf LM |
1 | /* Interface between the debugger and target environments, including files |
2 | and processes, shared between GDB and gdbserver. | |
3 | ||
4 | Copyright (C) 1990-2013 Free Software Foundation, Inc. | |
5 | ||
6 | Contributed by Cygnus Support. Written by John Gilmore. | |
7 | ||
8 | This file is part of GDB. | |
9 | ||
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. | |
14 | ||
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. | |
19 | ||
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/>. */ | |
22 | ||
23 | #ifndef TARGET_COMMON_H | |
24 | #define TARGET_COMMON_H | |
25 | ||
26 | #include "common-utils.h" | |
27 | #include "ptid.h" | |
28 | #include "gdb_signals.h" | |
29 | ||
30 | /* Ways to "resume" a thread. */ | |
31 | ||
32 | enum resume_kind | |
33 | { | |
34 | /* Thread should continue. */ | |
35 | resume_continue, | |
36 | ||
37 | /* Thread should single-step. */ | |
38 | resume_step, | |
39 | ||
40 | /* Thread should be stopped. */ | |
41 | resume_stop | |
42 | }; | |
43 | ||
44 | /* Stuff for target_wait. */ | |
45 | ||
46 | /* Generally, what has the program done? */ | |
47 | enum target_waitkind | |
48 | { | |
49 | /* The program has exited. The exit status is in value.integer. */ | |
50 | TARGET_WAITKIND_EXITED, | |
51 | ||
52 | /* The program has stopped with a signal. Which signal is in | |
53 | value.sig. */ | |
54 | TARGET_WAITKIND_STOPPED, | |
55 | ||
56 | /* The program has terminated with a signal. Which signal is in | |
57 | value.sig. */ | |
58 | TARGET_WAITKIND_SIGNALLED, | |
59 | ||
60 | /* The program is letting us know that it dynamically loaded something | |
61 | (e.g. it called load(2) on AIX). */ | |
62 | TARGET_WAITKIND_LOADED, | |
63 | ||
64 | /* The program has forked. A "related" process' PTID is in | |
65 | value.related_pid. I.e., if the child forks, value.related_pid | |
66 | is the parent's ID. */ | |
67 | TARGET_WAITKIND_FORKED, | |
68 | ||
69 | /* The program has vforked. A "related" process's PTID is in | |
70 | value.related_pid. */ | |
71 | TARGET_WAITKIND_VFORKED, | |
72 | ||
73 | /* The program has exec'ed a new executable file. The new file's | |
74 | pathname is pointed to by value.execd_pathname. */ | |
75 | TARGET_WAITKIND_EXECD, | |
76 | ||
77 | /* The program had previously vforked, and now the child is done | |
78 | with the shared memory region, because it exec'ed or exited. | |
79 | Note that the event is reported to the vfork parent. This is | |
80 | only used if GDB did not stay attached to the vfork child, | |
81 | otherwise, a TARGET_WAITKIND_EXECD or | |
82 | TARGET_WAITKIND_EXIT|SIGNALLED event associated with the child | |
83 | has the same effect. */ | |
84 | TARGET_WAITKIND_VFORK_DONE, | |
85 | ||
86 | /* The program has entered or returned from a system call. On | |
87 | HP-UX, this is used in the hardware watchpoint implementation. | |
88 | The syscall's unique integer ID number is in value.syscall_id. */ | |
89 | TARGET_WAITKIND_SYSCALL_ENTRY, | |
90 | TARGET_WAITKIND_SYSCALL_RETURN, | |
91 | ||
92 | /* Nothing happened, but we stopped anyway. This perhaps should be handled | |
93 | within target_wait, but I'm not sure target_wait should be resuming the | |
94 | inferior. */ | |
95 | TARGET_WAITKIND_SPURIOUS, | |
96 | ||
97 | /* An event has occured, but we should wait again. | |
98 | Remote_async_wait() returns this when there is an event | |
99 | on the inferior, but the rest of the world is not interested in | |
100 | it. The inferior has not stopped, but has just sent some output | |
101 | to the console, for instance. In this case, we want to go back | |
102 | to the event loop and wait there for another event from the | |
103 | inferior, rather than being stuck in the remote_async_wait() | |
104 | function. sThis way the event loop is responsive to other events, | |
105 | like for instance the user typing. */ | |
106 | TARGET_WAITKIND_IGNORE, | |
107 | ||
108 | /* The target has run out of history information, | |
109 | and cannot run backward any further. */ | |
110 | TARGET_WAITKIND_NO_HISTORY, | |
111 | ||
112 | /* There are no resumed children left in the program. */ | |
113 | TARGET_WAITKIND_NO_RESUMED | |
114 | }; | |
115 | ||
116 | struct target_waitstatus | |
117 | { | |
118 | enum target_waitkind kind; | |
119 | ||
120 | /* Additional information about the event. */ | |
121 | union | |
122 | { | |
123 | /* Exit status */ | |
124 | int integer; | |
125 | /* Signal number */ | |
126 | enum gdb_signal sig; | |
127 | /* Forked child pid */ | |
128 | ptid_t related_pid; | |
129 | /* execd pathname */ | |
130 | char *execd_pathname; | |
131 | /* Syscall number */ | |
132 | int syscall_number; | |
133 | } value; | |
134 | }; | |
135 | ||
136 | /* Options that can be passed to target_wait. */ | |
137 | ||
138 | /* Return immediately if there's no event already queued. If this | |
139 | options is not requested, target_wait blocks waiting for an | |
140 | event. */ | |
141 | #define TARGET_WNOHANG 1 | |
142 | ||
143 | /* Prototypes */ | |
144 | ||
145 | /* Return a pretty printed form of target_waitstatus. | |
146 | Space for the result is malloc'd, caller must free. */ | |
147 | extern char *target_waitstatus_to_string (const struct target_waitstatus *); | |
148 | ||
149 | #endif /* TARGET_COMMON_H */ |