]>
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 | ||
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) | |
10 | any later version. | |
11 | ||
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. | |
16 | ||
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. */ | |
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 | ||
90 | /* Last signal that the inferior received (why it stopped). */ | |
91 | ||
92 | extern int stop_signal; | |
93 | ||
94 | /* Address at which inferior stopped. */ | |
95 | ||
96 | extern CORE_ADDR stop_pc; | |
97 | ||
98 | /* Stack frame when program stopped. */ | |
99 | ||
100 | extern FRAME_ADDR stop_frame_address; | |
101 | ||
102 | /* Chain containing status of breakpoint(s) that we have stopped at. */ | |
103 | ||
104 | extern bpstat stop_bpstat; | |
105 | ||
106 | /* Flag indicating that a command has proceeded the inferior past the | |
107 | current breakpoint. */ | |
108 | ||
109 | extern int breakpoint_proceeded; | |
110 | ||
111 | /* Nonzero if stopped due to a step command. */ | |
112 | ||
113 | extern int stop_step; | |
114 | ||
115 | /* Nonzero if stopped due to completion of a stack dummy routine. */ | |
116 | ||
117 | extern int stop_stack_dummy; | |
118 | ||
119 | /* Nonzero if program stopped due to a random (unexpected) signal in | |
120 | inferior process. */ | |
121 | ||
122 | extern int stopped_by_random_signal; | |
123 | ||
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. */ | |
127 | ||
128 | extern CORE_ADDR step_range_start; /* Inclusive */ | |
129 | extern CORE_ADDR step_range_end; /* Exclusive */ | |
130 | ||
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. */ | |
134 | ||
135 | extern FRAME_ADDR step_frame_address; | |
136 | ||
137 | /* 1 means step over all subroutine calls. | |
138 | -1 means step over calls to undebuggable functions. */ | |
139 | ||
140 | extern int step_over_calls; | |
141 | ||
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. */ | |
145 | ||
146 | extern int step_multi; | |
147 | ||
148 | /* Nonzero if proceed is being used for a "finish" command or a similar | |
149 | situation when stop_registers should be saved. */ | |
150 | ||
151 | extern int proceed_to_finish; | |
152 | ||
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). */ | |
157 | ||
158 | extern char stop_registers[REGISTER_BYTES]; | |
159 | ||
160 | /* Nonzero if pc has been changed by the debugger | |
161 | since the inferior stopped. */ | |
162 | ||
163 | extern int pc_changed; | |
164 | ||
165 | /* Nonzero if the child process in inferior_pid was attached rather | |
166 | than forked. */ | |
167 | ||
168 | int attach_flag; | |
169 | \f | |
170 | /* Possible values for CALL_DUMMY_LOCATION. */ | |
171 | #define ON_STACK 1 | |
172 | #define BEFORE_TEXT_END 2 | |
173 | #define AFTER_TEXT_END 3 | |
174 | ||
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. */ | |
182 | ||
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 | |
185 | subtracted out. */ | |
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) \ | |
194 | ((pc) >= text_end \ | |
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. */ |