1 |
106 |
markom |
/* Definitions to target GDB to GNU/Linux on 386.
|
2 |
|
|
Copyright 1992, 1993 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This file is part of GDB.
|
5 |
|
|
|
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.
|
10 |
|
|
|
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.
|
15 |
|
|
|
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. */
|
20 |
|
|
|
21 |
|
|
#ifndef TM_LINUX_H
|
22 |
|
|
#define TM_LINUX_H
|
23 |
|
|
|
24 |
|
|
#define I386_GNULINUX_TARGET
|
25 |
|
|
#define HAVE_I387_REGS
|
26 |
|
|
#ifdef HAVE_PTRACE_GETXFPREGS
|
27 |
|
|
#define HAVE_SSE_REGS
|
28 |
|
|
#endif
|
29 |
|
|
|
30 |
|
|
#include "i386/tm-i386.h"
|
31 |
|
|
#include "tm-linux.h"
|
32 |
|
|
|
33 |
|
|
/* FIXME: kettenis/2000-03-26: We should get rid of this last piece of
|
34 |
|
|
Linux-specific `long double'-support code, probably by adding code
|
35 |
|
|
to valprint.c:print_floating() to recognize various extended
|
36 |
|
|
floating-point formats. */
|
37 |
|
|
|
38 |
|
|
#if defined(HAVE_LONG_DOUBLE) && defined(HOST_I386)
|
39 |
|
|
/* The host and target are i386 machines and the compiler supports
|
40 |
|
|
long doubles. Long doubles on the host therefore have the same
|
41 |
|
|
layout as a 387 FPU stack register. */
|
42 |
|
|
|
43 |
|
|
#define TARGET_ANALYZE_FLOATING \
|
44 |
|
|
do \
|
45 |
|
|
{ \
|
46 |
|
|
unsigned expon; \
|
47 |
|
|
\
|
48 |
|
|
low = extract_unsigned_integer (valaddr, 4); \
|
49 |
|
|
high = extract_unsigned_integer (valaddr + 4, 4); \
|
50 |
|
|
expon = extract_unsigned_integer (valaddr + 8, 2); \
|
51 |
|
|
\
|
52 |
|
|
nonnegative = ((expon & 0x8000) == 0); \
|
53 |
|
|
is_nan = ((expon & 0x7fff) == 0x7fff) \
|
54 |
|
|
&& ((high & 0x80000000) == 0x80000000) \
|
55 |
|
|
&& (((high & 0x7fffffff) | low) != 0); \
|
56 |
|
|
} \
|
57 |
|
|
while (0)
|
58 |
|
|
|
59 |
|
|
#endif
|
60 |
|
|
|
61 |
|
|
/* The following works around a problem with /usr/include/sys/procfs.h */
|
62 |
|
|
#define sys_quotactl 1
|
63 |
|
|
|
64 |
|
|
/* When the i386 Linux kernel calls a signal handler, the return
|
65 |
|
|
address points to a bit of code on the stack. These definitions
|
66 |
|
|
are used to identify this bit of code as a signal trampoline in
|
67 |
|
|
order to support backtracing through calls to signal handlers. */
|
68 |
|
|
|
69 |
|
|
#define IN_SIGTRAMP(pc, name) i386_linux_in_sigtramp (pc, name)
|
70 |
|
|
extern int i386_linux_in_sigtramp (CORE_ADDR, char *);
|
71 |
|
|
|
72 |
|
|
/* We need our own version of sigtramp_saved_pc to get the saved PC in
|
73 |
|
|
a sigtramp routine. */
|
74 |
|
|
|
75 |
|
|
#define sigtramp_saved_pc i386_linux_sigtramp_saved_pc
|
76 |
|
|
extern CORE_ADDR i386_linux_sigtramp_saved_pc (struct frame_info *);
|
77 |
|
|
|
78 |
|
|
/* Signal trampolines don't have a meaningful frame. As in tm-i386.h,
|
79 |
|
|
the frame pointer value we use is actually the frame pointer of the
|
80 |
|
|
calling frame--that is, the frame which was in progress when the
|
81 |
|
|
signal trampoline was entered. gdb mostly treats this frame
|
82 |
|
|
pointer value as a magic cookie. We detect the case of a signal
|
83 |
|
|
trampoline by looking at the SIGNAL_HANDLER_CALLER field, which is
|
84 |
|
|
set based on IN_SIGTRAMP.
|
85 |
|
|
|
86 |
|
|
When a signal trampoline is invoked from a frameless function, we
|
87 |
|
|
essentially have two frameless functions in a row. In this case,
|
88 |
|
|
we use the same magic cookie for three frames in a row. We detect
|
89 |
|
|
this case by seeing whether the next frame has
|
90 |
|
|
SIGNAL_HANDLER_CALLER set, and, if it does, checking whether the
|
91 |
|
|
current frame is actually frameless. In this case, we need to get
|
92 |
|
|
the PC by looking at the SP register value stored in the signal
|
93 |
|
|
context.
|
94 |
|
|
|
95 |
|
|
This should work in most cases except in horrible situations where
|
96 |
|
|
a signal occurs just as we enter a function but before the frame
|
97 |
|
|
has been set up. */
|
98 |
|
|
|
99 |
|
|
#define FRAMELESS_SIGNAL(FRAME) \
|
100 |
|
|
((FRAME)->next != NULL \
|
101 |
|
|
&& (FRAME)->next->signal_handler_caller \
|
102 |
|
|
&& frameless_look_for_prologue (FRAME))
|
103 |
|
|
|
104 |
|
|
#undef FRAME_CHAIN
|
105 |
|
|
#define FRAME_CHAIN(FRAME) \
|
106 |
|
|
((FRAME)->signal_handler_caller \
|
107 |
|
|
? (FRAME)->frame \
|
108 |
|
|
: (FRAMELESS_SIGNAL (FRAME) \
|
109 |
|
|
? (FRAME)->frame \
|
110 |
|
|
: (!inside_entry_file ((FRAME)->pc) \
|
111 |
|
|
? read_memory_integer ((FRAME)->frame, 4) \
|
112 |
|
|
: 0)))
|
113 |
|
|
|
114 |
|
|
#undef FRAME_SAVED_PC
|
115 |
|
|
#define FRAME_SAVED_PC(FRAME) \
|
116 |
|
|
((FRAME)->signal_handler_caller \
|
117 |
|
|
? sigtramp_saved_pc (FRAME) \
|
118 |
|
|
: (FRAMELESS_SIGNAL (FRAME) \
|
119 |
|
|
? read_memory_integer (i386_linux_sigtramp_saved_sp ((FRAME)->next), 4) \
|
120 |
|
|
: read_memory_integer ((FRAME)->frame + 4, 4)))
|
121 |
|
|
|
122 |
|
|
extern CORE_ADDR i386_linux_sigtramp_saved_sp (struct frame_info *);
|
123 |
|
|
|
124 |
|
|
#undef SAVED_PC_AFTER_CALL
|
125 |
|
|
#define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame)
|
126 |
|
|
extern CORE_ADDR i386_linux_saved_pc_after_call (struct frame_info *);
|
127 |
|
|
|
128 |
|
|
/* When we call a function in a shared library, and the PLT sends us
|
129 |
|
|
into the dynamic linker to find the function's real address, we
|
130 |
|
|
need to skip over the dynamic linker call. This function decides
|
131 |
|
|
when to skip, and where to skip to. See the comments for
|
132 |
|
|
SKIP_SOLIB_RESOLVER at the top of infrun.c. */
|
133 |
|
|
#define SKIP_SOLIB_RESOLVER i386_linux_skip_solib_resolver
|
134 |
|
|
extern CORE_ADDR i386_linux_skip_solib_resolver (CORE_ADDR pc);
|
135 |
|
|
|
136 |
|
|
/* N_FUN symbols in shared libaries have 0 for their values and need
|
137 |
|
|
to be relocated. */
|
138 |
|
|
#define SOFUN_ADDRESS_MAYBE_MISSING
|
139 |
|
|
|
140 |
|
|
#endif /* #ifndef TM_LINUX_H */
|