**** start-sanitize-chill ****
[deliverable/binutils-gdb.git] / gdb / inferior.h
CommitLineData
bd5635a1
RP
1/* Variables that describe the inferior process running under GDB:
2 Where it is, why it stopped, and how to step it.
cc221e76 3 Copyright 1986, 1989, 1992 Free Software Foundation, Inc.
bd5635a1
RP
4
5This file is part of GDB.
6
bdbd5f50 7This program is free software; you can redistribute it and/or modify
bd5635a1 8it under the terms of the GNU General Public License as published by
bdbd5f50
JG
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
bd5635a1 11
bdbd5f50 12This program is distributed in the hope that it will be useful,
bd5635a1
RP
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
bdbd5f50
JG
18along with this program; if not, write to the Free Software
19Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
bd5635a1 20
cc221e76
FF
21#if !defined (INFERIOR_H)
22#define INFERIOR_H 1
23
24/* For symtab_and_line */
25#include "symtab.h"
26
bd5635a1
RP
27/* For bpstat. */
28#include "breakpoint.h"
29
30/* For FRAME_ADDR. */
31#include "frame.h"
32
33/*
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
39 * control variables.
40 */
41struct inferior_status {
42 int pc_changed;
43 int stop_signal;
44 int stop_pc;
45 FRAME_ADDR stop_frame_address;
46 bpstat stop_bpstat;
47 int stop_step;
48 int stop_stack_dummy;
49 int stopped_by_random_signal;
50 int trap_expected;
51 CORE_ADDR step_range_start;
52 CORE_ADDR step_range_end;
53 FRAME_ADDR step_frame_address;
54 int step_over_calls;
55 CORE_ADDR step_resume_break_address;
56 int stop_after_trap;
57 int stop_soon_quietly;
58 FRAME_ADDR selected_frame_address;
59 int selected_level;
60 char stop_registers[REGISTER_BYTES];
61 int breakpoint_proceeded;
62 int restore_stack_info;
63 int proceed_to_finish;
64};
65
cc221e76
FF
66extern void
67save_inferior_status PARAMS ((struct inferior_status *, int));
68
69extern void
70restore_inferior_status PARAMS ((struct inferior_status *));
bd5635a1
RP
71
72/* File name for default use for standard in/out in the inferior. */
73
74extern char *inferior_io_terminal;
75
76/* Pid of our debugged inferior, or 0 if no inferior now. */
77
78extern int inferior_pid;
79
80/* Character array containing an image of the inferior programs' registers. */
81
82extern char registers[];
83
310cc570
RP
84/* Array of validity bits (one per register). Nonzero at position XXX_REGNUM
85 means that `registers' contains a valid copy of inferior register XXX. */
86
87extern char register_valid[NUM_REGS];
88
cc221e76
FF
89extern void
90clear_proceed_status PARAMS ((void));
91
92extern void
93proceed PARAMS ((CORE_ADDR, int, int));
94
95extern void
96kill_inferior PARAMS ((void));
97
cc221e76
FF
98extern void
99generic_mourn_inferior PARAMS ((void));
100
101extern void
102terminal_ours PARAMS ((void));
103
104extern void
105run_stack_dummy PARAMS ((CORE_ADDR, char [REGISTER_BYTES]));
106
107extern CORE_ADDR
108read_pc PARAMS ((void));
109
110extern void
111write_pc PARAMS ((CORE_ADDR));
112
113extern void
114wait_for_inferior PARAMS ((void));
115
116extern void
117init_wait_for_inferior PARAMS ((void));
118
119extern void
120close_exec_file PARAMS ((void));
121
122extern void
123reopen_exec_file PARAMS ((void));
124
3aa6856a
JG
125/* The `resume' routine should only be called in special circumstances.
126 Normally, use `proceed', which handles a lot of bookkeeping. */
310cc570
RP
127extern void
128resume PARAMS ((int, int));
129
cc221e76
FF
130/* From misc files */
131
132extern void
133store_inferior_registers PARAMS ((int));
134
135extern void
136fetch_inferior_registers PARAMS ((int));
137
138extern void
139solib_create_inferior_hook PARAMS ((void));
140
cc221e76
FF
141extern void
142child_terminal_info PARAMS ((char *, int));
143
144extern void
145term_info PARAMS ((char *, int));
146
147extern void
148terminal_ours_for_output PARAMS ((void));
149
150extern void
151terminal_inferior PARAMS ((void));
152
153extern void
154terminal_init_inferior PARAMS ((void));
155
34517ebc 156/* From infptrace.c */
cc221e76
FF
157
158extern int
159attach PARAMS ((int));
160
161void
162detach PARAMS ((int));
163
164extern void
165child_resume PARAMS ((int, int));
166
310cc570
RP
167#ifndef PTRACE_ARG3_TYPE
168#define PTRACE_ARG3_TYPE int /* Correct definition for most systems. */
169#endif
170
171extern int
172call_ptrace PARAMS ((int, int, PTRACE_ARG3_TYPE, int));
173
cc221e76
FF
174/* From procfs.c */
175
cc221e76
FF
176extern int
177proc_iterate_over_mappings PARAMS ((int (*) (int, CORE_ADDR)));
178
cc221e76
FF
179extern void
180proc_signal_handling_change PARAMS ((void));
181
34517ebc 182/* From fork-child.c */
bd5635a1 183
34517ebc
JG
184extern void
185fork_inferior PARAMS ((char *, char *, char **,
186 void (*) (void),
187 void (*) (int)));
cc221e76
FF
188
189/* From inflow.c */
190
191extern void
192new_tty_prefork PARAMS ((char *));
193
194/* From infrun.c */
195
196extern void
197start_remote PARAMS ((void));
198
cc221e76
FF
199extern void
200normal_stop PARAMS ((void));
201
202extern int
203signal_stop_state PARAMS ((int));
204
205extern int
206signal_print_state PARAMS ((int));
207
208extern int
209signal_pass_state PARAMS ((int));
210
211/* From infcmd.c */
212
213extern void
214tty_command PARAMS ((char *, int));
215
216extern void
217attach_command PARAMS ((char *, int));
218
bd5635a1
RP
219/* Last signal that the inferior received (why it stopped). */
220
221extern int stop_signal;
222
223/* Address at which inferior stopped. */
224
225extern CORE_ADDR stop_pc;
226
227/* Stack frame when program stopped. */
228
229extern FRAME_ADDR stop_frame_address;
230
231/* Chain containing status of breakpoint(s) that we have stopped at. */
232
233extern bpstat stop_bpstat;
234
235/* Flag indicating that a command has proceeded the inferior past the
236 current breakpoint. */
237
238extern int breakpoint_proceeded;
239
240/* Nonzero if stopped due to a step command. */
241
242extern int stop_step;
243
244/* Nonzero if stopped due to completion of a stack dummy routine. */
245
246extern int stop_stack_dummy;
247
248/* Nonzero if program stopped due to a random (unexpected) signal in
249 inferior process. */
250
251extern int stopped_by_random_signal;
252
253/* Range to single step within.
254 If this is nonzero, respond to a single-step signal
255 by continuing to step if the pc is in this range. */
256
257extern CORE_ADDR step_range_start; /* Inclusive */
258extern CORE_ADDR step_range_end; /* Exclusive */
259
260/* Stack frame address as of when stepping command was issued.
261 This is how we know when we step into a subroutine call,
262 and how to set the frame for the breakpoint used to step out. */
263
264extern FRAME_ADDR step_frame_address;
265
266/* 1 means step over all subroutine calls.
267 -1 means step over calls to undebuggable functions. */
268
269extern int step_over_calls;
270
271/* If stepping, nonzero means step count is > 1
272 so don't print frame next time inferior stops
273 if it stops due to stepping. */
274
275extern int step_multi;
276
bdbd5f50
JG
277/* Nonzero means expecting a trap and caller will handle it themselves.
278 It is used after attach, due to attaching to a process;
279 when running in the shell before the child program has been exec'd;
280 and when running some kinds of remote stuff (FIXME?). */
281
cc221e76 282extern int stop_soon_quietly;
bdbd5f50 283
bd5635a1
RP
284/* Nonzero if proceed is being used for a "finish" command or a similar
285 situation when stop_registers should be saved. */
286
287extern int proceed_to_finish;
288
289/* Save register contents here when about to pop a stack dummy frame,
290 if-and-only-if proceed_to_finish is set.
291 Thus this contains the return value from the called function (assuming
292 values are returned in a register). */
293
294extern char stop_registers[REGISTER_BYTES];
295
296/* Nonzero if pc has been changed by the debugger
297 since the inferior stopped. */
298
299extern int pc_changed;
300
301/* Nonzero if the child process in inferior_pid was attached rather
302 than forked. */
303
cc221e76 304extern int attach_flag;
bd5635a1
RP
305\f
306/* Possible values for CALL_DUMMY_LOCATION. */
307#define ON_STACK 1
308#define BEFORE_TEXT_END 2
309#define AFTER_TEXT_END 3
310
311#if !defined (CALL_DUMMY_LOCATION)
bd5635a1 312#define CALL_DUMMY_LOCATION ON_STACK
bd5635a1
RP
313#endif /* No CALL_DUMMY_LOCATION. */
314
315/* Are we in a call dummy? The code below which allows DECR_PC_AFTER_BREAK
316 below is for infrun.c, which may give the macro a pc without that
317 subtracted out. */
318#if !defined (PC_IN_CALL_DUMMY)
319#if CALL_DUMMY_LOCATION == BEFORE_TEXT_END
cc221e76 320extern CORE_ADDR text_end;
bd5635a1
RP
321#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
322 ((pc) >= text_end - CALL_DUMMY_LENGTH \
34517ebc 323 && (pc) <= text_end + DECR_PC_AFTER_BREAK)
bd5635a1
RP
324#else /* Not before text_end. */
325#if CALL_DUMMY_LOCATION == AFTER_TEXT_END
cc221e76 326extern CORE_ADDR text_end;
bd5635a1
RP
327#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
328 ((pc) >= text_end \
34517ebc 329 && (pc) <= text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK)
bd5635a1
RP
330#else /* On stack. */
331#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
332 ((sp) INNER_THAN (pc) && (pc) INNER_THAN (frame_address))
333#endif /* On stack. */
334#endif /* Not before text_end. */
335#endif /* No PC_IN_CALL_DUMMY. */
cc221e76
FF
336
337#endif /* !defined (INFERIOR_H) */
This page took 0.126447 seconds and 4 git commands to generate.