]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/config/i386/tm-i386bsd.h
867e624b17b26165cc6ed6c025dd8bb6be08c0c6
[thirdparty/binutils-gdb.git] / gdb / config / i386 / tm-i386bsd.h
1 /* Macro definitions for i386 running under BSD Unix.
2 Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /* Override number of expected traps from sysv. */
21 #define START_INFERIOR_TRAPS_EXPECTED 2
22
23 /* Most definitions from sysv could be used. */
24 #include "i386/tm-i386v.h"
25
26 /* 386BSD cannot handle the segment registers. */
27 /* BSDI can't handle them either. */
28 #undef NUM_REGS
29 #define NUM_REGS 10
30
31 /* On 386 bsd, sigtramp is above the user stack and immediately below
32 the user area. Using constants here allows for cross debugging.
33 These are tested for BSDI but should work on 386BSD. */
34 #define SIGTRAMP_START 0xfdbfdfc0
35 #define SIGTRAMP_END 0xfdbfe000
36
37 /* The following redefines make backtracing through sigtramp work.
38 They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
39 from the sigcontext structure which is pushed by the kernel on the
40 user stack, along with a pointer to it. */
41
42 /* FRAME_CHAIN takes a frame's nominal address and produces the frame's
43 chain-pointer.
44 In the case of the i386, the frame's nominal address
45 is the address of a 4-byte word containing the calling frame's address. */
46 #undef FRAME_CHAIN
47 #define FRAME_CHAIN(thisframe) \
48 (thisframe->signal_handler_caller \
49 ? thisframe->frame \
50 : (!inside_entry_file ((thisframe)->pc) \
51 ? read_memory_integer ((thisframe)->frame, 4) \
52 : 0))
53
54 /* A macro that tells us whether the function invocation represented
55 by FI does not have a frame on the stack associated with it. If it
56 does not, FRAMELESS is set to 1, else 0. */
57 #undef FRAMELESS_FUNCTION_INVOCATION
58 #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
59 do { \
60 if ((FI)->signal_handler_caller) \
61 (FRAMELESS) = 0; \
62 else \
63 (FRAMELESS) = frameless_look_for_prologue(FI); \
64 } while (0)
65
66 /* Saved Pc. Get it from sigcontext if within sigtramp. */
67
68 /* Offset to saved PC in sigcontext, from <sys/signal.h>. */
69 #define SIGCONTEXT_PC_OFFSET 20
70
71 #undef FRAME_SAVED_PC
72 #define FRAME_SAVED_PC(FRAME) \
73 (((FRAME)->signal_handler_caller \
74 ? sigtramp_saved_pc (FRAME) \
75 : read_memory_integer ((FRAME)->frame + 4, 4)) \
76 )