]>
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 | |
6441c4a0 MK |
34 | /* Register number for the "orig_eax" pseudo-register. If this |
35 | pseudo-register contains a value >= 0 it is interpreted as the | |
36 | system call number that the kernel is supposed to restart. */ | |
8cf03c4c | 37 | #define I386_LINUX_ORIG_EAX_REGNUM (NUM_GREGS + NUM_FREGS + NUM_SSE_REGS) |
6441c4a0 MK |
38 | |
39 | /* Adjust a few macros to deal with this extra register. */ | |
40 | ||
41 | #undef NUM_REGS | |
42 | #define NUM_REGS (NUM_GREGS + NUM_FREGS + NUM_SSE_REGS + 1) | |
43 | ||
44 | #undef MAX_NUM_REGS | |
45 | #define MAX_NUM_REGS (16 + 16 + 9 + 1) | |
46 | ||
47 | #undef REGISTER_BYTES | |
48 | #define REGISTER_BYTES \ | |
49 | (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + SIZEOF_SSE_REGS + 4) | |
50 | ||
51 | #undef REGISTER_NAME | |
52 | #define REGISTER_NAME(reg) i386_linux_register_name ((reg)) | |
53 | extern char *i386_linux_register_name (int reg); | |
54 | ||
55 | #undef REGISTER_BYTE | |
56 | #define REGISTER_BYTE(reg) i386_linux_register_byte ((reg)) | |
57 | extern int i386_linux_register_byte (int reg); | |
58 | ||
59 | #undef REGISTER_RAW_SIZE | |
60 | #define REGISTER_RAW_SIZE(reg) i386_linux_register_raw_size ((reg)) | |
61 | extern int i386_linux_register_raw_size (int reg); | |
62 | ||
846a440c MK |
63 | /* Linux/ELF uses stabs-in-ELF with the DWARF register numbering |
64 | scheme by default, so we must redefine STAB_REG_TO_REGNUM. This | |
65 | messes up the floating-point registers for a.out, but there is not | |
66 | much we can do about that. */ | |
67 | #undef STAB_REG_TO_REGNUM | |
68 | #define STAB_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg)) | |
69 | ||
1a8629c7 MS |
70 | /* Use target_specific function to define link map offsets. */ |
71 | extern struct link_map_offsets *i386_linux_svr4_fetch_link_map_offsets (void); | |
72 | #define SVR4_FETCH_LINK_MAP_OFFSETS() i386_linux_svr4_fetch_link_map_offsets () | |
73 | ||
c906108c SS |
74 | /* The following works around a problem with /usr/include/sys/procfs.h */ |
75 | #define sys_quotactl 1 | |
76 | ||
a0b3c4fd JM |
77 | /* When the i386 Linux kernel calls a signal handler, the return |
78 | address points to a bit of code on the stack. These definitions | |
79 | are used to identify this bit of code as a signal trampoline in | |
80 | order to support backtracing through calls to signal handlers. */ | |
81 | ||
45a816d9 MK |
82 | #define IN_SIGTRAMP(pc, name) i386_linux_in_sigtramp (pc, name) |
83 | extern int i386_linux_in_sigtramp (CORE_ADDR, char *); | |
a0b3c4fd | 84 | |
a0b3c4fd | 85 | #undef FRAME_CHAIN |
b05f2432 MK |
86 | #define FRAME_CHAIN(frame) i386_linux_frame_chain (frame) |
87 | extern CORE_ADDR i386_linux_frame_chain (struct frame_info *frame); | |
a0b3c4fd JM |
88 | |
89 | #undef FRAME_SAVED_PC | |
50e27f84 MK |
90 | #define FRAME_SAVED_PC(frame) i386_linux_frame_saved_pc (frame) |
91 | extern CORE_ADDR i386_linux_frame_saved_pc (struct frame_info *frame); | |
a0b3c4fd | 92 | |
4cc24188 MK |
93 | #undef SAVED_PC_AFTER_CALL |
94 | #define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame) | |
95 | extern CORE_ADDR i386_linux_saved_pc_after_call (struct frame_info *); | |
96 | ||
6441c4a0 MK |
97 | #define TARGET_WRITE_PC(pc, ptid) i386_linux_write_pc (pc, ptid) |
98 | extern void i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid); | |
99 | ||
d4f3574e SS |
100 | /* When we call a function in a shared library, and the PLT sends us |
101 | into the dynamic linker to find the function's real address, we | |
102 | need to skip over the dynamic linker call. This function decides | |
103 | when to skip, and where to skip to. See the comments for | |
104 | SKIP_SOLIB_RESOLVER at the top of infrun.c. */ | |
105 | #define SKIP_SOLIB_RESOLVER i386_linux_skip_solib_resolver | |
106 | extern CORE_ADDR i386_linux_skip_solib_resolver (CORE_ADDR pc); | |
107 | ||
108 | /* N_FUN symbols in shared libaries have 0 for their values and need | |
109 | to be relocated. */ | |
110 | #define SOFUN_ADDRESS_MAYBE_MISSING | |
f19ebbbc MK |
111 | \f |
112 | ||
113 | /* Support for longjmp. */ | |
114 | ||
115 | /* Details about jmp_buf. It's supposed to be an array of integers. */ | |
116 | ||
117 | #define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */ | |
118 | #define JB_PC 5 /* Array index of saved PC. */ | |
119 | ||
120 | /* Figure out where the longjmp will land. Slurp the args out of the | |
121 | stack. We expect the first arg to be a pointer to the jmp_buf | |
122 | structure from which we extract the pc (JB_PC) that we will land | |
123 | at. The pc is copied into ADDR. This routine returns true on | |
124 | success. */ | |
125 | ||
126 | #define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr) | |
127 | extern int get_longjmp_target (CORE_ADDR *addr); | |
d4f3574e | 128 | |
c5aa993b | 129 | #endif /* #ifndef TM_LINUX_H */ |