Commit | Line | Data |
---|---|---|
bd5635a1 RP |
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. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
bdbd5f50 | 7 | This program is free software; you can redistribute it and/or modify |
bd5635a1 | 8 | it under the terms of the GNU General Public License as published by |
bdbd5f50 JG |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | |
bd5635a1 | 11 | |
bdbd5f50 | 12 | This program is distributed in the hope that it will be useful, |
bd5635a1 RP |
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 | |
bdbd5f50 JG |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
bd5635a1 RP |
20 | |
21 | /* For bpstat. */ | |
22 | #include "breakpoint.h" | |
23 | ||
24 | /* For FRAME_ADDR. */ | |
25 | #include "frame.h" | |
26 | ||
27 | /* | |
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 | |
33 | * control variables. | |
34 | */ | |
35 | struct inferior_status { | |
36 | int pc_changed; | |
37 | int stop_signal; | |
38 | int stop_pc; | |
39 | FRAME_ADDR stop_frame_address; | |
40 | bpstat stop_bpstat; | |
41 | int stop_step; | |
42 | int stop_stack_dummy; | |
43 | int stopped_by_random_signal; | |
44 | int trap_expected; | |
45 | CORE_ADDR step_range_start; | |
46 | CORE_ADDR step_range_end; | |
47 | FRAME_ADDR step_frame_address; | |
48 | int step_over_calls; | |
49 | CORE_ADDR step_resume_break_address; | |
50 | int stop_after_trap; | |
51 | int stop_soon_quietly; | |
52 | FRAME_ADDR selected_frame_address; | |
53 | int selected_level; | |
54 | char stop_registers[REGISTER_BYTES]; | |
55 | int breakpoint_proceeded; | |
56 | int restore_stack_info; | |
57 | int proceed_to_finish; | |
58 | }; | |
59 | ||
60 | void save_inferior_status (), restore_inferior_status (); | |
61 | ||
62 | /* File name for default use for standard in/out in the inferior. */ | |
63 | ||
64 | extern char *inferior_io_terminal; | |
65 | ||
66 | /* Pid of our debugged inferior, or 0 if no inferior now. */ | |
67 | ||
68 | extern int inferior_pid; | |
69 | ||
70 | /* Character array containing an image of the inferior programs' registers. */ | |
71 | ||
72 | extern char registers[]; | |
73 | ||
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 (); | |
89 | ||
bdbd5f50 JG |
90 | /* From infcmd.c */ |
91 | void attach_command ( | |
92 | #ifdef __STDC__ | |
93 | char *arg, int from_tty | |
94 | #endif | |
95 | ); | |
96 | ||
bd5635a1 RP |
97 | /* Last signal that the inferior received (why it stopped). */ |
98 | ||
99 | extern int stop_signal; | |
100 | ||
101 | /* Address at which inferior stopped. */ | |
102 | ||
103 | extern CORE_ADDR stop_pc; | |
104 | ||
105 | /* Stack frame when program stopped. */ | |
106 | ||
107 | extern FRAME_ADDR stop_frame_address; | |
108 | ||
109 | /* Chain containing status of breakpoint(s) that we have stopped at. */ | |
110 | ||
111 | extern bpstat stop_bpstat; | |
112 | ||
113 | /* Flag indicating that a command has proceeded the inferior past the | |
114 | current breakpoint. */ | |
115 | ||
116 | extern int breakpoint_proceeded; | |
117 | ||
118 | /* Nonzero if stopped due to a step command. */ | |
119 | ||
120 | extern int stop_step; | |
121 | ||
122 | /* Nonzero if stopped due to completion of a stack dummy routine. */ | |
123 | ||
124 | extern int stop_stack_dummy; | |
125 | ||
126 | /* Nonzero if program stopped due to a random (unexpected) signal in | |
127 | inferior process. */ | |
128 | ||
129 | extern int stopped_by_random_signal; | |
130 | ||
131 | /* Range to single step within. | |
132 | If this is nonzero, respond to a single-step signal | |
133 | by continuing to step if the pc is in this range. */ | |
134 | ||
135 | extern CORE_ADDR step_range_start; /* Inclusive */ | |
136 | extern CORE_ADDR step_range_end; /* Exclusive */ | |
137 | ||
138 | /* Stack frame address as of when stepping command was issued. | |
139 | This is how we know when we step into a subroutine call, | |
140 | and how to set the frame for the breakpoint used to step out. */ | |
141 | ||
142 | extern FRAME_ADDR step_frame_address; | |
143 | ||
144 | /* 1 means step over all subroutine calls. | |
145 | -1 means step over calls to undebuggable functions. */ | |
146 | ||
147 | extern int step_over_calls; | |
148 | ||
149 | /* If stepping, nonzero means step count is > 1 | |
150 | so don't print frame next time inferior stops | |
151 | if it stops due to stepping. */ | |
152 | ||
153 | extern int step_multi; | |
154 | ||
bdbd5f50 JG |
155 | /* Nonzero means expecting a trap and caller will handle it themselves. |
156 | It is used after attach, due to attaching to a process; | |
157 | when running in the shell before the child program has been exec'd; | |
158 | and when running some kinds of remote stuff (FIXME?). */ | |
159 | ||
160 | int stop_soon_quietly; | |
161 | ||
bd5635a1 RP |
162 | /* Nonzero if proceed is being used for a "finish" command or a similar |
163 | situation when stop_registers should be saved. */ | |
164 | ||
165 | extern int proceed_to_finish; | |
166 | ||
167 | /* Save register contents here when about to pop a stack dummy frame, | |
168 | if-and-only-if proceed_to_finish is set. | |
169 | Thus this contains the return value from the called function (assuming | |
170 | values are returned in a register). */ | |
171 | ||
172 | extern char stop_registers[REGISTER_BYTES]; | |
173 | ||
174 | /* Nonzero if pc has been changed by the debugger | |
175 | since the inferior stopped. */ | |
176 | ||
177 | extern int pc_changed; | |
178 | ||
179 | /* Nonzero if the child process in inferior_pid was attached rather | |
180 | than forked. */ | |
181 | ||
182 | int attach_flag; | |
183 | \f | |
184 | /* Possible values for CALL_DUMMY_LOCATION. */ | |
185 | #define ON_STACK 1 | |
186 | #define BEFORE_TEXT_END 2 | |
187 | #define AFTER_TEXT_END 3 | |
188 | ||
189 | #if !defined (CALL_DUMMY_LOCATION) | |
190 | #if defined (CANNOT_EXECUTE_STACK) | |
191 | #define CALL_DUMMY_LOCATION BEFORE_TEXT_END | |
192 | #else /* Can execute stack. */ | |
193 | #define CALL_DUMMY_LOCATION ON_STACK | |
194 | #endif /* Can execute stack. */ | |
195 | #endif /* No CALL_DUMMY_LOCATION. */ | |
196 | ||
197 | /* Are we in a call dummy? The code below which allows DECR_PC_AFTER_BREAK | |
198 | below is for infrun.c, which may give the macro a pc without that | |
199 | subtracted out. */ | |
200 | #if !defined (PC_IN_CALL_DUMMY) | |
201 | #if CALL_DUMMY_LOCATION == BEFORE_TEXT_END | |
202 | #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \ | |
203 | ((pc) >= text_end - CALL_DUMMY_LENGTH \ | |
204 | && (pc) < text_end + DECR_PC_AFTER_BREAK) | |
205 | #else /* Not before text_end. */ | |
206 | #if CALL_DUMMY_LOCATION == AFTER_TEXT_END | |
207 | #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \ | |
208 | ((pc) >= text_end \ | |
209 | && (pc) < text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK) | |
210 | #else /* On stack. */ | |
211 | #define PC_IN_CALL_DUMMY(pc, sp, frame_address) \ | |
212 | ((sp) INNER_THAN (pc) && (pc) INNER_THAN (frame_address)) | |
213 | #endif /* On stack. */ | |
214 | #endif /* Not before text_end. */ | |
215 | #endif /* No PC_IN_CALL_DUMMY. */ |