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