]>
Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Definitions to target GDB to GNU/Linux on 386. |
e3c6d36d | 2 | Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001 |
b6ba6518 | 3 | Free Software Foundation, Inc. |
c906108c | 4 | |
c5aa993b | 5 | This file is part of GDB. |
c906108c | 6 | |
c5aa993b JM |
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. | |
c906108c | 11 | |
c5aa993b JM |
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. | |
c906108c | 16 | |
c5aa993b JM |
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. */ | |
c906108c SS |
21 | |
22 | #ifndef TM_LINUX_H | |
23 | #define TM_LINUX_H | |
24 | ||
d4f3574e | 25 | #define I386_GNULINUX_TARGET |
917317f4 | 26 | #define HAVE_I387_REGS |
6ce2ac0b | 27 | #ifdef HAVE_PTRACE_GETFPXREGS |
5c44784c JM |
28 | #define HAVE_SSE_REGS |
29 | #endif | |
c906108c SS |
30 | |
31 | #include "i386/tm-i386.h" | |
c2d11a7d | 32 | #include "tm-linux.h" |
c906108c | 33 | |
1a8629c7 MS |
34 | /* Use target_specific function to define link map offsets. */ |
35 | extern struct link_map_offsets *i386_linux_svr4_fetch_link_map_offsets (void); | |
36 | #define SVR4_FETCH_LINK_MAP_OFFSETS() i386_linux_svr4_fetch_link_map_offsets () | |
37 | ||
c906108c SS |
38 | /* The following works around a problem with /usr/include/sys/procfs.h */ |
39 | #define sys_quotactl 1 | |
40 | ||
a0b3c4fd JM |
41 | /* When the i386 Linux kernel calls a signal handler, the return |
42 | address points to a bit of code on the stack. These definitions | |
43 | are used to identify this bit of code as a signal trampoline in | |
44 | order to support backtracing through calls to signal handlers. */ | |
45 | ||
45a816d9 MK |
46 | #define IN_SIGTRAMP(pc, name) i386_linux_in_sigtramp (pc, name) |
47 | extern int i386_linux_in_sigtramp (CORE_ADDR, char *); | |
a0b3c4fd JM |
48 | |
49 | /* We need our own version of sigtramp_saved_pc to get the saved PC in | |
50 | a sigtramp routine. */ | |
51 | ||
52 | #define sigtramp_saved_pc i386_linux_sigtramp_saved_pc | |
45a816d9 | 53 | extern CORE_ADDR i386_linux_sigtramp_saved_pc (struct frame_info *); |
a0b3c4fd JM |
54 | |
55 | /* Signal trampolines don't have a meaningful frame. As in tm-i386.h, | |
56 | the frame pointer value we use is actually the frame pointer of the | |
57 | calling frame--that is, the frame which was in progress when the | |
58 | signal trampoline was entered. gdb mostly treats this frame | |
59 | pointer value as a magic cookie. We detect the case of a signal | |
60 | trampoline by looking at the SIGNAL_HANDLER_CALLER field, which is | |
61 | set based on IN_SIGTRAMP. | |
62 | ||
63 | When a signal trampoline is invoked from a frameless function, we | |
64 | essentially have two frameless functions in a row. In this case, | |
65 | we use the same magic cookie for three frames in a row. We detect | |
66 | this case by seeing whether the next frame has | |
67 | SIGNAL_HANDLER_CALLER set, and, if it does, checking whether the | |
68 | current frame is actually frameless. In this case, we need to get | |
69 | the PC by looking at the SP register value stored in the signal | |
70 | context. | |
71 | ||
72 | This should work in most cases except in horrible situations where | |
73 | a signal occurs just as we enter a function but before the frame | |
74 | has been set up. */ | |
75 | ||
76 | #define FRAMELESS_SIGNAL(FRAME) \ | |
77 | ((FRAME)->next != NULL \ | |
78 | && (FRAME)->next->signal_handler_caller \ | |
79 | && frameless_look_for_prologue (FRAME)) | |
80 | ||
81 | #undef FRAME_CHAIN | |
82 | #define FRAME_CHAIN(FRAME) \ | |
83 | ((FRAME)->signal_handler_caller \ | |
84 | ? (FRAME)->frame \ | |
85 | : (FRAMELESS_SIGNAL (FRAME) \ | |
86 | ? (FRAME)->frame \ | |
87 | : (!inside_entry_file ((FRAME)->pc) \ | |
88 | ? read_memory_integer ((FRAME)->frame, 4) \ | |
89 | : 0))) | |
90 | ||
91 | #undef FRAME_SAVED_PC | |
92 | #define FRAME_SAVED_PC(FRAME) \ | |
93 | ((FRAME)->signal_handler_caller \ | |
94 | ? sigtramp_saved_pc (FRAME) \ | |
95 | : (FRAMELESS_SIGNAL (FRAME) \ | |
96 | ? read_memory_integer (i386_linux_sigtramp_saved_sp ((FRAME)->next), 4) \ | |
97 | : read_memory_integer ((FRAME)->frame + 4, 4))) | |
98 | ||
45a816d9 | 99 | extern CORE_ADDR i386_linux_sigtramp_saved_sp (struct frame_info *); |
a0b3c4fd | 100 | |
4cc24188 MK |
101 | #undef SAVED_PC_AFTER_CALL |
102 | #define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame) | |
103 | extern CORE_ADDR i386_linux_saved_pc_after_call (struct frame_info *); | |
104 | ||
d4f3574e SS |
105 | /* When we call a function in a shared library, and the PLT sends us |
106 | into the dynamic linker to find the function's real address, we | |
107 | need to skip over the dynamic linker call. This function decides | |
108 | when to skip, and where to skip to. See the comments for | |
109 | SKIP_SOLIB_RESOLVER at the top of infrun.c. */ | |
110 | #define SKIP_SOLIB_RESOLVER i386_linux_skip_solib_resolver | |
111 | extern CORE_ADDR i386_linux_skip_solib_resolver (CORE_ADDR pc); | |
112 | ||
113 | /* N_FUN symbols in shared libaries have 0 for their values and need | |
114 | to be relocated. */ | |
115 | #define SOFUN_ADDRESS_MAYBE_MISSING | |
f19ebbbc MK |
116 | \f |
117 | ||
118 | /* Support for longjmp. */ | |
119 | ||
120 | /* Details about jmp_buf. It's supposed to be an array of integers. */ | |
121 | ||
122 | #define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */ | |
123 | #define JB_PC 5 /* Array index of saved PC. */ | |
124 | ||
125 | /* Figure out where the longjmp will land. Slurp the args out of the | |
126 | stack. We expect the first arg to be a pointer to the jmp_buf | |
127 | structure from which we extract the pc (JB_PC) that we will land | |
128 | at. The pc is copied into ADDR. This routine returns true on | |
129 | success. */ | |
130 | ||
131 | #define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr) | |
132 | extern int get_longjmp_target (CORE_ADDR *addr); | |
d4f3574e | 133 | |
c5aa993b | 134 | #endif /* #ifndef TM_LINUX_H */ |