Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Definitions to target GDB to GNU/Linux on 386. |
92362027 AC |
2 | |
3 | Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free | |
4 | Software Foundation, Inc. | |
c906108c | 5 | |
c5aa993b | 6 | This file is part of GDB. |
c906108c | 7 | |
c5aa993b JM |
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 2 of the License, or | |
11 | (at your option) any later version. | |
c906108c | 12 | |
c5aa993b JM |
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. | |
c906108c | 17 | |
c5aa993b JM |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 59 Temple Place - Suite 330, | |
21 | Boston, MA 02111-1307, USA. */ | |
c906108c SS |
22 | |
23 | #ifndef TM_LINUX_H | |
24 | #define TM_LINUX_H | |
25 | ||
d4f3574e | 26 | #define I386_GNULINUX_TARGET |
917317f4 | 27 | #define HAVE_I387_REGS |
6ce2ac0b | 28 | #ifdef HAVE_PTRACE_GETFPXREGS |
32872fa7 | 29 | #define FILL_FPXREGSET |
5c44784c JM |
30 | #define HAVE_SSE_REGS |
31 | #endif | |
c906108c SS |
32 | |
33 | #include "i386/tm-i386.h" | |
c2d11a7d | 34 | #include "tm-linux.h" |
c906108c | 35 | |
6441c4a0 MK |
36 | /* Register number for the "orig_eax" pseudo-register. If this |
37 | pseudo-register contains a value >= 0 it is interpreted as the | |
38 | system call number that the kernel is supposed to restart. */ | |
8cf03c4c | 39 | #define I386_LINUX_ORIG_EAX_REGNUM (NUM_GREGS + NUM_FREGS + NUM_SSE_REGS) |
6441c4a0 MK |
40 | |
41 | /* Adjust a few macros to deal with this extra register. */ | |
42 | ||
43 | #undef NUM_REGS | |
44 | #define NUM_REGS (NUM_GREGS + NUM_FREGS + NUM_SSE_REGS + 1) | |
45 | ||
46 | #undef MAX_NUM_REGS | |
47 | #define MAX_NUM_REGS (16 + 16 + 9 + 1) | |
48 | ||
49 | #undef REGISTER_BYTES | |
50 | #define REGISTER_BYTES \ | |
51 | (SIZEOF_GREGS + SIZEOF_FPU_REGS + SIZEOF_FPU_CTRL_REGS + SIZEOF_SSE_REGS + 4) | |
52 | ||
53 | #undef REGISTER_NAME | |
54 | #define REGISTER_NAME(reg) i386_linux_register_name ((reg)) | |
55 | extern char *i386_linux_register_name (int reg); | |
56 | ||
57 | #undef REGISTER_BYTE | |
58 | #define REGISTER_BYTE(reg) i386_linux_register_byte ((reg)) | |
59 | extern int i386_linux_register_byte (int reg); | |
60 | ||
61 | #undef REGISTER_RAW_SIZE | |
62 | #define REGISTER_RAW_SIZE(reg) i386_linux_register_raw_size ((reg)) | |
63 | extern int i386_linux_register_raw_size (int reg); | |
64 | ||
92362027 | 65 | /* GNU/Linux ELF uses stabs-in-ELF with the DWARF register numbering |
846a440c MK |
66 | scheme by default, so we must redefine STAB_REG_TO_REGNUM. This |
67 | messes up the floating-point registers for a.out, but there is not | |
68 | much we can do about that. */ | |
69 | #undef STAB_REG_TO_REGNUM | |
70 | #define STAB_REG_TO_REGNUM(reg) i386_dwarf_reg_to_regnum ((reg)) | |
71 | ||
1a8629c7 MS |
72 | /* Use target_specific function to define link map offsets. */ |
73 | extern struct link_map_offsets *i386_linux_svr4_fetch_link_map_offsets (void); | |
74 | #define SVR4_FETCH_LINK_MAP_OFFSETS() i386_linux_svr4_fetch_link_map_offsets () | |
75 | ||
c906108c SS |
76 | /* The following works around a problem with /usr/include/sys/procfs.h */ |
77 | #define sys_quotactl 1 | |
78 | ||
a0b3c4fd JM |
79 | /* When the i386 Linux kernel calls a signal handler, the return |
80 | address points to a bit of code on the stack. These definitions | |
81 | are used to identify this bit of code as a signal trampoline in | |
82 | order to support backtracing through calls to signal handlers. */ | |
83 | ||
45a816d9 MK |
84 | #define IN_SIGTRAMP(pc, name) i386_linux_in_sigtramp (pc, name) |
85 | extern int i386_linux_in_sigtramp (CORE_ADDR, char *); | |
a0b3c4fd | 86 | |
a0b3c4fd | 87 | #undef FRAME_CHAIN |
b05f2432 MK |
88 | #define FRAME_CHAIN(frame) i386_linux_frame_chain (frame) |
89 | extern CORE_ADDR i386_linux_frame_chain (struct frame_info *frame); | |
a0b3c4fd JM |
90 | |
91 | #undef FRAME_SAVED_PC | |
50e27f84 MK |
92 | #define FRAME_SAVED_PC(frame) i386_linux_frame_saved_pc (frame) |
93 | extern CORE_ADDR i386_linux_frame_saved_pc (struct frame_info *frame); | |
a0b3c4fd | 94 | |
4cc24188 MK |
95 | #undef SAVED_PC_AFTER_CALL |
96 | #define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame) | |
97 | extern CORE_ADDR i386_linux_saved_pc_after_call (struct frame_info *); | |
98 | ||
6441c4a0 MK |
99 | #define TARGET_WRITE_PC(pc, ptid) i386_linux_write_pc (pc, ptid) |
100 | extern void i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid); | |
101 | ||
d4f3574e SS |
102 | /* When we call a function in a shared library, and the PLT sends us |
103 | into the dynamic linker to find the function's real address, we | |
104 | need to skip over the dynamic linker call. This function decides | |
105 | when to skip, and where to skip to. See the comments for | |
106 | SKIP_SOLIB_RESOLVER at the top of infrun.c. */ | |
107 | #define SKIP_SOLIB_RESOLVER i386_linux_skip_solib_resolver | |
108 | extern CORE_ADDR i386_linux_skip_solib_resolver (CORE_ADDR pc); | |
109 | ||
110 | /* N_FUN symbols in shared libaries have 0 for their values and need | |
111 | to be relocated. */ | |
112 | #define SOFUN_ADDRESS_MAYBE_MISSING | |
f19ebbbc MK |
113 | \f |
114 | ||
115 | /* Support for longjmp. */ | |
116 | ||
117 | /* Details about jmp_buf. It's supposed to be an array of integers. */ | |
118 | ||
119 | #define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */ | |
120 | #define JB_PC 5 /* Array index of saved PC. */ | |
121 | ||
122 | /* Figure out where the longjmp will land. Slurp the args out of the | |
123 | stack. We expect the first arg to be a pointer to the jmp_buf | |
124 | structure from which we extract the pc (JB_PC) that we will land | |
125 | at. The pc is copied into ADDR. This routine returns true on | |
126 | success. */ | |
127 | ||
128 | #define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr) | |
129 | extern int get_longjmp_target (CORE_ADDR *addr); | |
d4f3574e | 130 | |
c5aa993b | 131 | #endif /* #ifndef TM_LINUX_H */ |