Accept 16-bit addresses.
[deliverable/binutils-gdb.git] / gdb / inferior.h
... / ...
CommitLineData
1/* Variables that describe the inferior process running under GDB:
2 Where it is, why it stopped, and how to step it.
3 Copyright 1986, 1989, 1992, 1996, 1998 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program 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 2 of the License, or
10 (at your option) any later version.
11
12 This program 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 this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22#if !defined (INFERIOR_H)
23#define INFERIOR_H 1
24
25/* For bpstat. */
26#include "breakpoint.h"
27
28/* For enum target_signal. */
29#include "target.h"
30
31/* Structure in which to save the status of the inferior. Create/Save
32 through "save_inferior_status", restore through
33 "restore_inferior_status".
34
35 This pair of routines should be called around any transfer of
36 control to the inferior which you don't want showing up in your
37 control variables. */
38
39struct inferior_status;
40
41extern struct inferior_status *save_inferior_status PARAMS ((int));
42
43extern void restore_inferior_status PARAMS ((struct inferior_status *));
44
45extern void discard_inferior_status PARAMS ((struct inferior_status *));
46
47extern void write_inferior_status_register PARAMS ((struct inferior_status * inf_status, int regno, LONGEST val));
48
49/* This macro gives the number of registers actually in use by the
50 inferior. This may be less than the total number of registers,
51 perhaps depending on the actual CPU in use or program being run. */
52
53#ifndef ARCH_NUM_REGS
54#define ARCH_NUM_REGS NUM_REGS
55#endif
56
57extern void set_sigint_trap PARAMS ((void));
58
59extern void clear_sigint_trap PARAMS ((void));
60
61extern void set_sigio_trap PARAMS ((void));
62
63extern void clear_sigio_trap PARAMS ((void));
64
65/* File name for default use for standard in/out in the inferior. */
66
67extern char *inferior_io_terminal;
68
69/* Pid of our debugged inferior, or 0 if no inferior now. */
70
71extern int inferior_pid;
72
73/* Is the inferior running right now, as a result of a 'run&',
74 'continue&' etc command? This is used in asycn gdb to determine
75 whether a command that the user enters while the target is running
76 is allowed or not. */
77extern int target_executing;
78
79/* Are we simulating synchronous execution? This is used in async gdb
80 to implement the 'run', 'continue' etc commands, which will not
81 redisplay the prompt until the execution is actually over. */
82extern int sync_execution;
83
84/* This is only valid when inferior_pid is non-zero.
85
86 If this is 0, then exec events should be noticed and responded to
87 by the debugger (i.e., be reported to the user).
88
89 If this is > 0, then that many subsequent exec events should be
90 ignored (i.e., not be reported to the user).
91 */
92extern int inferior_ignoring_startup_exec_events;
93
94/* This is only valid when inferior_ignoring_startup_exec_events is
95 zero.
96
97 Some targets (stupidly) report more than one exec event per actual
98 call to an event() system call. If only the last such exec event
99 need actually be noticed and responded to by the debugger (i.e.,
100 be reported to the user), then this is the number of "leading"
101 exec events which should be ignored.
102 */
103extern int inferior_ignoring_leading_exec_events;
104
105/* Inferior environment. */
106
107extern struct environ *inferior_environ;
108
109/* Character array containing an image of the inferior programs'
110 registers. */
111
112extern char *registers;
113
114/* Character array containing the current state of each register
115 (unavailable<0, valid=0, invalid>0). */
116
117extern signed char *register_valid;
118
119extern void clear_proceed_status PARAMS ((void));
120
121extern void proceed PARAMS ((CORE_ADDR, enum target_signal, int));
122
123extern void kill_inferior PARAMS ((void));
124
125extern void generic_mourn_inferior PARAMS ((void));
126
127extern void terminal_ours PARAMS ((void));
128
129extern int run_stack_dummy PARAMS ((CORE_ADDR, char *));
130
131extern CORE_ADDR read_pc PARAMS ((void));
132
133extern CORE_ADDR read_pc_pid PARAMS ((int));
134
135extern CORE_ADDR generic_target_read_pc PARAMS ((int));
136
137extern void write_pc PARAMS ((CORE_ADDR));
138
139extern void write_pc_pid PARAMS ((CORE_ADDR, int));
140
141extern void generic_target_write_pc PARAMS ((CORE_ADDR, int));
142
143extern CORE_ADDR read_sp PARAMS ((void));
144
145extern CORE_ADDR generic_target_read_sp PARAMS ((void));
146
147extern void write_sp PARAMS ((CORE_ADDR));
148
149extern void generic_target_write_sp PARAMS ((CORE_ADDR));
150
151extern CORE_ADDR read_fp PARAMS ((void));
152
153extern CORE_ADDR generic_target_read_fp PARAMS ((void));
154
155extern void write_fp PARAMS ((CORE_ADDR));
156
157extern void generic_target_write_fp PARAMS ((CORE_ADDR));
158
159extern void wait_for_inferior PARAMS ((void));
160
161extern void fetch_inferior_event PARAMS ((void *));
162
163extern void init_wait_for_inferior PARAMS ((void));
164
165extern void close_exec_file PARAMS ((void));
166
167extern void reopen_exec_file PARAMS ((void));
168
169/* The `resume' routine should only be called in special circumstances.
170 Normally, use `proceed', which handles a lot of bookkeeping. */
171
172extern void resume PARAMS ((int, enum target_signal));
173
174/* From misc files */
175
176extern void store_inferior_registers PARAMS ((int));
177
178extern void fetch_inferior_registers PARAMS ((int));
179
180extern void solib_create_inferior_hook PARAMS ((void));
181
182extern void child_terminal_info PARAMS ((char *, int));
183
184extern void term_info PARAMS ((char *, int));
185
186extern void terminal_ours_for_output PARAMS ((void));
187
188extern void terminal_inferior PARAMS ((void));
189
190extern void terminal_init_inferior PARAMS ((void));
191
192extern void terminal_init_inferior_with_pgrp PARAMS ((int pgrp));
193
194/* From infptrace.c or infttrace.c */
195
196extern int attach PARAMS ((int));
197
198#if !defined(REQUIRE_ATTACH)
199#define REQUIRE_ATTACH attach
200#endif
201
202#if !defined(REQUIRE_DETACH)
203#define REQUIRE_DETACH(pid,siggnal) detach (siggnal)
204#endif
205
206extern void detach PARAMS ((int));
207
208/* PTRACE method of waiting for inferior process. */
209int ptrace_wait PARAMS ((int, int *));
210
211extern void child_resume PARAMS ((int, int, enum target_signal));
212
213#ifndef PTRACE_ARG3_TYPE
214#define PTRACE_ARG3_TYPE int /* Correct definition for most systems. */
215#endif
216
217extern int call_ptrace PARAMS ((int, int, PTRACE_ARG3_TYPE, int));
218
219extern void pre_fork_inferior PARAMS ((void));
220
221/* From procfs.c */
222
223extern int proc_iterate_over_mappings PARAMS ((int (*)(int, CORE_ADDR)));
224
225extern int procfs_first_available PARAMS ((void));
226
227extern int procfs_get_pid_fd PARAMS ((int));
228
229/* From fork-child.c */
230
231extern void fork_inferior PARAMS ((char *, char *, char **,
232 void (*)(void),
233 void (*)(int),
234 void (*)(void),
235 char *));
236
237
238extern void
239clone_and_follow_inferior PARAMS ((int, int *));
240
241extern void startup_inferior PARAMS ((int));
242
243/* From inflow.c */
244
245extern void new_tty_prefork PARAMS ((char *));
246
247extern int gdb_has_a_terminal PARAMS ((void));
248
249/* From infrun.c */
250
251extern void start_remote PARAMS ((void));
252
253extern void normal_stop PARAMS ((void));
254
255extern int signal_stop_state PARAMS ((int));
256
257extern int signal_print_state PARAMS ((int));
258
259extern int signal_pass_state PARAMS ((int));
260
261extern int signal_stop_update PARAMS ((int, int));
262
263extern int signal_print_update PARAMS ((int, int));
264
265extern int signal_pass_update PARAMS ((int, int));
266
267/* From infcmd.c */
268
269extern void tty_command PARAMS ((char *, int));
270
271extern void attach_command PARAMS ((char *, int));
272
273/* Last signal that the inferior received (why it stopped). */
274
275extern enum target_signal stop_signal;
276
277/* Address at which inferior stopped. */
278
279extern CORE_ADDR stop_pc;
280
281/* Chain containing status of breakpoint(s) that we have stopped at. */
282
283extern bpstat stop_bpstat;
284
285/* Flag indicating that a command has proceeded the inferior past the
286 current breakpoint. */
287
288extern int breakpoint_proceeded;
289
290/* Nonzero if stopped due to a step command. */
291
292extern int stop_step;
293
294/* Nonzero if stopped due to completion of a stack dummy routine. */
295
296extern int stop_stack_dummy;
297
298/* Nonzero if program stopped due to a random (unexpected) signal in
299 inferior process. */
300
301extern int stopped_by_random_signal;
302
303/* Range to single step within.
304 If this is nonzero, respond to a single-step signal
305 by continuing to step if the pc is in this range.
306
307 If step_range_start and step_range_end are both 1, it means to step for
308 a single instruction (FIXME: it might clean up wait_for_inferior in a
309 minor way if this were changed to the address of the instruction and
310 that address plus one. But maybe not.). */
311
312extern CORE_ADDR step_range_start; /* Inclusive */
313extern CORE_ADDR step_range_end; /* Exclusive */
314
315/* Stack frame address as of when stepping command was issued.
316 This is how we know when we step into a subroutine call,
317 and how to set the frame for the breakpoint used to step out. */
318
319extern CORE_ADDR step_frame_address;
320
321/* Our notion of the current stack pointer. */
322
323extern CORE_ADDR step_sp;
324
325/* 1 means step over all subroutine calls.
326 -1 means step over calls to undebuggable functions. */
327
328extern int step_over_calls;
329
330/* If stepping, nonzero means step count is > 1
331 so don't print frame next time inferior stops
332 if it stops due to stepping. */
333
334extern int step_multi;
335
336/* Nonzero means expecting a trap and caller will handle it themselves.
337 It is used after attach, due to attaching to a process;
338 when running in the shell before the child program has been exec'd;
339 and when running some kinds of remote stuff (FIXME?). */
340
341extern int stop_soon_quietly;
342
343/* Nonzero if proceed is being used for a "finish" command or a similar
344 situation when stop_registers should be saved. */
345
346extern int proceed_to_finish;
347
348/* Save register contents here when about to pop a stack dummy frame,
349 if-and-only-if proceed_to_finish is set.
350 Thus this contains the return value from the called function (assuming
351 values are returned in a register). */
352
353extern char *stop_registers;
354
355/* Nonzero if the child process in inferior_pid was attached rather
356 than forked. */
357
358extern int attach_flag;
359\f
360/* Sigtramp is a routine that the kernel calls (which then calls the
361 signal handler). On most machines it is a library routine that
362 is linked into the executable.
363
364 This macro, given a program counter value and the name of the
365 function in which that PC resides (which can be null if the
366 name is not known), returns nonzero if the PC and name show
367 that we are in sigtramp.
368
369 On most machines just see if the name is sigtramp (and if we have
370 no name, assume we are not in sigtramp). */
371#if !defined (IN_SIGTRAMP)
372#if defined (SIGTRAMP_START)
373#define IN_SIGTRAMP(pc, name) \
374 ((pc) >= SIGTRAMP_START(pc) \
375 && (pc) < SIGTRAMP_END(pc) \
376 )
377#else
378#define IN_SIGTRAMP(pc, name) \
379 (name && STREQ ("_sigtramp", name))
380#endif
381#endif
382\f
383/* Possible values for CALL_DUMMY_LOCATION. */
384#define ON_STACK 1
385#define BEFORE_TEXT_END 2
386#define AFTER_TEXT_END 3
387#define AT_ENTRY_POINT 4
388
389#if !defined (USE_GENERIC_DUMMY_FRAMES)
390#define USE_GENERIC_DUMMY_FRAMES 0
391#endif
392
393#if !defined (CALL_DUMMY_LOCATION)
394#define CALL_DUMMY_LOCATION ON_STACK
395#endif /* No CALL_DUMMY_LOCATION. */
396
397#if !defined (CALL_DUMMY_ADDRESS)
398#define CALL_DUMMY_ADDRESS() (internal_error ("CALL_DUMMY_ADDRESS"), 0)
399#endif
400#if !defined (CALL_DUMMY_START_OFFSET)
401#define CALL_DUMMY_START_OFFSET (internal_error ("CALL_DUMMY_START_OFFSET"), 0)
402#endif
403#if !defined (CALL_DUMMY_BREAKPOINT_OFFSET)
404#define CALL_DUMMY_BREAKPOINT_OFFSET_P (0)
405#define CALL_DUMMY_BREAKPOINT_OFFSET (internal_error ("CALL_DUMMY_BREAKPOINT_OFFSET"), 0)
406#endif
407#if !defined CALL_DUMMY_BREAKPOINT_OFFSET_P
408#define CALL_DUMMY_BREAKPOINT_OFFSET_P (1)
409#endif
410#if !defined (CALL_DUMMY_LENGTH)
411#define CALL_DUMMY_LENGTH (internal_error ("CALL_DUMMY_LENGTH"), 0)
412#endif
413
414#if defined (CALL_DUMMY_STACK_ADJUST)
415#if !defined (CALL_DUMMY_STACK_ADJUST_P)
416#define CALL_DUMMY_STACK_ADJUST_P (1)
417#endif
418#endif
419#if !defined (CALL_DUMMY_STACK_ADJUST)
420#define CALL_DUMMY_STACK_ADJUST (internal_error ("CALL_DUMMY_STACK_ADJUST"), 0)
421#endif
422#if !defined (CALL_DUMMY_STACK_ADJUST_P)
423#define CALL_DUMMY_STACK_ADJUST_P (0)
424#endif
425
426#if !defined (CALL_DUMMY_P)
427#if defined (CALL_DUMMY)
428#define CALL_DUMMY_P 1
429#else
430#define CALL_DUMMY_P 0
431#endif
432#endif
433
434#if !defined (CALL_DUMMY_WORDS)
435#if defined (CALL_DUMMY)
436extern LONGEST call_dummy_words[];
437#define CALL_DUMMY_WORDS (call_dummy_words)
438#else
439#define CALL_DUMMY_WORDS (internal_error ("CALL_DUMMY_WORDS"), (void*) 0)
440#endif
441#endif
442
443#if !defined (SIZEOF_CALL_DUMMY_WORDS)
444#if defined (CALL_DUMMY)
445extern int sizeof_call_dummy_words;
446#define SIZEOF_CALL_DUMMY_WORDS (sizeof_call_dummy_words)
447#else
448#define SIZEOF_CALL_DUMMY_WORDS (internal_error ("SIZEOF_CALL_DUMMY_WORDS"), 0)
449#endif
450#endif
451
452#if !defined PUSH_DUMMY_FRAME
453#define PUSH_DUMMY_FRAME (internal_error ("PUSH_DUMMY_FRAME"), 0)
454#endif
455
456#if !defined FIX_CALL_DUMMY
457#define FIX_CALL_DUMMY(a1,a2,a3,a4,a5,a6,a7) (internal_error ("FIX_CALL_DUMMY"), 0)
458#endif
459
460#if !defined STORE_STRUCT_RETURN
461#define STORE_STRUCT_RETURN(a1,a2) (internal_error ("STORE_STRUCT_RETURN"), 0)
462#endif
463
464
465/* Are we in a call dummy? */
466
467extern int pc_in_call_dummy_before_text_end PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address));
468#if !GDB_MULTI_ARCH
469#if !defined (PC_IN_CALL_DUMMY) && CALL_DUMMY_LOCATION == BEFORE_TEXT_END
470#define PC_IN_CALL_DUMMY(pc, sp, frame_address) pc_in_call_dummy_before_text_end (pc, sp, frame_address)
471#endif /* Before text_end. */
472#endif
473
474extern int pc_in_call_dummy_after_text_end PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address));
475#if !GDB_MULTI_ARCH
476#if !defined (PC_IN_CALL_DUMMY) && CALL_DUMMY_LOCATION == AFTER_TEXT_END
477#define PC_IN_CALL_DUMMY(pc, sp, frame_address) pc_in_call_dummy_after_text_end (pc, sp, frame_address)
478#endif
479#endif
480
481extern int pc_in_call_dummy_on_stack PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address));
482#if !GDB_MULTI_ARCH
483#if !defined (PC_IN_CALL_DUMMY) && CALL_DUMMY_LOCATION == ON_STACK
484#define PC_IN_CALL_DUMMY(pc, sp, frame_address) pc_in_call_dummy_on_stack (pc, sp, frame_address)
485#endif
486#endif
487
488extern int pc_in_call_dummy_at_entry_point PARAMS ((CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address));
489#if !GDB_MULTI_ARCH
490#if !defined (PC_IN_CALL_DUMMY) && CALL_DUMMY_LOCATION == AT_ENTRY_POINT
491#define PC_IN_CALL_DUMMY(pc, sp, frame_address) pc_in_call_dummy_at_entry_point (pc, sp, frame_address)
492#endif
493#endif
494
495/* It's often not enough for our clients to know whether the PC is merely
496 somewhere within the call dummy. They may need to know whether the
497 call dummy has actually completed. (For example, wait_for_inferior
498 wants to know when it should truly stop because the call dummy has
499 completed. If we're single-stepping because of slow watchpoints,
500 then we may find ourselves stopped at the entry of the call dummy,
501 and want to continue stepping until we reach the end.)
502
503 Note that this macro is intended for targets (like HP-UX) which
504 require more than a single breakpoint in their call dummies, and
505 therefore cannot use the CALL_DUMMY_BREAKPOINT_OFFSET mechanism.
506
507 If a target does define CALL_DUMMY_BREAKPOINT_OFFSET, then this
508 default implementation of CALL_DUMMY_HAS_COMPLETED is sufficient.
509 Else, a target may wish to supply an implementation that works in
510 the presense of multiple breakpoints in its call dummy.
511 */
512#if !defined(CALL_DUMMY_HAS_COMPLETED)
513#define CALL_DUMMY_HAS_COMPLETED(pc, sp, frame_address) \
514 PC_IN_CALL_DUMMY((pc), (sp), (frame_address))
515#endif
516
517/* If STARTUP_WITH_SHELL is set, GDB's "run"
518 will attempts to start up the debugee under a shell.
519 This is in order for argument-expansion to occur. E.g.,
520 (gdb) run *
521 The "*" gets expanded by the shell into a list of files.
522 While this is a nice feature, it turns out to interact badly
523 with some of the catch-fork/catch-exec features we have added.
524 In particular, if the shell does any fork/exec's before
525 the exec of the target program, that can confuse GDB.
526 To disable this feature, set STARTUP_WITH_SHELL to 0.
527 To enable this feature, set STARTUP_WITH_SHELL to 1.
528 The catch-exec traps expected during start-up will
529 be 1 if target is not started up with a shell, 2 if it is.
530 - RT
531 If you disable this, you need to decrement
532 START_INFERIOR_TRAPS_EXPECTED in tm.h. */
533#define STARTUP_WITH_SHELL 1
534#if !defined(START_INFERIOR_TRAPS_EXPECTED)
535#define START_INFERIOR_TRAPS_EXPECTED 2
536#endif
537#endif /* !defined (INFERIOR_H) */
This page took 0.02396 seconds and 4 git commands to generate.