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