1 /* Variables that describe the inferior process running under GDB:
2 Where it is, why it stopped, and how to step it.
3 Copyright (C) 1986, 1989 Free Software Foundation, Inc.
5 This file is part of GDB.
7 GDB 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 1, or (at your option)
12 GDB 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 GDB; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 #include "breakpoint.h"
28 * Structure in which to save the status of the inferior. Save
29 * through "save_inferior_status", restore through
30 * "restore_inferior_status".
31 * This pair of routines should be called around any transfer of
32 * control to the inferior which you don't want showing up in your
35 struct inferior_status {
39 FRAME_ADDR stop_frame_address;
43 int stopped_by_random_signal;
45 CORE_ADDR step_range_start;
46 CORE_ADDR step_range_end;
47 FRAME_ADDR step_frame_address;
49 CORE_ADDR step_resume_break_address;
51 int stop_soon_quietly;
52 FRAME_ADDR selected_frame_address;
54 char stop_registers[REGISTER_BYTES];
55 int breakpoint_proceeded;
56 int restore_stack_info;
57 int proceed_to_finish;
60 void save_inferior_status (), restore_inferior_status ();
62 /* File name for default use for standard in/out in the inferior. */
64 extern char *inferior_io_terminal;
66 /* Pid of our debugged inferior, or 0 if no inferior now. */
68 extern int inferior_pid;
70 /* Character array containing an image of the inferior programs' registers. */
72 extern char registers[];
74 extern void clear_proceed_status ();
75 extern void start_inferior ();
76 extern void proceed ();
77 extern void kill_inferior ();
78 extern void kill_inferior_fast ();
79 extern void generic_mourn_inferior ();
80 extern void terminal_ours ();
81 extern void detach ();
82 extern void run_stack_dummy ();
83 extern CORE_ADDR read_pc ();
84 extern void write_pc ();
85 extern void wait_for_inferior ();
86 extern void init_wait_for_inferior ();
87 extern void close_exec_file ();
88 extern void reopen_exec_file ();
90 /* Last signal that the inferior received (why it stopped). */
92 extern int stop_signal;
94 /* Address at which inferior stopped. */
96 extern CORE_ADDR stop_pc;
98 /* Stack frame when program stopped. */
100 extern FRAME_ADDR stop_frame_address;
102 /* Chain containing status of breakpoint(s) that we have stopped at. */
104 extern bpstat stop_bpstat;
106 /* Flag indicating that a command has proceeded the inferior past the
107 current breakpoint. */
109 extern int breakpoint_proceeded;
111 /* Nonzero if stopped due to a step command. */
113 extern int stop_step;
115 /* Nonzero if stopped due to completion of a stack dummy routine. */
117 extern int stop_stack_dummy;
119 /* Nonzero if program stopped due to a random (unexpected) signal in
122 extern int stopped_by_random_signal;
124 /* Range to single step within.
125 If this is nonzero, respond to a single-step signal
126 by continuing to step if the pc is in this range. */
128 extern CORE_ADDR step_range_start; /* Inclusive */
129 extern CORE_ADDR step_range_end; /* Exclusive */
131 /* Stack frame address as of when stepping command was issued.
132 This is how we know when we step into a subroutine call,
133 and how to set the frame for the breakpoint used to step out. */
135 extern FRAME_ADDR step_frame_address;
137 /* 1 means step over all subroutine calls.
138 -1 means step over calls to undebuggable functions. */
140 extern int step_over_calls;
142 /* If stepping, nonzero means step count is > 1
143 so don't print frame next time inferior stops
144 if it stops due to stepping. */
146 extern int step_multi;
148 /* Nonzero if proceed is being used for a "finish" command or a similar
149 situation when stop_registers should be saved. */
151 extern int proceed_to_finish;
153 /* Save register contents here when about to pop a stack dummy frame,
154 if-and-only-if proceed_to_finish is set.
155 Thus this contains the return value from the called function (assuming
156 values are returned in a register). */
158 extern char stop_registers[REGISTER_BYTES];
160 /* Nonzero if pc has been changed by the debugger
161 since the inferior stopped. */
163 extern int pc_changed;
165 /* Nonzero if the child process in inferior_pid was attached rather
170 /* Possible values for CALL_DUMMY_LOCATION. */
172 #define BEFORE_TEXT_END 2
173 #define AFTER_TEXT_END 3
175 #if !defined (CALL_DUMMY_LOCATION)
176 #if defined (CANNOT_EXECUTE_STACK)
177 #define CALL_DUMMY_LOCATION BEFORE_TEXT_END
178 #else /* Can execute stack. */
179 #define CALL_DUMMY_LOCATION ON_STACK
180 #endif /* Can execute stack. */
181 #endif /* No CALL_DUMMY_LOCATION. */
183 /* Are we in a call dummy? The code below which allows DECR_PC_AFTER_BREAK
184 below is for infrun.c, which may give the macro a pc without that
186 #if !defined (PC_IN_CALL_DUMMY)
187 #if CALL_DUMMY_LOCATION == BEFORE_TEXT_END
188 #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
189 ((pc) >= text_end - CALL_DUMMY_LENGTH \
190 && (pc) < text_end + DECR_PC_AFTER_BREAK)
191 #else /* Not before text_end. */
192 #if CALL_DUMMY_LOCATION == AFTER_TEXT_END
193 #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
195 && (pc) < text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK)
196 #else /* On stack. */
197 #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
198 ((sp) INNER_THAN (pc) && (pc) INNER_THAN (frame_address))
199 #endif /* On stack. */
200 #endif /* Not before text_end. */
201 #endif /* No PC_IN_CALL_DUMMY. */