1 |
227 |
jeremybenn |
/* Target-dependent code for GNU/Linux i386.
|
2 |
|
|
|
3 |
|
|
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
|
4 |
|
|
Free Software Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
This file is part of GDB.
|
7 |
|
|
|
8 |
|
|
This program is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
11 |
|
|
(at your option) any later version.
|
12 |
|
|
|
13 |
|
|
This program is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
#include "defs.h"
|
22 |
|
|
#include "gdbcore.h"
|
23 |
|
|
#include "frame.h"
|
24 |
|
|
#include "value.h"
|
25 |
|
|
#include "regcache.h"
|
26 |
|
|
#include "inferior.h"
|
27 |
|
|
#include "osabi.h"
|
28 |
|
|
#include "reggroups.h"
|
29 |
|
|
#include "dwarf2-frame.h"
|
30 |
|
|
#include "gdb_string.h"
|
31 |
|
|
|
32 |
|
|
#include "i386-tdep.h"
|
33 |
|
|
#include "i386-linux-tdep.h"
|
34 |
|
|
#include "linux-tdep.h"
|
35 |
|
|
#include "glibc-tdep.h"
|
36 |
|
|
#include "solib-svr4.h"
|
37 |
|
|
#include "symtab.h"
|
38 |
|
|
#include "arch-utils.h"
|
39 |
|
|
#include "regset.h"
|
40 |
|
|
#include "xml-syscall.h"
|
41 |
|
|
|
42 |
|
|
/* The syscall's XML filename for i386. */
|
43 |
|
|
#define XML_SYSCALL_FILENAME_I386 "syscalls/i386-linux.xml"
|
44 |
|
|
|
45 |
|
|
#include "record.h"
|
46 |
|
|
#include "linux-record.h"
|
47 |
|
|
#include <stdint.h>
|
48 |
|
|
|
49 |
|
|
/* Supported register note sections. */
|
50 |
|
|
static struct core_regset_section i386_linux_regset_sections[] =
|
51 |
|
|
{
|
52 |
|
|
{ ".reg", 144, "general-purpose" },
|
53 |
|
|
{ ".reg2", 108, "floating-point" },
|
54 |
|
|
{ ".reg-xfp", 512, "extended floating-point" },
|
55 |
|
|
{ NULL, 0 }
|
56 |
|
|
};
|
57 |
|
|
|
58 |
|
|
/* Return the name of register REG. */
|
59 |
|
|
|
60 |
|
|
static const char *
|
61 |
|
|
i386_linux_register_name (struct gdbarch *gdbarch, int reg)
|
62 |
|
|
{
|
63 |
|
|
/* Deal with the extra "orig_eax" pseudo register. */
|
64 |
|
|
if (reg == I386_LINUX_ORIG_EAX_REGNUM)
|
65 |
|
|
return "orig_eax";
|
66 |
|
|
|
67 |
|
|
return i386_register_name (gdbarch, reg);
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
/* Return non-zero, when the register is in the corresponding register
|
71 |
|
|
group. Put the LINUX_ORIG_EAX register in the system group. */
|
72 |
|
|
static int
|
73 |
|
|
i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
74 |
|
|
struct reggroup *group)
|
75 |
|
|
{
|
76 |
|
|
if (regnum == I386_LINUX_ORIG_EAX_REGNUM)
|
77 |
|
|
return (group == system_reggroup
|
78 |
|
|
|| group == save_reggroup
|
79 |
|
|
|| group == restore_reggroup);
|
80 |
|
|
return i386_register_reggroup_p (gdbarch, regnum, group);
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
/* Recognizing signal handler frames. */
|
85 |
|
|
|
86 |
|
|
/* GNU/Linux has two flavors of signals. Normal signal handlers, and
|
87 |
|
|
"realtime" (RT) signals. The RT signals can provide additional
|
88 |
|
|
information to the signal handler if the SA_SIGINFO flag is set
|
89 |
|
|
when establishing a signal handler using `sigaction'. It is not
|
90 |
|
|
unlikely that future versions of GNU/Linux will support SA_SIGINFO
|
91 |
|
|
for normal signals too. */
|
92 |
|
|
|
93 |
|
|
/* When the i386 Linux kernel calls a signal handler and the
|
94 |
|
|
SA_RESTORER flag isn't set, the return address points to a bit of
|
95 |
|
|
code on the stack. This function returns whether the PC appears to
|
96 |
|
|
be within this bit of code.
|
97 |
|
|
|
98 |
|
|
The instruction sequence for normal signals is
|
99 |
|
|
pop %eax
|
100 |
|
|
mov $0x77, %eax
|
101 |
|
|
int $0x80
|
102 |
|
|
or 0x58 0xb8 0x77 0x00 0x00 0x00 0xcd 0x80.
|
103 |
|
|
|
104 |
|
|
Checking for the code sequence should be somewhat reliable, because
|
105 |
|
|
the effect is to call the system call sigreturn. This is unlikely
|
106 |
|
|
to occur anywhere other than in a signal trampoline.
|
107 |
|
|
|
108 |
|
|
It kind of sucks that we have to read memory from the process in
|
109 |
|
|
order to identify a signal trampoline, but there doesn't seem to be
|
110 |
|
|
any other way. Therefore we only do the memory reads if no
|
111 |
|
|
function name could be identified, which should be the case since
|
112 |
|
|
the code is on the stack.
|
113 |
|
|
|
114 |
|
|
Detection of signal trampolines for handlers that set the
|
115 |
|
|
SA_RESTORER flag is in general not possible. Unfortunately this is
|
116 |
|
|
what the GNU C Library has been doing for quite some time now.
|
117 |
|
|
However, as of version 2.1.2, the GNU C Library uses signal
|
118 |
|
|
trampolines (named __restore and __restore_rt) that are identical
|
119 |
|
|
to the ones used by the kernel. Therefore, these trampolines are
|
120 |
|
|
supported too. */
|
121 |
|
|
|
122 |
|
|
#define LINUX_SIGTRAMP_INSN0 0x58 /* pop %eax */
|
123 |
|
|
#define LINUX_SIGTRAMP_OFFSET0 0
|
124 |
|
|
#define LINUX_SIGTRAMP_INSN1 0xb8 /* mov $NNNN, %eax */
|
125 |
|
|
#define LINUX_SIGTRAMP_OFFSET1 1
|
126 |
|
|
#define LINUX_SIGTRAMP_INSN2 0xcd /* int */
|
127 |
|
|
#define LINUX_SIGTRAMP_OFFSET2 6
|
128 |
|
|
|
129 |
|
|
static const gdb_byte linux_sigtramp_code[] =
|
130 |
|
|
{
|
131 |
|
|
LINUX_SIGTRAMP_INSN0, /* pop %eax */
|
132 |
|
|
LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77, %eax */
|
133 |
|
|
LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */
|
134 |
|
|
};
|
135 |
|
|
|
136 |
|
|
#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
|
137 |
|
|
|
138 |
|
|
/* If THIS_FRAME is a sigtramp routine, return the address of the
|
139 |
|
|
start of the routine. Otherwise, return 0. */
|
140 |
|
|
|
141 |
|
|
static CORE_ADDR
|
142 |
|
|
i386_linux_sigtramp_start (struct frame_info *this_frame)
|
143 |
|
|
{
|
144 |
|
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
145 |
|
|
gdb_byte buf[LINUX_SIGTRAMP_LEN];
|
146 |
|
|
|
147 |
|
|
/* We only recognize a signal trampoline if PC is at the start of
|
148 |
|
|
one of the three instructions. We optimize for finding the PC at
|
149 |
|
|
the start, as will be the case when the trampoline is not the
|
150 |
|
|
first frame on the stack. We assume that in the case where the
|
151 |
|
|
PC is not at the start of the instruction sequence, there will be
|
152 |
|
|
a few trailing readable bytes on the stack. */
|
153 |
|
|
|
154 |
|
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_SIGTRAMP_LEN))
|
155 |
|
|
return 0;
|
156 |
|
|
|
157 |
|
|
if (buf[0] != LINUX_SIGTRAMP_INSN0)
|
158 |
|
|
{
|
159 |
|
|
int adjust;
|
160 |
|
|
|
161 |
|
|
switch (buf[0])
|
162 |
|
|
{
|
163 |
|
|
case LINUX_SIGTRAMP_INSN1:
|
164 |
|
|
adjust = LINUX_SIGTRAMP_OFFSET1;
|
165 |
|
|
break;
|
166 |
|
|
case LINUX_SIGTRAMP_INSN2:
|
167 |
|
|
adjust = LINUX_SIGTRAMP_OFFSET2;
|
168 |
|
|
break;
|
169 |
|
|
default:
|
170 |
|
|
return 0;
|
171 |
|
|
}
|
172 |
|
|
|
173 |
|
|
pc -= adjust;
|
174 |
|
|
|
175 |
|
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_SIGTRAMP_LEN))
|
176 |
|
|
return 0;
|
177 |
|
|
}
|
178 |
|
|
|
179 |
|
|
if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
|
180 |
|
|
return 0;
|
181 |
|
|
|
182 |
|
|
return pc;
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
/* This function does the same for RT signals. Here the instruction
|
186 |
|
|
sequence is
|
187 |
|
|
mov $0xad, %eax
|
188 |
|
|
int $0x80
|
189 |
|
|
or 0xb8 0xad 0x00 0x00 0x00 0xcd 0x80.
|
190 |
|
|
|
191 |
|
|
The effect is to call the system call rt_sigreturn. */
|
192 |
|
|
|
193 |
|
|
#define LINUX_RT_SIGTRAMP_INSN0 0xb8 /* mov $NNNN, %eax */
|
194 |
|
|
#define LINUX_RT_SIGTRAMP_OFFSET0 0
|
195 |
|
|
#define LINUX_RT_SIGTRAMP_INSN1 0xcd /* int */
|
196 |
|
|
#define LINUX_RT_SIGTRAMP_OFFSET1 5
|
197 |
|
|
|
198 |
|
|
static const gdb_byte linux_rt_sigtramp_code[] =
|
199 |
|
|
{
|
200 |
|
|
LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad, %eax */
|
201 |
|
|
LINUX_RT_SIGTRAMP_INSN1, 0x80 /* int $0x80 */
|
202 |
|
|
};
|
203 |
|
|
|
204 |
|
|
#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
|
205 |
|
|
|
206 |
|
|
/* If THIS_FRAME is an RT sigtramp routine, return the address of the
|
207 |
|
|
start of the routine. Otherwise, return 0. */
|
208 |
|
|
|
209 |
|
|
static CORE_ADDR
|
210 |
|
|
i386_linux_rt_sigtramp_start (struct frame_info *this_frame)
|
211 |
|
|
{
|
212 |
|
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
213 |
|
|
gdb_byte buf[LINUX_RT_SIGTRAMP_LEN];
|
214 |
|
|
|
215 |
|
|
/* We only recognize a signal trampoline if PC is at the start of
|
216 |
|
|
one of the two instructions. We optimize for finding the PC at
|
217 |
|
|
the start, as will be the case when the trampoline is not the
|
218 |
|
|
first frame on the stack. We assume that in the case where the
|
219 |
|
|
PC is not at the start of the instruction sequence, there will be
|
220 |
|
|
a few trailing readable bytes on the stack. */
|
221 |
|
|
|
222 |
|
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN))
|
223 |
|
|
return 0;
|
224 |
|
|
|
225 |
|
|
if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
|
226 |
|
|
{
|
227 |
|
|
if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
|
228 |
|
|
return 0;
|
229 |
|
|
|
230 |
|
|
pc -= LINUX_RT_SIGTRAMP_OFFSET1;
|
231 |
|
|
|
232 |
|
|
if (!safe_frame_unwind_memory (this_frame, pc, buf,
|
233 |
|
|
LINUX_RT_SIGTRAMP_LEN))
|
234 |
|
|
return 0;
|
235 |
|
|
}
|
236 |
|
|
|
237 |
|
|
if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
|
238 |
|
|
return 0;
|
239 |
|
|
|
240 |
|
|
return pc;
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
/* Return whether THIS_FRAME corresponds to a GNU/Linux sigtramp
|
244 |
|
|
routine. */
|
245 |
|
|
|
246 |
|
|
static int
|
247 |
|
|
i386_linux_sigtramp_p (struct frame_info *this_frame)
|
248 |
|
|
{
|
249 |
|
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
250 |
|
|
char *name;
|
251 |
|
|
|
252 |
|
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
253 |
|
|
|
254 |
|
|
/* If we have NAME, we can optimize the search. The trampolines are
|
255 |
|
|
named __restore and __restore_rt. However, they aren't dynamically
|
256 |
|
|
exported from the shared C library, so the trampoline may appear to
|
257 |
|
|
be part of the preceding function. This should always be sigaction,
|
258 |
|
|
__sigaction, or __libc_sigaction (all aliases to the same function). */
|
259 |
|
|
if (name == NULL || strstr (name, "sigaction") != NULL)
|
260 |
|
|
return (i386_linux_sigtramp_start (this_frame) != 0
|
261 |
|
|
|| i386_linux_rt_sigtramp_start (this_frame) != 0);
|
262 |
|
|
|
263 |
|
|
return (strcmp ("__restore", name) == 0
|
264 |
|
|
|| strcmp ("__restore_rt", name) == 0);
|
265 |
|
|
}
|
266 |
|
|
|
267 |
|
|
/* Return one if the PC of THIS_FRAME is in a signal trampoline which
|
268 |
|
|
may have DWARF-2 CFI. */
|
269 |
|
|
|
270 |
|
|
static int
|
271 |
|
|
i386_linux_dwarf_signal_frame_p (struct gdbarch *gdbarch,
|
272 |
|
|
struct frame_info *this_frame)
|
273 |
|
|
{
|
274 |
|
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
275 |
|
|
char *name;
|
276 |
|
|
|
277 |
|
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
278 |
|
|
|
279 |
|
|
/* If a vsyscall DSO is in use, the signal trampolines may have these
|
280 |
|
|
names. */
|
281 |
|
|
if (name && (strcmp (name, "__kernel_sigreturn") == 0
|
282 |
|
|
|| strcmp (name, "__kernel_rt_sigreturn") == 0))
|
283 |
|
|
return 1;
|
284 |
|
|
|
285 |
|
|
return 0;
|
286 |
|
|
}
|
287 |
|
|
|
288 |
|
|
/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
|
289 |
|
|
#define I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 20
|
290 |
|
|
|
291 |
|
|
/* Assuming THIS_FRAME is a GNU/Linux sigtramp routine, return the
|
292 |
|
|
address of the associated sigcontext structure. */
|
293 |
|
|
|
294 |
|
|
static CORE_ADDR
|
295 |
|
|
i386_linux_sigcontext_addr (struct frame_info *this_frame)
|
296 |
|
|
{
|
297 |
|
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
298 |
|
|
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
299 |
|
|
CORE_ADDR pc;
|
300 |
|
|
CORE_ADDR sp;
|
301 |
|
|
gdb_byte buf[4];
|
302 |
|
|
|
303 |
|
|
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
|
304 |
|
|
sp = extract_unsigned_integer (buf, 4, byte_order);
|
305 |
|
|
|
306 |
|
|
pc = i386_linux_sigtramp_start (this_frame);
|
307 |
|
|
if (pc)
|
308 |
|
|
{
|
309 |
|
|
/* The sigcontext structure lives on the stack, right after
|
310 |
|
|
the signum argument. We determine the address of the
|
311 |
|
|
sigcontext structure by looking at the frame's stack
|
312 |
|
|
pointer. Keep in mind that the first instruction of the
|
313 |
|
|
sigtramp code is "pop %eax". If the PC is after this
|
314 |
|
|
instruction, adjust the returned value accordingly. */
|
315 |
|
|
if (pc == get_frame_pc (this_frame))
|
316 |
|
|
return sp + 4;
|
317 |
|
|
return sp;
|
318 |
|
|
}
|
319 |
|
|
|
320 |
|
|
pc = i386_linux_rt_sigtramp_start (this_frame);
|
321 |
|
|
if (pc)
|
322 |
|
|
{
|
323 |
|
|
CORE_ADDR ucontext_addr;
|
324 |
|
|
|
325 |
|
|
/* The sigcontext structure is part of the user context. A
|
326 |
|
|
pointer to the user context is passed as the third argument
|
327 |
|
|
to the signal handler. */
|
328 |
|
|
read_memory (sp + 8, buf, 4);
|
329 |
|
|
ucontext_addr = extract_unsigned_integer (buf, 4, byte_order);
|
330 |
|
|
return ucontext_addr + I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
|
331 |
|
|
}
|
332 |
|
|
|
333 |
|
|
error (_("Couldn't recognize signal trampoline."));
|
334 |
|
|
return 0;
|
335 |
|
|
}
|
336 |
|
|
|
337 |
|
|
/* Set the program counter for process PTID to PC. */
|
338 |
|
|
|
339 |
|
|
static void
|
340 |
|
|
i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
|
341 |
|
|
{
|
342 |
|
|
regcache_cooked_write_unsigned (regcache, I386_EIP_REGNUM, pc);
|
343 |
|
|
|
344 |
|
|
/* We must be careful with modifying the program counter. If we
|
345 |
|
|
just interrupted a system call, the kernel might try to restart
|
346 |
|
|
it when we resume the inferior. On restarting the system call,
|
347 |
|
|
the kernel will try backing up the program counter even though it
|
348 |
|
|
no longer points at the system call. This typically results in a
|
349 |
|
|
SIGSEGV or SIGILL. We can prevent this by writing `-1' in the
|
350 |
|
|
"orig_eax" pseudo-register.
|
351 |
|
|
|
352 |
|
|
Note that "orig_eax" is saved when setting up a dummy call frame.
|
353 |
|
|
This means that it is properly restored when that frame is
|
354 |
|
|
popped, and that the interrupted system call will be restarted
|
355 |
|
|
when we resume the inferior on return from a function call from
|
356 |
|
|
within GDB. In all other cases the system call will not be
|
357 |
|
|
restarted. */
|
358 |
|
|
regcache_cooked_write_unsigned (regcache, I386_LINUX_ORIG_EAX_REGNUM, -1);
|
359 |
|
|
}
|
360 |
|
|
|
361 |
|
|
/* Record all registers but IP register for process-record. */
|
362 |
|
|
|
363 |
|
|
static int
|
364 |
|
|
i386_all_but_ip_registers_record (struct regcache *regcache)
|
365 |
|
|
{
|
366 |
|
|
if (record_arch_list_add_reg (regcache, I386_EAX_REGNUM))
|
367 |
|
|
return -1;
|
368 |
|
|
if (record_arch_list_add_reg (regcache, I386_ECX_REGNUM))
|
369 |
|
|
return -1;
|
370 |
|
|
if (record_arch_list_add_reg (regcache, I386_EDX_REGNUM))
|
371 |
|
|
return -1;
|
372 |
|
|
if (record_arch_list_add_reg (regcache, I386_EBX_REGNUM))
|
373 |
|
|
return -1;
|
374 |
|
|
if (record_arch_list_add_reg (regcache, I386_ESP_REGNUM))
|
375 |
|
|
return -1;
|
376 |
|
|
if (record_arch_list_add_reg (regcache, I386_EBP_REGNUM))
|
377 |
|
|
return -1;
|
378 |
|
|
if (record_arch_list_add_reg (regcache, I386_ESI_REGNUM))
|
379 |
|
|
return -1;
|
380 |
|
|
if (record_arch_list_add_reg (regcache, I386_EDI_REGNUM))
|
381 |
|
|
return -1;
|
382 |
|
|
if (record_arch_list_add_reg (regcache, I386_EFLAGS_REGNUM))
|
383 |
|
|
return -1;
|
384 |
|
|
|
385 |
|
|
return 0;
|
386 |
|
|
}
|
387 |
|
|
|
388 |
|
|
/* i386_canonicalize_syscall maps from the native i386 Linux set
|
389 |
|
|
of syscall ids into a canonical set of syscall ids used by
|
390 |
|
|
process record (a mostly trivial mapping, since the canonical
|
391 |
|
|
set was originally taken from the i386 set). */
|
392 |
|
|
|
393 |
|
|
static enum gdb_syscall
|
394 |
|
|
i386_canonicalize_syscall (int syscall)
|
395 |
|
|
{
|
396 |
|
|
enum { i386_syscall_max = 499 };
|
397 |
|
|
|
398 |
|
|
if (syscall <= i386_syscall_max)
|
399 |
|
|
return syscall;
|
400 |
|
|
else
|
401 |
|
|
return -1;
|
402 |
|
|
}
|
403 |
|
|
|
404 |
|
|
/* Parse the arguments of current system call instruction and record
|
405 |
|
|
the values of the registers and memory that will be changed into
|
406 |
|
|
"record_arch_list". This instruction is "int 0x80" (Linux
|
407 |
|
|
Kernel2.4) or "sysenter" (Linux Kernel 2.6).
|
408 |
|
|
|
409 |
|
|
Return -1 if something wrong. */
|
410 |
|
|
|
411 |
|
|
static struct linux_record_tdep i386_linux_record_tdep;
|
412 |
|
|
|
413 |
|
|
static int
|
414 |
|
|
i386_linux_intx80_sysenter_record (struct regcache *regcache)
|
415 |
|
|
{
|
416 |
|
|
int ret;
|
417 |
|
|
LONGEST syscall_native;
|
418 |
|
|
enum gdb_syscall syscall_gdb;
|
419 |
|
|
|
420 |
|
|
regcache_raw_read_signed (regcache, I386_EAX_REGNUM, &syscall_native);
|
421 |
|
|
|
422 |
|
|
syscall_gdb = i386_canonicalize_syscall (syscall_native);
|
423 |
|
|
|
424 |
|
|
if (syscall_gdb < 0)
|
425 |
|
|
{
|
426 |
|
|
printf_unfiltered (_("Process record and replay target doesn't "
|
427 |
|
|
"support syscall number %s\n"),
|
428 |
|
|
plongest (syscall_native));
|
429 |
|
|
return -1;
|
430 |
|
|
}
|
431 |
|
|
|
432 |
|
|
if (syscall_gdb == gdb_sys_sigreturn
|
433 |
|
|
|| syscall_gdb == gdb_sys_rt_sigreturn)
|
434 |
|
|
{
|
435 |
|
|
if (i386_all_but_ip_registers_record (regcache))
|
436 |
|
|
return -1;
|
437 |
|
|
return 0;
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
ret = record_linux_system_call (syscall_gdb, regcache,
|
441 |
|
|
&i386_linux_record_tdep);
|
442 |
|
|
if (ret)
|
443 |
|
|
return ret;
|
444 |
|
|
|
445 |
|
|
/* Record the return value of the system call. */
|
446 |
|
|
if (record_arch_list_add_reg (regcache, I386_EAX_REGNUM))
|
447 |
|
|
return -1;
|
448 |
|
|
|
449 |
|
|
return 0;
|
450 |
|
|
}
|
451 |
|
|
|
452 |
|
|
#define I386_LINUX_xstate 270
|
453 |
|
|
#define I386_LINUX_frame_size 732
|
454 |
|
|
|
455 |
|
|
int
|
456 |
|
|
i386_linux_record_signal (struct gdbarch *gdbarch,
|
457 |
|
|
struct regcache *regcache,
|
458 |
|
|
enum target_signal signal)
|
459 |
|
|
{
|
460 |
|
|
ULONGEST esp;
|
461 |
|
|
|
462 |
|
|
if (i386_all_but_ip_registers_record (regcache))
|
463 |
|
|
return -1;
|
464 |
|
|
|
465 |
|
|
if (record_arch_list_add_reg (regcache, I386_EIP_REGNUM))
|
466 |
|
|
return -1;
|
467 |
|
|
|
468 |
|
|
/* Record the change in the stack. */
|
469 |
|
|
regcache_raw_read_unsigned (regcache, I386_ESP_REGNUM, &esp);
|
470 |
|
|
/* This is for xstate.
|
471 |
|
|
sp -= sizeof (struct _fpstate); */
|
472 |
|
|
esp -= I386_LINUX_xstate;
|
473 |
|
|
/* This is for frame_size.
|
474 |
|
|
sp -= sizeof (struct rt_sigframe); */
|
475 |
|
|
esp -= I386_LINUX_frame_size;
|
476 |
|
|
if (record_arch_list_add_mem (esp,
|
477 |
|
|
I386_LINUX_xstate + I386_LINUX_frame_size))
|
478 |
|
|
return -1;
|
479 |
|
|
|
480 |
|
|
if (record_arch_list_add_end ())
|
481 |
|
|
return -1;
|
482 |
|
|
|
483 |
|
|
return 0;
|
484 |
|
|
}
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
static LONGEST
|
488 |
|
|
i386_linux_get_syscall_number (struct gdbarch *gdbarch,
|
489 |
|
|
ptid_t ptid)
|
490 |
|
|
{
|
491 |
|
|
struct regcache *regcache = get_thread_regcache (ptid);
|
492 |
|
|
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
493 |
|
|
/* The content of a register. */
|
494 |
|
|
gdb_byte buf[4];
|
495 |
|
|
/* The result. */
|
496 |
|
|
LONGEST ret;
|
497 |
|
|
|
498 |
|
|
/* Getting the system call number from the register.
|
499 |
|
|
When dealing with x86 architecture, this information
|
500 |
|
|
is stored at %eax register. */
|
501 |
|
|
regcache_cooked_read (regcache, I386_LINUX_ORIG_EAX_REGNUM, buf);
|
502 |
|
|
|
503 |
|
|
ret = extract_signed_integer (buf, 4, byte_order);
|
504 |
|
|
|
505 |
|
|
return ret;
|
506 |
|
|
}
|
507 |
|
|
|
508 |
|
|
/* The register sets used in GNU/Linux ELF core-dumps are identical to
|
509 |
|
|
the register sets in `struct user' that are used for a.out
|
510 |
|
|
core-dumps. These are also used by ptrace(2). The corresponding
|
511 |
|
|
types are `elf_gregset_t' for the general-purpose registers (with
|
512 |
|
|
`elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
|
513 |
|
|
for the floating-point registers.
|
514 |
|
|
|
515 |
|
|
Those types used to be available under the names `gregset_t' and
|
516 |
|
|
`fpregset_t' too, and GDB used those names in the past. But those
|
517 |
|
|
names are now used for the register sets used in the `mcontext_t'
|
518 |
|
|
type, which have a different size and layout. */
|
519 |
|
|
|
520 |
|
|
/* Mapping between the general-purpose registers in `struct user'
|
521 |
|
|
format and GDB's register cache layout. */
|
522 |
|
|
|
523 |
|
|
/* From <sys/reg.h>. */
|
524 |
|
|
static int i386_linux_gregset_reg_offset[] =
|
525 |
|
|
{
|
526 |
|
|
6 * 4, /* %eax */
|
527 |
|
|
1 * 4, /* %ecx */
|
528 |
|
|
2 * 4, /* %edx */
|
529 |
|
|
|
530 |
|
|
15 * 4, /* %esp */
|
531 |
|
|
5 * 4, /* %ebp */
|
532 |
|
|
3 * 4, /* %esi */
|
533 |
|
|
4 * 4, /* %edi */
|
534 |
|
|
12 * 4, /* %eip */
|
535 |
|
|
14 * 4, /* %eflags */
|
536 |
|
|
13 * 4, /* %cs */
|
537 |
|
|
16 * 4, /* %ss */
|
538 |
|
|
7 * 4, /* %ds */
|
539 |
|
|
8 * 4, /* %es */
|
540 |
|
|
9 * 4, /* %fs */
|
541 |
|
|
10 * 4, /* %gs */
|
542 |
|
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
543 |
|
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
544 |
|
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
545 |
|
|
-1,
|
546 |
|
|
11 * 4 /* "orig_eax" */
|
547 |
|
|
};
|
548 |
|
|
|
549 |
|
|
/* Mapping between the general-purpose registers in `struct
|
550 |
|
|
sigcontext' format and GDB's register cache layout. */
|
551 |
|
|
|
552 |
|
|
/* From <asm/sigcontext.h>. */
|
553 |
|
|
static int i386_linux_sc_reg_offset[] =
|
554 |
|
|
{
|
555 |
|
|
11 * 4, /* %eax */
|
556 |
|
|
10 * 4, /* %ecx */
|
557 |
|
|
9 * 4, /* %edx */
|
558 |
|
|
8 * 4, /* %ebx */
|
559 |
|
|
7 * 4, /* %esp */
|
560 |
|
|
6 * 4, /* %ebp */
|
561 |
|
|
5 * 4, /* %esi */
|
562 |
|
|
4 * 4, /* %edi */
|
563 |
|
|
14 * 4, /* %eip */
|
564 |
|
|
16 * 4, /* %eflags */
|
565 |
|
|
15 * 4, /* %cs */
|
566 |
|
|
18 * 4, /* %ss */
|
567 |
|
|
3 * 4, /* %ds */
|
568 |
|
|
2 * 4, /* %es */
|
569 |
|
|
1 * 4, /* %fs */
|
570 |
|
|
|
571 |
|
|
};
|
572 |
|
|
|
573 |
|
|
static void
|
574 |
|
|
i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
575 |
|
|
{
|
576 |
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
577 |
|
|
|
578 |
|
|
/* GNU/Linux uses ELF. */
|
579 |
|
|
i386_elf_init_abi (info, gdbarch);
|
580 |
|
|
|
581 |
|
|
/* Since we have the extra "orig_eax" register on GNU/Linux, we have
|
582 |
|
|
to adjust a few things. */
|
583 |
|
|
|
584 |
|
|
set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
|
585 |
|
|
set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS);
|
586 |
|
|
set_gdbarch_register_name (gdbarch, i386_linux_register_name);
|
587 |
|
|
set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p);
|
588 |
|
|
|
589 |
|
|
tdep->gregset_reg_offset = i386_linux_gregset_reg_offset;
|
590 |
|
|
tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset);
|
591 |
|
|
tdep->sizeof_gregset = 17 * 4;
|
592 |
|
|
|
593 |
|
|
tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
|
594 |
|
|
|
595 |
|
|
tdep->sigtramp_p = i386_linux_sigtramp_p;
|
596 |
|
|
tdep->sigcontext_addr = i386_linux_sigcontext_addr;
|
597 |
|
|
tdep->sc_reg_offset = i386_linux_sc_reg_offset;
|
598 |
|
|
tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset);
|
599 |
|
|
|
600 |
|
|
set_gdbarch_process_record (gdbarch, i386_process_record);
|
601 |
|
|
set_gdbarch_process_record_signal (gdbarch, i386_linux_record_signal);
|
602 |
|
|
|
603 |
|
|
/* Initialize the i386_linux_record_tdep. */
|
604 |
|
|
/* These values are the size of the type that will be used in a system
|
605 |
|
|
call. They are obtained from Linux Kernel source. */
|
606 |
|
|
i386_linux_record_tdep.size_pointer
|
607 |
|
|
= gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
|
608 |
|
|
i386_linux_record_tdep.size__old_kernel_stat = 32;
|
609 |
|
|
i386_linux_record_tdep.size_tms = 16;
|
610 |
|
|
i386_linux_record_tdep.size_loff_t = 8;
|
611 |
|
|
i386_linux_record_tdep.size_flock = 16;
|
612 |
|
|
i386_linux_record_tdep.size_oldold_utsname = 45;
|
613 |
|
|
i386_linux_record_tdep.size_ustat = 20;
|
614 |
|
|
i386_linux_record_tdep.size_old_sigaction = 140;
|
615 |
|
|
i386_linux_record_tdep.size_old_sigset_t = 128;
|
616 |
|
|
i386_linux_record_tdep.size_rlimit = 8;
|
617 |
|
|
i386_linux_record_tdep.size_rusage = 72;
|
618 |
|
|
i386_linux_record_tdep.size_timeval = 8;
|
619 |
|
|
i386_linux_record_tdep.size_timezone = 8;
|
620 |
|
|
i386_linux_record_tdep.size_old_gid_t = 2;
|
621 |
|
|
i386_linux_record_tdep.size_old_uid_t = 2;
|
622 |
|
|
i386_linux_record_tdep.size_fd_set = 128;
|
623 |
|
|
i386_linux_record_tdep.size_dirent = 268;
|
624 |
|
|
i386_linux_record_tdep.size_dirent64 = 276;
|
625 |
|
|
i386_linux_record_tdep.size_statfs = 64;
|
626 |
|
|
i386_linux_record_tdep.size_statfs64 = 84;
|
627 |
|
|
i386_linux_record_tdep.size_sockaddr = 16;
|
628 |
|
|
i386_linux_record_tdep.size_int
|
629 |
|
|
= gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
|
630 |
|
|
i386_linux_record_tdep.size_long
|
631 |
|
|
= gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
|
632 |
|
|
i386_linux_record_tdep.size_ulong
|
633 |
|
|
= gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
|
634 |
|
|
i386_linux_record_tdep.size_msghdr = 28;
|
635 |
|
|
i386_linux_record_tdep.size_itimerval = 16;
|
636 |
|
|
i386_linux_record_tdep.size_stat = 88;
|
637 |
|
|
i386_linux_record_tdep.size_old_utsname = 325;
|
638 |
|
|
i386_linux_record_tdep.size_sysinfo = 64;
|
639 |
|
|
i386_linux_record_tdep.size_msqid_ds = 88;
|
640 |
|
|
i386_linux_record_tdep.size_shmid_ds = 84;
|
641 |
|
|
i386_linux_record_tdep.size_new_utsname = 390;
|
642 |
|
|
i386_linux_record_tdep.size_timex = 128;
|
643 |
|
|
i386_linux_record_tdep.size_mem_dqinfo = 24;
|
644 |
|
|
i386_linux_record_tdep.size_if_dqblk = 68;
|
645 |
|
|
i386_linux_record_tdep.size_fs_quota_stat = 68;
|
646 |
|
|
i386_linux_record_tdep.size_timespec = 8;
|
647 |
|
|
i386_linux_record_tdep.size_pollfd = 8;
|
648 |
|
|
i386_linux_record_tdep.size_NFS_FHSIZE = 32;
|
649 |
|
|
i386_linux_record_tdep.size_knfsd_fh = 132;
|
650 |
|
|
i386_linux_record_tdep.size_TASK_COMM_LEN = 16;
|
651 |
|
|
i386_linux_record_tdep.size_sigaction = 140;
|
652 |
|
|
i386_linux_record_tdep.size_sigset_t = 8;
|
653 |
|
|
i386_linux_record_tdep.size_siginfo_t = 128;
|
654 |
|
|
i386_linux_record_tdep.size_cap_user_data_t = 12;
|
655 |
|
|
i386_linux_record_tdep.size_stack_t = 12;
|
656 |
|
|
i386_linux_record_tdep.size_off_t = i386_linux_record_tdep.size_long;
|
657 |
|
|
i386_linux_record_tdep.size_stat64 = 96;
|
658 |
|
|
i386_linux_record_tdep.size_gid_t = 2;
|
659 |
|
|
i386_linux_record_tdep.size_uid_t = 2;
|
660 |
|
|
i386_linux_record_tdep.size_PAGE_SIZE = 4096;
|
661 |
|
|
i386_linux_record_tdep.size_flock64 = 24;
|
662 |
|
|
i386_linux_record_tdep.size_user_desc = 16;
|
663 |
|
|
i386_linux_record_tdep.size_io_event = 32;
|
664 |
|
|
i386_linux_record_tdep.size_iocb = 64;
|
665 |
|
|
i386_linux_record_tdep.size_epoll_event = 12;
|
666 |
|
|
i386_linux_record_tdep.size_itimerspec
|
667 |
|
|
= i386_linux_record_tdep.size_timespec * 2;
|
668 |
|
|
i386_linux_record_tdep.size_mq_attr = 32;
|
669 |
|
|
i386_linux_record_tdep.size_siginfo = 128;
|
670 |
|
|
i386_linux_record_tdep.size_termios = 36;
|
671 |
|
|
i386_linux_record_tdep.size_termios2 = 44;
|
672 |
|
|
i386_linux_record_tdep.size_pid_t = 4;
|
673 |
|
|
i386_linux_record_tdep.size_winsize = 8;
|
674 |
|
|
i386_linux_record_tdep.size_serial_struct = 60;
|
675 |
|
|
i386_linux_record_tdep.size_serial_icounter_struct = 80;
|
676 |
|
|
i386_linux_record_tdep.size_hayes_esp_config = 12;
|
677 |
|
|
i386_linux_record_tdep.size_size_t = 4;
|
678 |
|
|
i386_linux_record_tdep.size_iovec = 8;
|
679 |
|
|
|
680 |
|
|
/* These values are the second argument of system call "sys_ioctl".
|
681 |
|
|
They are obtained from Linux Kernel source. */
|
682 |
|
|
i386_linux_record_tdep.ioctl_TCGETS = 0x5401;
|
683 |
|
|
i386_linux_record_tdep.ioctl_TCSETS = 0x5402;
|
684 |
|
|
i386_linux_record_tdep.ioctl_TCSETSW = 0x5403;
|
685 |
|
|
i386_linux_record_tdep.ioctl_TCSETSF = 0x5404;
|
686 |
|
|
i386_linux_record_tdep.ioctl_TCGETA = 0x5405;
|
687 |
|
|
i386_linux_record_tdep.ioctl_TCSETA = 0x5406;
|
688 |
|
|
i386_linux_record_tdep.ioctl_TCSETAW = 0x5407;
|
689 |
|
|
i386_linux_record_tdep.ioctl_TCSETAF = 0x5408;
|
690 |
|
|
i386_linux_record_tdep.ioctl_TCSBRK = 0x5409;
|
691 |
|
|
i386_linux_record_tdep.ioctl_TCXONC = 0x540A;
|
692 |
|
|
i386_linux_record_tdep.ioctl_TCFLSH = 0x540B;
|
693 |
|
|
i386_linux_record_tdep.ioctl_TIOCEXCL = 0x540C;
|
694 |
|
|
i386_linux_record_tdep.ioctl_TIOCNXCL = 0x540D;
|
695 |
|
|
i386_linux_record_tdep.ioctl_TIOCSCTTY = 0x540E;
|
696 |
|
|
i386_linux_record_tdep.ioctl_TIOCGPGRP = 0x540F;
|
697 |
|
|
i386_linux_record_tdep.ioctl_TIOCSPGRP = 0x5410;
|
698 |
|
|
i386_linux_record_tdep.ioctl_TIOCOUTQ = 0x5411;
|
699 |
|
|
i386_linux_record_tdep.ioctl_TIOCSTI = 0x5412;
|
700 |
|
|
i386_linux_record_tdep.ioctl_TIOCGWINSZ = 0x5413;
|
701 |
|
|
i386_linux_record_tdep.ioctl_TIOCSWINSZ = 0x5414;
|
702 |
|
|
i386_linux_record_tdep.ioctl_TIOCMGET = 0x5415;
|
703 |
|
|
i386_linux_record_tdep.ioctl_TIOCMBIS = 0x5416;
|
704 |
|
|
i386_linux_record_tdep.ioctl_TIOCMBIC = 0x5417;
|
705 |
|
|
i386_linux_record_tdep.ioctl_TIOCMSET = 0x5418;
|
706 |
|
|
i386_linux_record_tdep.ioctl_TIOCGSOFTCAR = 0x5419;
|
707 |
|
|
i386_linux_record_tdep.ioctl_TIOCSSOFTCAR = 0x541A;
|
708 |
|
|
i386_linux_record_tdep.ioctl_FIONREAD = 0x541B;
|
709 |
|
|
i386_linux_record_tdep.ioctl_TIOCINQ = i386_linux_record_tdep.ioctl_FIONREAD;
|
710 |
|
|
i386_linux_record_tdep.ioctl_TIOCLINUX = 0x541C;
|
711 |
|
|
i386_linux_record_tdep.ioctl_TIOCCONS = 0x541D;
|
712 |
|
|
i386_linux_record_tdep.ioctl_TIOCGSERIAL = 0x541E;
|
713 |
|
|
i386_linux_record_tdep.ioctl_TIOCSSERIAL = 0x541F;
|
714 |
|
|
i386_linux_record_tdep.ioctl_TIOCPKT = 0x5420;
|
715 |
|
|
i386_linux_record_tdep.ioctl_FIONBIO = 0x5421;
|
716 |
|
|
i386_linux_record_tdep.ioctl_TIOCNOTTY = 0x5422;
|
717 |
|
|
i386_linux_record_tdep.ioctl_TIOCSETD = 0x5423;
|
718 |
|
|
i386_linux_record_tdep.ioctl_TIOCGETD = 0x5424;
|
719 |
|
|
i386_linux_record_tdep.ioctl_TCSBRKP = 0x5425;
|
720 |
|
|
i386_linux_record_tdep.ioctl_TIOCTTYGSTRUCT = 0x5426;
|
721 |
|
|
i386_linux_record_tdep.ioctl_TIOCSBRK = 0x5427;
|
722 |
|
|
i386_linux_record_tdep.ioctl_TIOCCBRK = 0x5428;
|
723 |
|
|
i386_linux_record_tdep.ioctl_TIOCGSID = 0x5429;
|
724 |
|
|
i386_linux_record_tdep.ioctl_TCGETS2 = 0x802c542a;
|
725 |
|
|
i386_linux_record_tdep.ioctl_TCSETS2 = 0x402c542b;
|
726 |
|
|
i386_linux_record_tdep.ioctl_TCSETSW2 = 0x402c542c;
|
727 |
|
|
i386_linux_record_tdep.ioctl_TCSETSF2 = 0x402c542d;
|
728 |
|
|
i386_linux_record_tdep.ioctl_TIOCGPTN = 0x80045430;
|
729 |
|
|
i386_linux_record_tdep.ioctl_TIOCSPTLCK = 0x40045431;
|
730 |
|
|
i386_linux_record_tdep.ioctl_FIONCLEX = 0x5450;
|
731 |
|
|
i386_linux_record_tdep.ioctl_FIOCLEX = 0x5451;
|
732 |
|
|
i386_linux_record_tdep.ioctl_FIOASYNC = 0x5452;
|
733 |
|
|
i386_linux_record_tdep.ioctl_TIOCSERCONFIG = 0x5453;
|
734 |
|
|
i386_linux_record_tdep.ioctl_TIOCSERGWILD = 0x5454;
|
735 |
|
|
i386_linux_record_tdep.ioctl_TIOCSERSWILD = 0x5455;
|
736 |
|
|
i386_linux_record_tdep.ioctl_TIOCGLCKTRMIOS = 0x5456;
|
737 |
|
|
i386_linux_record_tdep.ioctl_TIOCSLCKTRMIOS = 0x5457;
|
738 |
|
|
i386_linux_record_tdep.ioctl_TIOCSERGSTRUCT = 0x5458;
|
739 |
|
|
i386_linux_record_tdep.ioctl_TIOCSERGETLSR = 0x5459;
|
740 |
|
|
i386_linux_record_tdep.ioctl_TIOCSERGETMULTI = 0x545A;
|
741 |
|
|
i386_linux_record_tdep.ioctl_TIOCSERSETMULTI = 0x545B;
|
742 |
|
|
i386_linux_record_tdep.ioctl_TIOCMIWAIT = 0x545C;
|
743 |
|
|
i386_linux_record_tdep.ioctl_TIOCGICOUNT = 0x545D;
|
744 |
|
|
i386_linux_record_tdep.ioctl_TIOCGHAYESESP = 0x545E;
|
745 |
|
|
i386_linux_record_tdep.ioctl_TIOCSHAYESESP = 0x545F;
|
746 |
|
|
i386_linux_record_tdep.ioctl_FIOQSIZE = 0x5460;
|
747 |
|
|
|
748 |
|
|
/* These values are the second argument of system call "sys_fcntl"
|
749 |
|
|
and "sys_fcntl64". They are obtained from Linux Kernel source. */
|
750 |
|
|
i386_linux_record_tdep.fcntl_F_GETLK = 5;
|
751 |
|
|
i386_linux_record_tdep.fcntl_F_GETLK64 = 12;
|
752 |
|
|
i386_linux_record_tdep.fcntl_F_SETLK64 = 13;
|
753 |
|
|
i386_linux_record_tdep.fcntl_F_SETLKW64 = 14;
|
754 |
|
|
|
755 |
|
|
i386_linux_record_tdep.arg1 = I386_EBX_REGNUM;
|
756 |
|
|
i386_linux_record_tdep.arg2 = I386_ECX_REGNUM;
|
757 |
|
|
i386_linux_record_tdep.arg3 = I386_EDX_REGNUM;
|
758 |
|
|
i386_linux_record_tdep.arg4 = I386_ESI_REGNUM;
|
759 |
|
|
i386_linux_record_tdep.arg5 = I386_EDI_REGNUM;
|
760 |
|
|
i386_linux_record_tdep.arg6 = I386_EBP_REGNUM;
|
761 |
|
|
|
762 |
|
|
tdep->i386_intx80_record = i386_linux_intx80_sysenter_record;
|
763 |
|
|
tdep->i386_sysenter_record = i386_linux_intx80_sysenter_record;
|
764 |
|
|
|
765 |
|
|
/* N_FUN symbols in shared libaries have 0 for their values and need
|
766 |
|
|
to be relocated. */
|
767 |
|
|
set_gdbarch_sofun_address_maybe_missing (gdbarch, 1);
|
768 |
|
|
|
769 |
|
|
/* GNU/Linux uses SVR4-style shared libraries. */
|
770 |
|
|
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
771 |
|
|
set_solib_svr4_fetch_link_map_offsets
|
772 |
|
|
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
773 |
|
|
|
774 |
|
|
/* GNU/Linux uses the dynamic linker included in the GNU C Library. */
|
775 |
|
|
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
|
776 |
|
|
|
777 |
|
|
dwarf2_frame_set_signal_frame_p (gdbarch, i386_linux_dwarf_signal_frame_p);
|
778 |
|
|
|
779 |
|
|
/* Enable TLS support. */
|
780 |
|
|
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
781 |
|
|
svr4_fetch_objfile_link_map);
|
782 |
|
|
|
783 |
|
|
/* Install supported register note sections. */
|
784 |
|
|
set_gdbarch_core_regset_sections (gdbarch, i386_linux_regset_sections);
|
785 |
|
|
|
786 |
|
|
/* Displaced stepping. */
|
787 |
|
|
set_gdbarch_displaced_step_copy_insn (gdbarch,
|
788 |
|
|
simple_displaced_step_copy_insn);
|
789 |
|
|
set_gdbarch_displaced_step_fixup (gdbarch, i386_displaced_step_fixup);
|
790 |
|
|
set_gdbarch_displaced_step_free_closure (gdbarch,
|
791 |
|
|
simple_displaced_step_free_closure);
|
792 |
|
|
set_gdbarch_displaced_step_location (gdbarch,
|
793 |
|
|
displaced_step_at_entry_point);
|
794 |
|
|
|
795 |
|
|
/* Functions for 'catch syscall'. */
|
796 |
|
|
set_xml_syscall_file_name (XML_SYSCALL_FILENAME_I386);
|
797 |
|
|
set_gdbarch_get_syscall_number (gdbarch,
|
798 |
|
|
i386_linux_get_syscall_number);
|
799 |
|
|
|
800 |
|
|
set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
|
801 |
|
|
}
|
802 |
|
|
|
803 |
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
804 |
|
|
extern void _initialize_i386_linux_tdep (void);
|
805 |
|
|
|
806 |
|
|
void
|
807 |
|
|
_initialize_i386_linux_tdep (void)
|
808 |
|
|
{
|
809 |
|
|
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
|
810 |
|
|
i386_linux_init_abi);
|
811 |
|
|
}
|