1 /* Variables that describe the inferior process running under GDB:
2 Where it is, why it stopped, and how to step it.
3 Copyright 1986, 1989, 1992 Free Software Foundation, Inc.
5 This file is part of GDB.
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 2 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #if !defined (INFERIOR_H)
24 /* For symtab_and_line */
28 #include "breakpoint.h"
34 * Structure in which to save the status of the inferior. Save
35 * through "save_inferior_status", restore through
36 * "restore_inferior_status".
37 * This pair of routines should be called around any transfer of
38 * control to the inferior which you don't want showing up in your
41 struct inferior_status
{
45 FRAME_ADDR stop_frame_address
;
49 int stopped_by_random_signal
;
51 CORE_ADDR step_range_start
;
52 CORE_ADDR step_range_end
;
53 FRAME_ADDR step_frame_address
;
55 CORE_ADDR step_resume_break_address
;
57 int stop_soon_quietly
;
58 FRAME_ADDR selected_frame_address
;
60 char stop_registers
[REGISTER_BYTES
];
61 int breakpoint_proceeded
;
62 int restore_stack_info
;
63 int proceed_to_finish
;
67 save_inferior_status
PARAMS ((struct inferior_status
*, int));
70 restore_inferior_status
PARAMS ((struct inferior_status
*));
72 /* File name for default use for standard in/out in the inferior. */
74 extern char *inferior_io_terminal
;
76 /* Pid of our debugged inferior, or 0 if no inferior now. */
78 extern int inferior_pid
;
80 /* Character array containing an image of the inferior programs' registers. */
82 extern char registers
[];
85 clear_proceed_status
PARAMS ((void));
88 proceed
PARAMS ((CORE_ADDR
, int, int));
91 kill_inferior
PARAMS ((void));
94 kill_inferior_fast
PARAMS ((void));
97 generic_mourn_inferior
PARAMS ((void));
100 terminal_ours
PARAMS ((void));
103 run_stack_dummy
PARAMS ((CORE_ADDR
, char [REGISTER_BYTES
]));
106 read_pc
PARAMS ((void));
109 write_pc
PARAMS ((CORE_ADDR
));
112 wait_for_inferior
PARAMS ((void));
115 init_wait_for_inferior
PARAMS ((void));
118 close_exec_file
PARAMS ((void));
121 reopen_exec_file
PARAMS ((void));
123 /* From misc files */
126 store_inferior_registers
PARAMS ((int));
129 fetch_inferior_registers
PARAMS ((int));
132 solib_create_inferior_hook
PARAMS ((void));
135 child_mourn_inferior
PARAMS ((void));
138 child_terminal_info
PARAMS ((char *, int));
141 term_info
PARAMS ((char *, int));
144 terminal_ours_for_output
PARAMS ((void));
147 terminal_inferior
PARAMS ((void));
150 terminal_init_inferior
PARAMS ((void));
152 /* From infptrace.c or procfs.c */
155 attach
PARAMS ((int));
158 detach
PARAMS ((int));
161 child_resume
PARAMS ((int, int));
168 proc_iterate_over_mappings
PARAMS ((int (*) (int, CORE_ADDR
)));
171 proc_wait
PARAMS ((int *));
174 inferior_proc_init
PARAMS ((int));
177 proc_signal_handling_change
PARAMS ((void));
180 proc_set_exec_trap
PARAMS ((void));
187 new_tty_prefork
PARAMS ((char *));
192 start_remote
PARAMS ((void));
195 child_create_inferior
PARAMS ((char *, char *, char **));
198 child_attach
PARAMS ((char *, int));
201 normal_stop
PARAMS ((void));
204 signal_stop_state
PARAMS ((int));
207 signal_print_state
PARAMS ((int));
210 signal_pass_state
PARAMS ((int));
215 tty_command
PARAMS ((char *, int));
218 attach_command
PARAMS ((char *, int));
220 /* Last signal that the inferior received (why it stopped). */
222 extern int stop_signal
;
224 /* Address at which inferior stopped. */
226 extern CORE_ADDR stop_pc
;
228 /* Stack frame when program stopped. */
230 extern FRAME_ADDR stop_frame_address
;
232 /* Chain containing status of breakpoint(s) that we have stopped at. */
234 extern bpstat stop_bpstat
;
236 /* Flag indicating that a command has proceeded the inferior past the
237 current breakpoint. */
239 extern int breakpoint_proceeded
;
241 /* Nonzero if stopped due to a step command. */
243 extern int stop_step
;
245 /* Nonzero if stopped due to completion of a stack dummy routine. */
247 extern int stop_stack_dummy
;
249 /* Nonzero if program stopped due to a random (unexpected) signal in
252 extern int stopped_by_random_signal
;
254 /* Range to single step within.
255 If this is nonzero, respond to a single-step signal
256 by continuing to step if the pc is in this range. */
258 extern CORE_ADDR step_range_start
; /* Inclusive */
259 extern CORE_ADDR step_range_end
; /* Exclusive */
261 /* Stack frame address as of when stepping command was issued.
262 This is how we know when we step into a subroutine call,
263 and how to set the frame for the breakpoint used to step out. */
265 extern FRAME_ADDR step_frame_address
;
267 /* 1 means step over all subroutine calls.
268 -1 means step over calls to undebuggable functions. */
270 extern int step_over_calls
;
272 /* If stepping, nonzero means step count is > 1
273 so don't print frame next time inferior stops
274 if it stops due to stepping. */
276 extern int step_multi
;
278 /* Nonzero means expecting a trap and caller will handle it themselves.
279 It is used after attach, due to attaching to a process;
280 when running in the shell before the child program has been exec'd;
281 and when running some kinds of remote stuff (FIXME?). */
283 extern int stop_soon_quietly
;
285 /* Nonzero if proceed is being used for a "finish" command or a similar
286 situation when stop_registers should be saved. */
288 extern int proceed_to_finish
;
290 /* Save register contents here when about to pop a stack dummy frame,
291 if-and-only-if proceed_to_finish is set.
292 Thus this contains the return value from the called function (assuming
293 values are returned in a register). */
295 extern char stop_registers
[REGISTER_BYTES
];
297 /* Nonzero if pc has been changed by the debugger
298 since the inferior stopped. */
300 extern int pc_changed
;
302 /* Nonzero if the child process in inferior_pid was attached rather
305 extern int attach_flag
;
307 /* Possible values for CALL_DUMMY_LOCATION. */
309 #define BEFORE_TEXT_END 2
310 #define AFTER_TEXT_END 3
312 #if !defined (CALL_DUMMY_LOCATION)
313 #define CALL_DUMMY_LOCATION ON_STACK
314 #endif /* No CALL_DUMMY_LOCATION. */
316 /* Are we in a call dummy? The code below which allows DECR_PC_AFTER_BREAK
317 below is for infrun.c, which may give the macro a pc without that
319 #if !defined (PC_IN_CALL_DUMMY)
320 #if CALL_DUMMY_LOCATION == BEFORE_TEXT_END
321 extern CORE_ADDR text_end
;
322 #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
323 ((pc) >= text_end - CALL_DUMMY_LENGTH \
324 && (pc) < text_end + DECR_PC_AFTER_BREAK)
325 #else /* Not before text_end. */
326 #if CALL_DUMMY_LOCATION == AFTER_TEXT_END
327 extern CORE_ADDR text_end
;
328 #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
330 && (pc) < text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK)
331 #else /* On stack. */
332 #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
333 ((sp) INNER_THAN (pc) && (pc) INNER_THAN (frame_address))
334 #endif /* On stack. */
335 #endif /* Not before text_end. */
336 #endif /* No PC_IN_CALL_DUMMY. */
338 #endif /* !defined (INFERIOR_H) */