1 /* Definitions to target GDB to GNU/Linux on 386.
2 Copyright 1992, 1993 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
24 #define I386_GNULINUX_TARGET
25 #define HAVE_I387_REGS
26 #ifdef HAVE_PTRACE_GETXFPREGS
30 #include "i386/tm-i386.h"
33 #define LOW_RETURN_REGNUM 0 /* holds low four bytes of result */
34 #define HIGH_RETURN_REGNUM 2 /* holds high four bytes of result */
36 /* This should probably move to tm-i386.h. */
37 #define TARGET_LONG_DOUBLE_BIT 80
39 #if defined(HAVE_LONG_DOUBLE) && defined(HOST_I386)
40 /* The host and target are i386 machines and the compiler supports
41 long doubles. Long doubles on the host therefore have the same
42 layout as a 387 FPU stack register. */
45 extern int i387_extract_floating (PTR addr
, int len
, long double *dretptr
);
46 extern int i387_store_floating (PTR addr
, int len
, long double val
);
48 #define TARGET_EXTRACT_FLOATING i387_extract_floating
49 #define TARGET_STORE_FLOATING i387_store_floating
51 #define TARGET_ANALYZE_FLOATING \
56 low = extract_unsigned_integer (valaddr, 4); \
57 high = extract_unsigned_integer (valaddr + 4, 4); \
58 expon = extract_unsigned_integer (valaddr + 8, 2); \
60 nonnegative = ((expon & 0x8000) == 0); \
61 is_nan = ((expon & 0x7fff) == 0x7fff) \
62 && ((high & 0x80000000) == 0x80000000) \
63 && (((high & 0x7fffffff) | low) != 0); \
67 #undef REGISTER_CONVERT_TO_VIRTUAL
68 #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
70 long double val = *((long double *)FROM); \
71 store_floating ((TO), TYPE_LENGTH (TYPE), val); \
74 #undef REGISTER_CONVERT_TO_RAW
75 #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
77 long double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
78 *((long double *)TO) = val; \
81 /* Return the GDB type object for the "standard" data type
82 of data in register N. */
83 #undef REGISTER_VIRTUAL_TYPE
84 #define REGISTER_VIRTUAL_TYPE(N) \
85 (((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM) \
86 ? lookup_pointer_type (builtin_type_void) \
87 : IS_FP_REGNUM(N) ? builtin_type_long_double \
88 : IS_SSE_REGNUM(N) ? builtin_type_v4sf \
93 /* The following works around a problem with /usr/include/sys/procfs.h */
94 #define sys_quotactl 1
96 /* When the i386 Linux kernel calls a signal handler, the return
97 address points to a bit of code on the stack. These definitions
98 are used to identify this bit of code as a signal trampoline in
99 order to support backtracing through calls to signal handlers. */
101 #define IN_SIGTRAMP(pc, name) i386_linux_in_sigtramp (pc, name)
102 extern int i386_linux_in_sigtramp (CORE_ADDR
, char *);
104 /* We need our own version of sigtramp_saved_pc to get the saved PC in
105 a sigtramp routine. */
107 #define sigtramp_saved_pc i386_linux_sigtramp_saved_pc
108 extern CORE_ADDR
i386_linux_sigtramp_saved_pc (struct frame_info
*);
110 /* Signal trampolines don't have a meaningful frame. As in tm-i386.h,
111 the frame pointer value we use is actually the frame pointer of the
112 calling frame--that is, the frame which was in progress when the
113 signal trampoline was entered. gdb mostly treats this frame
114 pointer value as a magic cookie. We detect the case of a signal
115 trampoline by looking at the SIGNAL_HANDLER_CALLER field, which is
116 set based on IN_SIGTRAMP.
118 When a signal trampoline is invoked from a frameless function, we
119 essentially have two frameless functions in a row. In this case,
120 we use the same magic cookie for three frames in a row. We detect
121 this case by seeing whether the next frame has
122 SIGNAL_HANDLER_CALLER set, and, if it does, checking whether the
123 current frame is actually frameless. In this case, we need to get
124 the PC by looking at the SP register value stored in the signal
127 This should work in most cases except in horrible situations where
128 a signal occurs just as we enter a function but before the frame
131 #define FRAMELESS_SIGNAL(FRAME) \
132 ((FRAME)->next != NULL \
133 && (FRAME)->next->signal_handler_caller \
134 && frameless_look_for_prologue (FRAME))
137 #define FRAME_CHAIN(FRAME) \
138 ((FRAME)->signal_handler_caller \
140 : (FRAMELESS_SIGNAL (FRAME) \
142 : (!inside_entry_file ((FRAME)->pc) \
143 ? read_memory_integer ((FRAME)->frame, 4) \
146 #undef FRAME_SAVED_PC
147 #define FRAME_SAVED_PC(FRAME) \
148 ((FRAME)->signal_handler_caller \
149 ? sigtramp_saved_pc (FRAME) \
150 : (FRAMELESS_SIGNAL (FRAME) \
151 ? read_memory_integer (i386_linux_sigtramp_saved_sp ((FRAME)->next), 4) \
152 : read_memory_integer ((FRAME)->frame + 4, 4)))
154 extern CORE_ADDR
i386_linux_sigtramp_saved_sp (struct frame_info
*);
156 #undef SAVED_PC_AFTER_CALL
157 #define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame)
158 extern CORE_ADDR
i386_linux_saved_pc_after_call (struct frame_info
*);
160 /* When we call a function in a shared library, and the PLT sends us
161 into the dynamic linker to find the function's real address, we
162 need to skip over the dynamic linker call. This function decides
163 when to skip, and where to skip to. See the comments for
164 SKIP_SOLIB_RESOLVER at the top of infrun.c. */
165 #define SKIP_SOLIB_RESOLVER i386_linux_skip_solib_resolver
166 extern CORE_ADDR
i386_linux_skip_solib_resolver (CORE_ADDR pc
);
168 /* N_FUN symbols in shared libaries have 0 for their values and need
170 #define SOFUN_ADDRESS_MAYBE_MISSING
172 #endif /* #ifndef TM_LINUX_H */
This page took 0.036279 seconds and 5 git commands to generate.