Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* Variables that describe the inferior process running under GDB: |
2 | Where it is, why it stopped, and how to step it. | |
1bac305b | 3 | |
ecd75fc8 | 4 | Copyright (C) 1986-2014 Free Software Foundation, Inc. |
c906108c | 5 | |
c5aa993b | 6 | This file is part of GDB. |
c906108c | 7 | |
c5aa993b JM |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 10 | the Free Software Foundation; either version 3 of the License, or |
c5aa993b | 11 | (at your option) any later version. |
c906108c | 12 | |
c5aa993b JM |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
c906108c | 17 | |
c5aa993b | 18 | You should have received a copy of the GNU General Public License |
a9762ec7 | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c SS |
20 | |
21 | #if !defined (INFERIOR_H) | |
22 | #define INFERIOR_H 1 | |
23 | ||
da3331ec AC |
24 | struct target_waitstatus; |
25 | struct frame_info; | |
26 | struct ui_file; | |
27 | struct type; | |
67a2b77e | 28 | struct gdbarch; |
72cec141 | 29 | struct regcache; |
b77209e0 | 30 | struct ui_out; |
7e1789f5 | 31 | struct terminal_info; |
6ecd4729 | 32 | struct target_desc_info; |
67a2b77e | 33 | |
d26e3629 KY |
34 | #include "ptid.h" |
35 | ||
c906108c SS |
36 | /* For bpstat. */ |
37 | #include "breakpoint.h" | |
38 | ||
2ea28649 | 39 | /* For enum gdb_signal. */ |
c906108c SS |
40 | #include "target.h" |
41 | ||
aa0cd9c1 AC |
42 | /* For struct frame_id. */ |
43 | #include "frame.h" | |
44 | ||
6c95b8df | 45 | #include "progspace.h" |
8e260fc0 | 46 | #include "registry.h" |
6c95b8df | 47 | |
16c381f0 JK |
48 | struct infcall_suspend_state; |
49 | struct infcall_control_state; | |
7a292a7a | 50 | |
16c381f0 JK |
51 | extern struct infcall_suspend_state *save_infcall_suspend_state (void); |
52 | extern struct infcall_control_state *save_infcall_control_state (void); | |
c906108c | 53 | |
16c381f0 JK |
54 | extern void restore_infcall_suspend_state (struct infcall_suspend_state *); |
55 | extern void restore_infcall_control_state (struct infcall_control_state *); | |
b89667eb | 56 | |
16c381f0 JK |
57 | extern struct cleanup *make_cleanup_restore_infcall_suspend_state |
58 | (struct infcall_suspend_state *); | |
59 | extern struct cleanup *make_cleanup_restore_infcall_control_state | |
60 | (struct infcall_control_state *); | |
b89667eb | 61 | |
16c381f0 JK |
62 | extern void discard_infcall_suspend_state (struct infcall_suspend_state *); |
63 | extern void discard_infcall_control_state (struct infcall_control_state *); | |
7a292a7a | 64 | |
16c381f0 JK |
65 | extern struct regcache * |
66 | get_infcall_suspend_state_regcache (struct infcall_suspend_state *); | |
b89667eb | 67 | |
ce696e05 KB |
68 | /* Save value of inferior_ptid so that it may be restored by |
69 | a later call to do_cleanups(). Returns the struct cleanup | |
70 | pointer needed for later doing the cleanup. */ | |
71 | extern struct cleanup * save_inferior_ptid (void); | |
72 | ||
a14ed312 | 73 | extern void set_sigint_trap (void); |
c906108c | 74 | |
a14ed312 | 75 | extern void clear_sigint_trap (void); |
c906108c | 76 | |
3cb3b8df | 77 | /* Set/get file name for default use for standard in/out in the inferior. */ |
c906108c | 78 | |
3cb3b8df BR |
79 | extern void set_inferior_io_terminal (const char *terminal_name); |
80 | extern const char *get_inferior_io_terminal (void); | |
c906108c | 81 | |
39f77062 | 82 | /* Collected pid, tid, etc. of the debugged inferior. When there's |
dfd4cc63 | 83 | no inferior, ptid_get_pid (inferior_ptid) will be 0. */ |
c906108c | 84 | |
39f77062 | 85 | extern ptid_t inferior_ptid; |
c906108c | 86 | |
43ff13b4 JM |
87 | /* Are we simulating synchronous execution? This is used in async gdb |
88 | to implement the 'run', 'continue' etc commands, which will not | |
1777feb0 | 89 | redisplay the prompt until the execution is actually over. */ |
43ff13b4 JM |
90 | extern int sync_execution; |
91 | ||
1777feb0 | 92 | /* Inferior environment. */ |
c906108c | 93 | |
a14ed312 | 94 | extern void clear_proceed_status (void); |
c906108c | 95 | |
2ea28649 | 96 | extern void proceed (CORE_ADDR, enum gdb_signal, int); |
c906108c | 97 | |
d4db2f36 PA |
98 | extern int sched_multi; |
99 | ||
5fbbeb29 CF |
100 | /* When set, stop the 'step' command if we enter a function which has |
101 | no line number information. The normal behavior is that we step | |
102 | over such function. */ | |
103 | extern int step_stop_if_no_debug; | |
104 | ||
ad52ddc6 PA |
105 | /* If set, the inferior should be controlled in non-stop mode. In |
106 | this mode, each thread is controlled independently. Execution | |
b021a221 | 107 | commands apply only to the selected thread by default, and stop |
ad52ddc6 PA |
108 | events stop only the thread that had the event -- the other threads |
109 | are kept running freely. */ | |
110 | extern int non_stop; | |
111 | ||
03583c20 UW |
112 | /* When set (default), the target should attempt to disable the operating |
113 | system's address space randomization feature when starting an inferior. */ | |
114 | extern int disable_randomization; | |
115 | ||
a14ed312 | 116 | extern void generic_mourn_inferior (void); |
c906108c | 117 | |
9898f801 UW |
118 | extern CORE_ADDR unsigned_pointer_to_address (struct gdbarch *gdbarch, |
119 | struct type *type, | |
b60c417a | 120 | const gdb_byte *buf); |
9898f801 UW |
121 | extern void unsigned_address_to_pointer (struct gdbarch *gdbarch, |
122 | struct type *type, gdb_byte *buf, | |
ac2e2ef7 | 123 | CORE_ADDR addr); |
9898f801 UW |
124 | extern CORE_ADDR signed_pointer_to_address (struct gdbarch *gdbarch, |
125 | struct type *type, | |
b60c417a | 126 | const gdb_byte *buf); |
9898f801 UW |
127 | extern void address_to_signed_pointer (struct gdbarch *gdbarch, |
128 | struct type *type, gdb_byte *buf, | |
ac2e2ef7 | 129 | CORE_ADDR addr); |
4478b372 | 130 | |
e4c8541f | 131 | extern void wait_for_inferior (void); |
c906108c | 132 | |
24291992 PA |
133 | extern void prepare_for_detach (void); |
134 | ||
a14ed312 | 135 | extern void fetch_inferior_event (void *); |
43ff13b4 | 136 | |
a14ed312 | 137 | extern void init_wait_for_inferior (void); |
c906108c | 138 | |
a14ed312 | 139 | extern void reopen_exec_file (void); |
c906108c SS |
140 | |
141 | /* The `resume' routine should only be called in special circumstances. | |
142 | Normally, use `proceed', which handles a lot of bookkeeping. */ | |
143 | ||
2ea28649 | 144 | extern void resume (int, enum gdb_signal); |
c906108c | 145 | |
09cee04b PA |
146 | extern ptid_t user_visible_resume_ptid (int step); |
147 | ||
9da8c2a0 PA |
148 | extern void insert_step_resume_breakpoint_at_sal (struct gdbarch *, |
149 | struct symtab_and_line , | |
150 | struct frame_id); | |
151 | ||
c906108c SS |
152 | /* From misc files */ |
153 | ||
0ab7a791 AC |
154 | extern void default_print_registers_info (struct gdbarch *gdbarch, |
155 | struct ui_file *file, | |
156 | struct frame_info *frame, | |
157 | int regnum, int all); | |
666e11c5 | 158 | |
0a4f40a2 | 159 | extern void child_terminal_info (struct target_ops *self, const char *, int); |
c906108c | 160 | |
a14ed312 | 161 | extern void term_info (char *, int); |
c906108c | 162 | |
d6b64346 PA |
163 | extern void child_terminal_save_ours (struct target_ops *self); |
164 | ||
165 | extern void child_terminal_ours (struct target_ops *self); | |
166 | ||
167 | extern void child_terminal_ours_for_output (struct target_ops *self); | |
c906108c | 168 | |
d6b64346 | 169 | extern void child_terminal_inferior (struct target_ops *self); |
c906108c | 170 | |
d6b64346 | 171 | extern void child_terminal_init (struct target_ops *self); |
c906108c | 172 | |
d6b64346 | 173 | extern void child_terminal_init_with_pgrp (int pgrp); |
c906108c | 174 | |
c906108c SS |
175 | /* From fork-child.c */ |
176 | ||
136d6dae VP |
177 | extern int fork_inferior (char *, char *, char **, |
178 | void (*)(void), | |
e69860f1 TG |
179 | void (*)(int), void (*)(void), char *, |
180 | void (*)(const char *, | |
181 | char * const *, char * const *)); | |
c906108c SS |
182 | |
183 | ||
a14ed312 | 184 | extern void startup_inferior (int); |
c906108c | 185 | |
bd57a748 | 186 | extern char *construct_inferior_arguments (int, char **); |
552c04a7 | 187 | |
c906108c SS |
188 | /* From infrun.c */ |
189 | ||
ccce17b0 | 190 | extern unsigned int debug_infrun; |
628fe4e4 JK |
191 | |
192 | extern int stop_on_solib_events; | |
193 | ||
8621d6a9 | 194 | extern void start_remote (int from_tty); |
c906108c | 195 | |
a14ed312 | 196 | extern void normal_stop (void); |
c906108c | 197 | |
0c7e1a46 PA |
198 | extern void print_stop_event (struct target_waitstatus *ws); |
199 | ||
a14ed312 | 200 | extern int signal_stop_state (int); |
c906108c | 201 | |
a14ed312 | 202 | extern int signal_print_state (int); |
c906108c | 203 | |
a14ed312 | 204 | extern int signal_pass_state (int); |
c906108c | 205 | |
a14ed312 | 206 | extern int signal_stop_update (int, int); |
d4f3574e | 207 | |
a14ed312 | 208 | extern int signal_print_update (int, int); |
d4f3574e | 209 | |
a14ed312 | 210 | extern int signal_pass_update (int, int); |
d4f3574e | 211 | |
39f77062 KB |
212 | extern void get_last_target_status(ptid_t *ptid, |
213 | struct target_waitstatus *status); | |
e02bc4cc | 214 | |
6604731b DJ |
215 | extern void follow_inferior_reset_breakpoints (void); |
216 | ||
edb3359d DJ |
217 | void set_step_info (struct frame_info *frame, struct symtab_and_line sal); |
218 | ||
0c557179 SDJ |
219 | /* Clear the convenience variables associated with the exit of the |
220 | inferior. Currently, those variables are $_exitcode and | |
221 | $_exitsignal. */ | |
222 | ||
223 | extern void clear_exit_convenience_vars (void); | |
224 | ||
31e77af2 PA |
225 | /* Returns true if we're trying to step past the instruction at |
226 | ADDRESS in ASPACE. */ | |
227 | ||
228 | extern int stepping_past_instruction_at (struct address_space *aspace, | |
229 | CORE_ADDR address); | |
230 | ||
c906108c SS |
231 | /* From infcmd.c */ |
232 | ||
281b533b DJ |
233 | extern void post_create_inferior (struct target_ops *, int); |
234 | ||
a14ed312 | 235 | extern void attach_command (char *, int); |
c906108c | 236 | |
a250df2e | 237 | extern char *get_inferior_args (void); |
07091751 | 238 | |
3f81c18a | 239 | extern void set_inferior_args (char *); |
07091751 | 240 | |
552c04a7 TT |
241 | extern void set_inferior_args_vector (int, char **); |
242 | ||
36dc181b EZ |
243 | extern void registers_info (char *, int); |
244 | ||
77ebaa5a VP |
245 | extern void continue_1 (int all_threads); |
246 | ||
77ebaa5a VP |
247 | extern void interrupt_target_1 (int all_threads); |
248 | ||
186c406b TT |
249 | extern void delete_longjmp_breakpoint_cleanup (void *arg); |
250 | ||
6418d433 VP |
251 | extern void detach_command (char *, int); |
252 | ||
1941c569 PA |
253 | extern void notice_new_inferior (ptid_t, int, int); |
254 | ||
6a3a010b | 255 | extern struct value *get_return_value (struct value *function, |
cc72b2a2 KP |
256 | struct type *value_type); |
257 | ||
98882a26 PA |
258 | /* Whether to start up the debuggee under a shell. |
259 | ||
260 | If startup-with-shell is set, GDB's "run" will attempt to start up | |
261 | the debuggee under a shell. | |
262 | ||
263 | This is in order for argument-expansion to occur. E.g., | |
264 | ||
265 | (gdb) run * | |
266 | ||
267 | The "*" gets expanded by the shell into a list of files. | |
268 | ||
269 | While this is a nice feature, it may be handy to bypass the shell | |
270 | in some cases. To disable this feature, do "set startup-with-shell | |
271 | false". | |
272 | ||
273 | The catch-exec traps expected during start-up will be one more if | |
274 | the target is started up with a shell. */ | |
275 | extern int startup_with_shell; | |
276 | ||
c906108c SS |
277 | /* Address at which inferior stopped. */ |
278 | ||
279 | extern CORE_ADDR stop_pc; | |
280 | ||
c906108c SS |
281 | /* Nonzero if stopped due to completion of a stack dummy routine. */ |
282 | ||
aa7d318d | 283 | extern enum stop_stack_kind stop_stack_dummy; |
c906108c SS |
284 | |
285 | /* Nonzero if program stopped due to a random (unexpected) signal in | |
286 | inferior process. */ | |
287 | ||
288 | extern int stopped_by_random_signal; | |
289 | ||
a49f981f MS |
290 | /* STEP_OVER_ALL means step over all subroutine calls. |
291 | STEP_OVER_UNDEBUGGABLE means step over calls to undebuggable functions. | |
292 | STEP_OVER_NONE means don't step over any subroutine calls. */ | |
c906108c | 293 | |
5fbbeb29 CF |
294 | enum step_over_calls_kind |
295 | { | |
296 | STEP_OVER_NONE, | |
297 | STEP_OVER_ALL, | |
a4acd088 CF |
298 | STEP_OVER_UNDEBUGGABLE |
299 | }; | |
300 | ||
b0f4b84b DJ |
301 | /* Anything but NO_STOP_QUIETLY means we expect a trap and the caller |
302 | will handle it themselves. STOP_QUIETLY is used when running in | |
303 | the shell before the child program has been exec'd and when running | |
304 | through shared library loading. STOP_QUIETLY_REMOTE is used when | |
305 | setting up a remote connection; it is like STOP_QUIETLY_NO_SIGSTOP | |
306 | except that there is no need to hide a signal. */ | |
c54cfec8 | 307 | |
1777feb0 | 308 | /* It is also used after attach, due to attaching to a process. This |
c54cfec8 EZ |
309 | is a bit trickier. When doing an attach, the kernel stops the |
310 | debuggee with a SIGSTOP. On newer GNU/Linux kernels (>= 2.5.61) | |
1777feb0 | 311 | the handling of SIGSTOP for a ptraced process has changed. Earlier |
c54cfec8 EZ |
312 | versions of the kernel would ignore these SIGSTOPs, while now |
313 | SIGSTOP is treated like any other signal, i.e. it is not muffled. | |
314 | ||
315 | If the gdb user does a 'continue' after the 'attach', gdb passes | |
316 | the global variable stop_signal (which stores the signal from the | |
317 | attach, SIGSTOP) to the ptrace(PTRACE_CONT,...) call. This is | |
318 | problematic, because the kernel doesn't ignore such SIGSTOP | |
1777feb0 | 319 | now. I.e. it is reported back to gdb, which in turn presents it |
c54cfec8 EZ |
320 | back to the user. |
321 | ||
322 | To avoid the problem, we use STOP_QUIETLY_NO_SIGSTOP, which allows | |
323 | gdb to clear the value of stop_signal after the attach, so that it | |
324 | is not passed back down to the kernel. */ | |
325 | ||
326 | enum stop_kind | |
327 | { | |
328 | NO_STOP_QUIETLY = 0, | |
329 | STOP_QUIETLY, | |
b0f4b84b | 330 | STOP_QUIETLY_REMOTE, |
c54cfec8 EZ |
331 | STOP_QUIETLY_NO_SIGSTOP |
332 | }; | |
c906108c | 333 | |
b2175913 MS |
334 | /* Reverse execution. */ |
335 | enum exec_direction_kind | |
336 | { | |
337 | EXEC_FORWARD, | |
d8b34453 | 338 | EXEC_REVERSE |
b2175913 MS |
339 | }; |
340 | ||
32231432 PA |
341 | /* The current execution direction. This should only be set to enum |
342 | exec_direction_kind values. It is only an int to make it | |
343 | compatible with make_cleanup_restore_integer. */ | |
344 | extern int execution_direction; | |
b2175913 | 345 | |
642fd101 DE |
346 | /* Save register contents here when executing a "finish" command or are |
347 | about to pop a stack dummy frame, if-and-only-if proceed_to_finish is set. | |
c906108c SS |
348 | Thus this contains the return value from the called function (assuming |
349 | values are returned in a register). */ | |
350 | ||
72cec141 | 351 | extern struct regcache *stop_registers; |
c906108c | 352 | |
237fc4c9 PA |
353 | /* True if we are debugging displaced stepping. */ |
354 | extern int debug_displaced; | |
355 | ||
356 | /* Dump LEN bytes at BUF in hex to FILE, followed by a newline. */ | |
357 | void displaced_step_dump_bytes (struct ui_file *file, | |
358 | const gdb_byte *buf, size_t len); | |
359 | ||
9a1edae6 | 360 | struct displaced_step_closure *get_displaced_step_closure_by_addr (CORE_ADDR addr); |
c906108c | 361 | \f |
faaf634c | 362 | /* Possible values for gdbarch_call_dummy_location. */ |
c906108c | 363 | #define ON_STACK 1 |
c906108c SS |
364 | #define AT_ENTRY_POINT 4 |
365 | ||
98882a26 PA |
366 | /* Number of traps that happen between exec'ing the shell to run an |
367 | inferior and when we finally get to the inferior code, not counting | |
368 | the exec for the shell. This is 1 on most implementations. | |
369 | Overridden in nm.h files. */ | |
c906108c | 370 | #if !defined(START_INFERIOR_TRAPS_EXPECTED) |
98882a26 | 371 | #define START_INFERIOR_TRAPS_EXPECTED 1 |
c906108c | 372 | #endif |
b77209e0 PA |
373 | |
374 | struct private_inferior; | |
375 | ||
16c381f0 JK |
376 | /* Inferior process specific part of `struct infcall_control_state'. |
377 | ||
378 | Inferior thread counterpart is `struct thread_control_state'. */ | |
379 | ||
380 | struct inferior_control_state | |
381 | { | |
382 | /* See the definition of stop_kind above. */ | |
383 | enum stop_kind stop_soon; | |
384 | }; | |
385 | ||
386 | /* Inferior process specific part of `struct infcall_suspend_state'. | |
387 | ||
388 | Inferior thread counterpart is `struct thread_suspend_state'. */ | |
389 | ||
dd80ea3c | 390 | #if 0 /* Currently unused and empty structures are not valid C. */ |
16c381f0 JK |
391 | struct inferior_suspend_state |
392 | { | |
393 | }; | |
dd80ea3c | 394 | #endif |
16c381f0 | 395 | |
b77209e0 PA |
396 | /* GDB represents the state of each program execution with an object |
397 | called an inferior. An inferior typically corresponds to a process | |
398 | but is more general and applies also to targets that do not have a | |
399 | notion of processes. Each run of an executable creates a new | |
400 | inferior, as does each attachment to an existing process. | |
401 | Inferiors have unique internal identifiers that are different from | |
402 | target process ids. Each inferior may in turn have multiple | |
403 | threads running in it. */ | |
404 | ||
405 | struct inferior | |
406 | { | |
407 | /* Pointer to next inferior in singly-linked list of inferiors. */ | |
408 | struct inferior *next; | |
409 | ||
410 | /* Convenient handle (GDB inferior id). Unique across all | |
411 | inferiors. */ | |
412 | int num; | |
413 | ||
414 | /* Actual target inferior id, usually, a process id. This matches | |
415 | the ptid_t.pid member of threads of this inferior. */ | |
416 | int pid; | |
e714e1bf UW |
417 | /* True if the PID was actually faked by GDB. */ |
418 | int fake_pid_p; | |
b77209e0 | 419 | |
16c381f0 JK |
420 | /* State of GDB control of inferior process execution. |
421 | See `struct inferior_control_state'. */ | |
422 | struct inferior_control_state control; | |
423 | ||
424 | /* State of inferior process to restore after GDB is done with an inferior | |
425 | call. See `struct inferior_suspend_state'. */ | |
dd80ea3c | 426 | #if 0 /* Currently unused and empty structures are not valid C. */ |
16c381f0 | 427 | struct inferior_suspend_state suspend; |
dd80ea3c | 428 | #endif |
16c381f0 | 429 | |
6c95b8df PA |
430 | /* True if this was an auto-created inferior, e.g. created from |
431 | following a fork; false, if this inferior was manually added by | |
432 | the user, and we should not attempt to prune it | |
433 | automatically. */ | |
434 | int removable; | |
435 | ||
436 | /* The address space bound to this inferior. */ | |
437 | struct address_space *aspace; | |
438 | ||
439 | /* The program space bound to this inferior. */ | |
440 | struct program_space *pspace; | |
441 | ||
3f81c18a VP |
442 | /* The arguments string to use when running. */ |
443 | char *args; | |
444 | ||
445 | /* The size of elements in argv. */ | |
446 | int argc; | |
447 | ||
448 | /* The vector version of arguments. If ARGC is nonzero, | |
449 | then we must compute ARGS from this (via the target). | |
450 | This is always coming from main's argv and therefore | |
451 | should never be freed. */ | |
452 | char **argv; | |
453 | ||
454 | /* The name of terminal device to use for I/O. */ | |
455 | char *terminal; | |
456 | ||
457 | /* Environment to use for running inferior, | |
458 | in format described in environ.h. */ | |
459 | struct gdb_environ *environment; | |
460 | ||
181e7f93 PA |
461 | /* Nonzero if this child process was attached rather than |
462 | forked. */ | |
463 | int attach_flag; | |
464 | ||
6c95b8df PA |
465 | /* If this inferior is a vfork child, then this is the pointer to |
466 | its vfork parent, if GDB is still attached to it. */ | |
467 | struct inferior *vfork_parent; | |
468 | ||
469 | /* If this process is a vfork parent, this is the pointer to the | |
470 | child. Since a vfork parent is left frozen by the kernel until | |
471 | the child execs or exits, a process can only have one vfork child | |
472 | at a given time. */ | |
473 | struct inferior *vfork_child; | |
474 | ||
475 | /* True if this inferior should be detached when it's vfork sibling | |
476 | exits or execs. */ | |
477 | int pending_detach; | |
478 | ||
479 | /* True if this inferior is a vfork parent waiting for a vfork child | |
480 | not under our control to be done with the shared memory region, | |
481 | either by exiting or execing. */ | |
482 | int waiting_for_vfork_done; | |
483 | ||
24291992 PA |
484 | /* True if we're in the process of detaching from this inferior. */ |
485 | int detaching; | |
486 | ||
e0ba6746 PA |
487 | /* What is left to do for an execution command after any thread of |
488 | this inferior stops. For continuations associated with a | |
489 | specific thread, see `struct thread_info'. */ | |
490 | struct continuation *continuations; | |
491 | ||
b77209e0 PA |
492 | /* Private data used by the target vector implementation. */ |
493 | struct private_inferior *private; | |
a96d9b2e | 494 | |
8cf64490 TT |
495 | /* HAS_EXIT_CODE is true if the inferior exited with an exit code. |
496 | In this case, the EXIT_CODE field is also valid. */ | |
497 | int has_exit_code; | |
498 | LONGEST exit_code; | |
499 | ||
7dcd53a0 TT |
500 | /* Default flags to pass to the symbol reading functions. These are |
501 | used whenever a new objfile is created. The valid values come | |
502 | from enum symfile_add_flags. */ | |
503 | int symfile_flags; | |
504 | ||
6ecd4729 PA |
505 | /* Info about an inferior's target description (if it's fetched; the |
506 | user supplied description's filename, if any; etc.). */ | |
507 | struct target_desc_info *tdesc_info; | |
508 | ||
509 | /* The architecture associated with the inferior through the | |
510 | connection to the target. | |
511 | ||
512 | The architecture vector provides some information that is really | |
513 | a property of the inferior, accessed through a particular target: | |
514 | ptrace operations; the layout of certain RSP packets; the | |
515 | solib_ops vector; etc. To differentiate architecture accesses to | |
516 | per-inferior/target properties from | |
517 | per-thread/per-frame/per-objfile properties, accesses to | |
518 | per-inferior/target properties should be made through | |
519 | this gdbarch. */ | |
520 | struct gdbarch *gdbarch; | |
521 | ||
6c95b8df | 522 | /* Per inferior data-pointers required by other GDB modules. */ |
8e260fc0 | 523 | REGISTRY_FIELDS; |
b77209e0 PA |
524 | }; |
525 | ||
6c95b8df PA |
526 | /* Keep a registry of per-inferior data-pointers required by other GDB |
527 | modules. */ | |
528 | ||
8e260fc0 | 529 | DECLARE_REGISTRY (inferior); |
6c95b8df | 530 | |
b77209e0 PA |
531 | /* Create an empty inferior list, or empty the existing one. */ |
532 | extern void init_inferior_list (void); | |
533 | ||
534 | /* Add an inferior to the inferior list, print a message that a new | |
535 | inferior is found, and return the pointer to the new inferior. | |
536 | Caller may use this pointer to initialize the private inferior | |
537 | data. */ | |
538 | extern struct inferior *add_inferior (int pid); | |
539 | ||
540 | /* Same as add_inferior, but don't print new inferior notifications to | |
541 | the CLI. */ | |
542 | extern struct inferior *add_inferior_silent (int pid); | |
543 | ||
544 | /* Delete an existing inferior list entry, due to inferior exit. */ | |
545 | extern void delete_inferior (int pid); | |
546 | ||
a79b8f6e VP |
547 | extern void delete_inferior_1 (struct inferior *todel, int silent); |
548 | ||
b77209e0 PA |
549 | /* Same as delete_inferior, but don't print new inferior notifications |
550 | to the CLI. */ | |
551 | extern void delete_inferior_silent (int pid); | |
552 | ||
553 | /* Delete an existing inferior list entry, due to inferior detaching. */ | |
554 | extern void detach_inferior (int pid); | |
555 | ||
6c95b8df PA |
556 | extern void exit_inferior (int pid); |
557 | ||
558 | extern void exit_inferior_silent (int pid); | |
559 | ||
560 | extern void exit_inferior_num_silent (int num); | |
561 | ||
562 | extern void inferior_appeared (struct inferior *inf, int pid); | |
563 | ||
82f73884 PA |
564 | /* Get rid of all inferiors. */ |
565 | extern void discard_all_inferiors (void); | |
566 | ||
b77209e0 PA |
567 | /* Translate the integer inferior id (GDB's homegrown id, not the system's) |
568 | into a "pid" (which may be overloaded with extra inferior information). */ | |
569 | extern int gdb_inferior_id_to_pid (int); | |
570 | ||
571 | /* Translate a target 'pid' into the integer inferior id (GDB's | |
572 | homegrown id, not the system's). */ | |
573 | extern int pid_to_gdb_inferior_id (int pid); | |
574 | ||
575 | /* Boolean test for an already-known pid. */ | |
576 | extern int in_inferior_list (int pid); | |
577 | ||
578 | /* Boolean test for an already-known inferior id (GDB's homegrown id, | |
579 | not the system's). */ | |
2c0b251b | 580 | extern int valid_gdb_inferior_id (int num); |
b77209e0 | 581 | |
6c95b8df | 582 | /* Search function to lookup an inferior by target 'pid'. */ |
b77209e0 PA |
583 | extern struct inferior *find_inferior_pid (int pid); |
584 | ||
6c95b8df PA |
585 | /* Search function to lookup an inferior by GDB 'num'. */ |
586 | extern struct inferior *find_inferior_id (int num); | |
587 | ||
588 | /* Find an inferior bound to PSPACE. */ | |
589 | extern struct inferior * | |
590 | find_inferior_for_program_space (struct program_space *pspace); | |
591 | ||
b77209e0 PA |
592 | /* Inferior iterator function. |
593 | ||
594 | Calls a callback function once for each inferior, so long as the | |
595 | callback function returns false. If the callback function returns | |
596 | true, the iteration will end and the current inferior will be | |
597 | returned. This can be useful for implementing a search for a | |
598 | inferior with arbitrary attributes, or for applying some operation | |
599 | to every inferior. | |
600 | ||
601 | It is safe to delete the iterated inferior from the callback. */ | |
602 | extern struct inferior *iterate_over_inferiors (int (*) (struct inferior *, | |
603 | void *), | |
604 | void *); | |
605 | ||
b77209e0 PA |
606 | /* Returns true if the inferior list is not empty. */ |
607 | extern int have_inferiors (void); | |
608 | ||
c35b1492 PA |
609 | /* Returns true if there are any live inferiors in the inferior list |
610 | (not cores, not executables, real live processes). */ | |
611 | extern int have_live_inferiors (void); | |
612 | ||
b77209e0 PA |
613 | /* Return a pointer to the current inferior. It is an error to call |
614 | this if there is no current inferior. */ | |
615 | extern struct inferior *current_inferior (void); | |
616 | ||
6c95b8df PA |
617 | extern void set_current_inferior (struct inferior *); |
618 | ||
619 | extern struct cleanup *save_current_inferior (void); | |
620 | ||
c65b3e0d PA |
621 | /* Traverse all inferiors. */ |
622 | ||
623 | #define ALL_INFERIORS(I) \ | |
624 | for ((I) = inferior_list; (I); (I) = (I)->next) | |
625 | ||
6c95b8df PA |
626 | extern struct inferior *inferior_list; |
627 | ||
628 | /* Prune away automatically added inferiors that aren't required | |
629 | anymore. */ | |
630 | extern void prune_inferiors (void); | |
631 | ||
632 | extern int number_of_inferiors (void); | |
633 | ||
a79b8f6e VP |
634 | extern struct inferior *add_inferior_with_spaces (void); |
635 | ||
d914c394 SS |
636 | extern void update_observer_mode (void); |
637 | ||
9b224c5e PA |
638 | extern void update_signals_program_target (void); |
639 | ||
ab04a2af TT |
640 | extern void signal_catch_update (const unsigned int *); |
641 | ||
ed01b82c PA |
642 | /* In some circumstances we allow a command to specify a numeric |
643 | signal. The idea is to keep these circumstances limited so that | |
644 | users (and scripts) develop portable habits. For comparison, | |
645 | POSIX.2 `kill' requires that 1,2,3,6,9,14, and 15 work (and using a | |
646 | numeric signal at all is obsolescent. We are slightly more lenient | |
647 | and allow 1-15 which should match host signal numbers on most | |
648 | systems. Use of symbolic signal names is strongly encouraged. */ | |
649 | ||
2ea28649 | 650 | enum gdb_signal gdb_signal_from_command (int num); |
ed01b82c | 651 | |
c906108c | 652 | #endif /* !defined (INFERIOR_H) */ |