* hppa-tdep.c: Remove all uses of use_unwind and `set use_unwind'
[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
bd5635a1
RP
24/* For bpstat. */
25#include "breakpoint.h"
26
27/* For FRAME_ADDR. */
28#include "frame.h"
29
30/*
31 * Structure in which to save the status of the inferior. Save
32 * through "save_inferior_status", restore through
33 * "restore_inferior_status".
34 * This pair of routines should be called around any transfer of
35 * control to the inferior which you don't want showing up in your
36 * control variables.
37 */
38struct inferior_status {
39 int pc_changed;
40 int stop_signal;
41 int stop_pc;
42 FRAME_ADDR stop_frame_address;
43 bpstat stop_bpstat;
44 int stop_step;
45 int stop_stack_dummy;
46 int stopped_by_random_signal;
47 int trap_expected;
48 CORE_ADDR step_range_start;
49 CORE_ADDR step_range_end;
50 FRAME_ADDR step_frame_address;
51 int step_over_calls;
52 CORE_ADDR step_resume_break_address;
53 int stop_after_trap;
54 int stop_soon_quietly;
55 FRAME_ADDR selected_frame_address;
56 int selected_level;
57 char stop_registers[REGISTER_BYTES];
58 int breakpoint_proceeded;
59 int restore_stack_info;
60 int proceed_to_finish;
61};
62
cc221e76
FF
63extern void
64save_inferior_status PARAMS ((struct inferior_status *, int));
65
66extern void
67restore_inferior_status PARAMS ((struct inferior_status *));
bd5635a1
RP
68
69/* File name for default use for standard in/out in the inferior. */
70
71extern char *inferior_io_terminal;
72
73/* Pid of our debugged inferior, or 0 if no inferior now. */
74
75extern int inferior_pid;
76
77/* Character array containing an image of the inferior programs' registers. */
78
79extern char registers[];
80
310cc570
RP
81/* Array of validity bits (one per register). Nonzero at position XXX_REGNUM
82 means that `registers' contains a valid copy of inferior register XXX. */
83
84extern char register_valid[NUM_REGS];
85
cc221e76
FF
86extern void
87clear_proceed_status PARAMS ((void));
88
89extern void
90proceed PARAMS ((CORE_ADDR, int, int));
91
92extern void
93kill_inferior PARAMS ((void));
94
cc221e76
FF
95extern void
96generic_mourn_inferior PARAMS ((void));
97
98extern void
99terminal_ours PARAMS ((void));
100
101extern void
360ea8c5 102run_stack_dummy PARAMS ((char*, CORE_ADDR, char [REGISTER_BYTES]));
cc221e76
FF
103
104extern CORE_ADDR
105read_pc PARAMS ((void));
106
107extern void
108write_pc PARAMS ((CORE_ADDR));
109
23a8e291
JK
110extern CORE_ADDR
111read_sp PARAMS ((void));
112
113extern void
114write_sp PARAMS ((CORE_ADDR));
115
116extern CORE_ADDR
117read_fp PARAMS ((void));
118
119extern void
120write_fp PARAMS ((CORE_ADDR));
121
cc221e76
FF
122extern void
123wait_for_inferior PARAMS ((void));
124
125extern void
126init_wait_for_inferior PARAMS ((void));
127
128extern void
129close_exec_file PARAMS ((void));
130
131extern void
132reopen_exec_file PARAMS ((void));
133
3aa6856a
JG
134/* The `resume' routine should only be called in special circumstances.
135 Normally, use `proceed', which handles a lot of bookkeeping. */
310cc570
RP
136extern void
137resume PARAMS ((int, int));
138
cc221e76
FF
139/* From misc files */
140
141extern void
142store_inferior_registers PARAMS ((int));
143
144extern void
145fetch_inferior_registers PARAMS ((int));
146
147extern void
148solib_create_inferior_hook PARAMS ((void));
149
cc221e76
FF
150extern void
151child_terminal_info PARAMS ((char *, int));
152
153extern void
154term_info PARAMS ((char *, int));
155
156extern void
157terminal_ours_for_output PARAMS ((void));
158
159extern void
160terminal_inferior PARAMS ((void));
161
162extern void
163terminal_init_inferior PARAMS ((void));
164
34517ebc 165/* From infptrace.c */
cc221e76
FF
166
167extern int
168attach PARAMS ((int));
169
170void
171detach PARAMS ((int));
172
173extern void
174child_resume PARAMS ((int, int));
175
310cc570
RP
176#ifndef PTRACE_ARG3_TYPE
177#define PTRACE_ARG3_TYPE int /* Correct definition for most systems. */
178#endif
179
180extern int
181call_ptrace PARAMS ((int, int, PTRACE_ARG3_TYPE, int));
182
cc221e76
FF
183/* From procfs.c */
184
cc221e76
FF
185extern int
186proc_iterate_over_mappings PARAMS ((int (*) (int, CORE_ADDR)));
187
34517ebc 188/* From fork-child.c */
bd5635a1 189
34517ebc
JG
190extern void
191fork_inferior PARAMS ((char *, char *, char **,
192 void (*) (void),
193 void (*) (int)));
cc221e76
FF
194
195/* From inflow.c */
196
197extern void
198new_tty_prefork PARAMS ((char *));
199
23a8e291
JK
200extern int gdb_has_a_terminal PARAMS ((void));
201
cc221e76
FF
202/* From infrun.c */
203
204extern void
205start_remote PARAMS ((void));
206
cc221e76
FF
207extern void
208normal_stop PARAMS ((void));
209
210extern int
211signal_stop_state PARAMS ((int));
212
213extern int
214signal_print_state PARAMS ((int));
215
216extern int
217signal_pass_state PARAMS ((int));
218
219/* From infcmd.c */
220
221extern void
222tty_command PARAMS ((char *, int));
223
224extern void
225attach_command PARAMS ((char *, int));
226
bd5635a1
RP
227/* Last signal that the inferior received (why it stopped). */
228
229extern int stop_signal;
230
231/* Address at which inferior stopped. */
232
233extern CORE_ADDR stop_pc;
234
235/* Stack frame when program stopped. */
236
237extern FRAME_ADDR stop_frame_address;
238
239/* Chain containing status of breakpoint(s) that we have stopped at. */
240
241extern bpstat stop_bpstat;
242
243/* Flag indicating that a command has proceeded the inferior past the
244 current breakpoint. */
245
246extern int breakpoint_proceeded;
247
248/* Nonzero if stopped due to a step command. */
249
250extern int stop_step;
251
252/* Nonzero if stopped due to completion of a stack dummy routine. */
253
254extern int stop_stack_dummy;
255
256/* Nonzero if program stopped due to a random (unexpected) signal in
257 inferior process. */
258
259extern int stopped_by_random_signal;
260
261/* Range to single step within.
262 If this is nonzero, respond to a single-step signal
263 by continuing to step if the pc is in this range. */
264
265extern CORE_ADDR step_range_start; /* Inclusive */
266extern CORE_ADDR step_range_end; /* Exclusive */
267
268/* Stack frame address as of when stepping command was issued.
269 This is how we know when we step into a subroutine call,
270 and how to set the frame for the breakpoint used to step out. */
271
272extern FRAME_ADDR step_frame_address;
273
274/* 1 means step over all subroutine calls.
275 -1 means step over calls to undebuggable functions. */
276
277extern int step_over_calls;
278
279/* If stepping, nonzero means step count is > 1
280 so don't print frame next time inferior stops
281 if it stops due to stepping. */
282
283extern int step_multi;
284
bdbd5f50
JG
285/* Nonzero means expecting a trap and caller will handle it themselves.
286 It is used after attach, due to attaching to a process;
287 when running in the shell before the child program has been exec'd;
288 and when running some kinds of remote stuff (FIXME?). */
289
cc221e76 290extern int stop_soon_quietly;
bdbd5f50 291
bd5635a1
RP
292/* Nonzero if proceed is being used for a "finish" command or a similar
293 situation when stop_registers should be saved. */
294
295extern int proceed_to_finish;
296
297/* Save register contents here when about to pop a stack dummy frame,
298 if-and-only-if proceed_to_finish is set.
299 Thus this contains the return value from the called function (assuming
300 values are returned in a register). */
301
302extern char stop_registers[REGISTER_BYTES];
303
304/* Nonzero if pc has been changed by the debugger
305 since the inferior stopped. */
306
307extern int pc_changed;
308
309/* Nonzero if the child process in inferior_pid was attached rather
310 than forked. */
311
cc221e76 312extern int attach_flag;
bd5635a1 313\f
23a8e291
JK
314/* Sigtramp is a routine that the kernel calls (which then calls the
315 signal handler). On most machines it is a library routine that
316 is linked into the executable.
317
318 This macro, given a program counter value and the name of the
319 function in which that PC resides (which can be null if the
320 name is not known), returns nonzero if the PC and name show
321 that we are in sigtramp.
322
323 On most machines just see if the name is sigtramp (and if we have
324 no name, assume we are not in sigtramp). */
325#if !defined (IN_SIGTRAMP)
326# if defined (SIGTRAMP_START)
327# define IN_SIGTRAMP(pc, name) \
328 ((pc) >= SIGTRAMP_START \
329 && (pc) < SIGTRAMP_END \
330 )
331# else
332# define IN_SIGTRAMP(pc, name) \
333 (name && STREQ ("_sigtramp", name))
334# endif
335#endif
336\f
bd5635a1
RP
337/* Possible values for CALL_DUMMY_LOCATION. */
338#define ON_STACK 1
339#define BEFORE_TEXT_END 2
340#define AFTER_TEXT_END 3
341
342#if !defined (CALL_DUMMY_LOCATION)
bd5635a1 343#define CALL_DUMMY_LOCATION ON_STACK
bd5635a1
RP
344#endif /* No CALL_DUMMY_LOCATION. */
345
346/* Are we in a call dummy? The code below which allows DECR_PC_AFTER_BREAK
347 below is for infrun.c, which may give the macro a pc without that
348 subtracted out. */
349#if !defined (PC_IN_CALL_DUMMY)
350#if CALL_DUMMY_LOCATION == BEFORE_TEXT_END
cc221e76 351extern CORE_ADDR text_end;
bd5635a1
RP
352#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
353 ((pc) >= text_end - CALL_DUMMY_LENGTH \
34517ebc 354 && (pc) <= text_end + DECR_PC_AFTER_BREAK)
bd5635a1
RP
355#else /* Not before text_end. */
356#if CALL_DUMMY_LOCATION == AFTER_TEXT_END
cc221e76 357extern CORE_ADDR text_end;
bd5635a1
RP
358#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
359 ((pc) >= text_end \
34517ebc 360 && (pc) <= text_end + CALL_DUMMY_LENGTH + DECR_PC_AFTER_BREAK)
bd5635a1 361#else /* On stack. */
f49cf589 362
23a8e291
JK
363/* Is the PC in a call dummy? SP and FRAME_ADDRESS are the bottom and
364 top of the stack frame which we are checking, where "bottom" and
365 "top" refer to some section of memory which contains the code for
366 the call dummy. Calls to this macro assume that the contents of
367 SP_REGNUM and FP_REGNUM (or the saved values thereof), respectively,
368 are the things to pass.
369
370 This won't work on the 29k, where SP_REGNUM and FP_REGNUM don't
371 have that meaning, but the 29k doesn't use ON_STACK. This could be
372 fixed by generalizing this scheme, perhaps by passing in a frame
373 and adding a few fields, at least on machines which need them for
374 PC_IN_CALL_DUMMY.
375
376 Something simpler, like checking for the stack segment, doesn't work,
377 since various programs (threads implementations, gcc nested function
378 stubs, etc) may either allocate stack frames in another segment, or
379 allocate other kinds of code on the stack. */
f49cf589 380
bd5635a1 381#define PC_IN_CALL_DUMMY(pc, sp, frame_address) \
f49cf589 382 ((sp) INNER_THAN (pc) && (frame_address != 0) && (pc) INNER_THAN (frame_address))
bd5635a1
RP
383#endif /* On stack. */
384#endif /* Not before text_end. */
385#endif /* No PC_IN_CALL_DUMMY. */
cc221e76
FF
386
387#endif /* !defined (INFERIOR_H) */
This page took 0.121385 seconds and 4 git commands to generate.