1 |
1181 |
sfurman |
This is gdbint.info, produced by makeinfo version 4.1 from
|
2 |
|
|
./gdbint.texinfo.
|
3 |
|
|
|
4 |
|
|
INFO-DIR-SECTION Programming & development tools.
|
5 |
|
|
START-INFO-DIR-ENTRY
|
6 |
|
|
* Gdb-Internals: (gdbint). The GNU debugger's internals.
|
7 |
|
|
END-INFO-DIR-ENTRY
|
8 |
|
|
|
9 |
|
|
This file documents the internals of the GNU debugger GDB.
|
10 |
|
|
Copyright 1990,1991,1992,1993,1994,1996,1998,1999,2000,2001,2002
|
11 |
|
|
Free Software Foundation, Inc. Contributed by Cygnus Solutions.
|
12 |
|
|
Written by John Gilmore. Second Edition by Stan Shebs.
|
13 |
|
|
|
14 |
|
|
Permission is granted to copy, distribute and/or modify this document
|
15 |
|
|
under the terms of the GNU Free Documentation License, Version 1.1 or
|
16 |
|
|
any later version published by the Free Software Foundation; with no
|
17 |
|
|
Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
|
18 |
|
|
and with the Back-Cover Texts as in (a) below.
|
19 |
|
|
|
20 |
|
|
(a) The FSF's Back-Cover Text is: "You have freedom to copy and
|
21 |
|
|
modify this GNU Manual, like GNU software. Copies published by the Free
|
22 |
|
|
Software Foundation raise funds for GNU development."
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
File: gdbint.info, Node: Target Architecture Definition, Next: Target Vector Definition, Prev: Host Definition, Up: Top
|
26 |
|
|
|
27 |
|
|
Target Architecture Definition
|
28 |
|
|
******************************
|
29 |
|
|
|
30 |
|
|
GDB's target architecture defines what sort of machine-language
|
31 |
|
|
programs GDB can work with, and how it works with them.
|
32 |
|
|
|
33 |
|
|
The target architecture object is implemented as the C structure
|
34 |
|
|
`struct gdbarch *'. The structure, and its methods, are generated
|
35 |
|
|
using the Bourne shell script `gdbarch.sh'.
|
36 |
|
|
|
37 |
|
|
Operating System ABI Variant Handling
|
38 |
|
|
=====================================
|
39 |
|
|
|
40 |
|
|
GDB provides a mechanism for handling variations in OS ABIs. An OS
|
41 |
|
|
ABI variant may have influence over any number of variables in the
|
42 |
|
|
target architecture definition. There are two major components in the
|
43 |
|
|
OS ABI mechanism: sniffers and handlers.
|
44 |
|
|
|
45 |
|
|
A "sniffer" examines a file matching a BFD architecture/flavour pair
|
46 |
|
|
(the architecture may be wildcarded) in an attempt to determine the OS
|
47 |
|
|
ABI of that file. Sniffers with a wildcarded architecture are
|
48 |
|
|
considered to be "generic", while sniffers for a specific architecture
|
49 |
|
|
are considered to be "specific". A match from a specific sniffer
|
50 |
|
|
overrides a match from a generic sniffer. Multiple sniffers for an
|
51 |
|
|
architecture/flavour may exist, in order to differentiate between two
|
52 |
|
|
different operating systems which use the same basic file format. The
|
53 |
|
|
OS ABI framework provides a generic sniffer for ELF-format files which
|
54 |
|
|
examines the `EI_OSABI' field of the ELF header, as well as note
|
55 |
|
|
sections known to be used by several operating systems.
|
56 |
|
|
|
57 |
|
|
A "handler" is used to fine-tune the `gdbarch' structure for the
|
58 |
|
|
selected OS ABI. There may be only one handler for a given OS ABI for
|
59 |
|
|
each BFD architecture.
|
60 |
|
|
|
61 |
|
|
The following OS ABI variants are defined in `osabi.h':
|
62 |
|
|
|
63 |
|
|
`GDB_OSABI_UNKNOWN'
|
64 |
|
|
The ABI of the inferior is unknown. The default `gdbarch'
|
65 |
|
|
settings for the architecture will be used.
|
66 |
|
|
|
67 |
|
|
`GDB_OSABI_SVR4'
|
68 |
|
|
UNIX System V Release 4
|
69 |
|
|
|
70 |
|
|
`GDB_OSABI_HURD'
|
71 |
|
|
GNU using the Hurd kernel
|
72 |
|
|
|
73 |
|
|
`GDB_OSABI_SOLARIS'
|
74 |
|
|
Sun Solaris
|
75 |
|
|
|
76 |
|
|
`GDB_OSABI_OSF1'
|
77 |
|
|
OSF/1, including Digital UNIX and Compaq Tru64 UNIX
|
78 |
|
|
|
79 |
|
|
`GDB_OSABI_LINUX'
|
80 |
|
|
GNU using the Linux kernel
|
81 |
|
|
|
82 |
|
|
`GDB_OSABI_FREEBSD_AOUT'
|
83 |
|
|
FreeBSD using the a.out executable format
|
84 |
|
|
|
85 |
|
|
`GDB_OSABI_FREEBSD_ELF'
|
86 |
|
|
FreeBSD using the ELF executable format
|
87 |
|
|
|
88 |
|
|
`GDB_OSABI_NETBSD_AOUT'
|
89 |
|
|
NetBSD using the a.out executable format
|
90 |
|
|
|
91 |
|
|
`GDB_OSABI_NETBSD_ELF'
|
92 |
|
|
NetBSD using the ELF executable format
|
93 |
|
|
|
94 |
|
|
`GDB_OSABI_WINCE'
|
95 |
|
|
Windows CE
|
96 |
|
|
|
97 |
|
|
`GDB_OSABI_GO32'
|
98 |
|
|
DJGPP
|
99 |
|
|
|
100 |
|
|
`GDB_OSABI_NETWARE'
|
101 |
|
|
Novell NetWare
|
102 |
|
|
|
103 |
|
|
`GDB_OSABI_ARM_EABI_V1'
|
104 |
|
|
ARM Embedded ABI version 1
|
105 |
|
|
|
106 |
|
|
`GDB_OSABI_ARM_EABI_V2'
|
107 |
|
|
ARM Embedded ABI version 2
|
108 |
|
|
|
109 |
|
|
`GDB_OSABI_ARM_APCS'
|
110 |
|
|
Generic ARM Procedure Call Standard
|
111 |
|
|
|
112 |
|
|
Here are the functions that make up the OS ABI framework:
|
113 |
|
|
|
114 |
|
|
- Function: const char *gdbarch_osabi_name (enum gdb_osabi OSABI)
|
115 |
|
|
Return the name of the OS ABI corresponding to OSABI.
|
116 |
|
|
|
117 |
|
|
- Function: void gdbarch_register_osabi (enum bfd_architecture ARCH,
|
118 |
|
|
enum gdb_osabi OSABI, void (*INIT_OSABI)(struct gdbarch_info
|
119 |
|
|
INFO, struct gdbarch *GDBARCH))
|
120 |
|
|
Register the OS ABI handler specified by INIT_OSABI for the
|
121 |
|
|
architecture/OS ABI pair specified by ARCH and OSABI.
|
122 |
|
|
|
123 |
|
|
- Function: void gdbarch_register_osabi_sniffer (enum bfd_architecture
|
124 |
|
|
ARCH, enum bfd_flavour FLAVOUR, enum gdb_osabi (*SNIFFER)(bfd
|
125 |
|
|
*ABFD))
|
126 |
|
|
Register the OS ABI file sniffer specified by SNIFFER for the BFD
|
127 |
|
|
architecture/flavour pair specified by ARCH and FLAVOUR. If ARCH
|
128 |
|
|
is `bfd_arch_unknown', the sniffer is considered to be generic,
|
129 |
|
|
and is allowed to examine FLAVOUR-flavoured files for any
|
130 |
|
|
architecture.
|
131 |
|
|
|
132 |
|
|
- Function: enum gdb_osabi gdbarch_lookup_osabi (bfd *ABFD)
|
133 |
|
|
Examine the file described by ABFD to determine its OS ABI. The
|
134 |
|
|
value `GDB_OSABI_UNKNOWN' is returned if the OS ABI cannot be
|
135 |
|
|
determined.
|
136 |
|
|
|
137 |
|
|
- Function: void gdbarch_init_osabi (struct gdbarch info INFO, struct
|
138 |
|
|
gdbarch *GDBARCH, enum gdb_osabi OSABI)
|
139 |
|
|
Invoke the OS ABI handler corresponding to OSABI to fine-tune the
|
140 |
|
|
`gdbarch' structure specified by GDBARCH. If a handler
|
141 |
|
|
corresponding to OSABI has not been registered for GDBARCH's
|
142 |
|
|
architecture, a warning will be issued and the debugging session
|
143 |
|
|
will continue with the defaults already established for GDBARCH.
|
144 |
|
|
|
145 |
|
|
Registers and Memory
|
146 |
|
|
====================
|
147 |
|
|
|
148 |
|
|
GDB's model of the target machine is rather simple. GDB assumes the
|
149 |
|
|
machine includes a bank of registers and a block of memory. Each
|
150 |
|
|
register may have a different size.
|
151 |
|
|
|
152 |
|
|
GDB does not have a magical way to match up with the compiler's idea
|
153 |
|
|
of which registers are which; however, it is critical that they do
|
154 |
|
|
match up accurately. The only way to make this work is to get accurate
|
155 |
|
|
information about the order that the compiler uses, and to reflect that
|
156 |
|
|
in the `REGISTER_NAME' and related macros.
|
157 |
|
|
|
158 |
|
|
GDB can handle big-endian, little-endian, and bi-endian
|
159 |
|
|
architectures.
|
160 |
|
|
|
161 |
|
|
Pointers Are Not Always Addresses
|
162 |
|
|
=================================
|
163 |
|
|
|
164 |
|
|
On almost all 32-bit architectures, the representation of a pointer
|
165 |
|
|
is indistinguishable from the representation of some fixed-length number
|
166 |
|
|
whose value is the byte address of the object pointed to. On such
|
167 |
|
|
machines, the words "pointer" and "address" can be used interchangeably.
|
168 |
|
|
However, architectures with smaller word sizes are often cramped for
|
169 |
|
|
address space, so they may choose a pointer representation that breaks
|
170 |
|
|
this identity, and allows a larger code address space.
|
171 |
|
|
|
172 |
|
|
For example, the Mitsubishi D10V is a 16-bit VLIW processor whose
|
173 |
|
|
instructions are 32 bits long(1). If the D10V used ordinary byte
|
174 |
|
|
addresses to refer to code locations, then the processor would only be
|
175 |
|
|
able to address 64kb of instructions. However, since instructions must
|
176 |
|
|
be aligned on four-byte boundaries, the low two bits of any valid
|
177 |
|
|
instruction's byte address are always zero--byte addresses waste two
|
178 |
|
|
bits. So instead of byte addresses, the D10V uses word addresses--byte
|
179 |
|
|
addresses shifted right two bits--to refer to code. Thus, the D10V can
|
180 |
|
|
use 16-bit words to address 256kb of code space.
|
181 |
|
|
|
182 |
|
|
However, this means that code pointers and data pointers have
|
183 |
|
|
different forms on the D10V. The 16-bit word `0xC020' refers to byte
|
184 |
|
|
address `0xC020' when used as a data address, but refers to byte address
|
185 |
|
|
`0x30080' when used as a code address.
|
186 |
|
|
|
187 |
|
|
(The D10V also uses separate code and data address spaces, which also
|
188 |
|
|
affects the correspondence between pointers and addresses, but we're
|
189 |
|
|
going to ignore that here; this example is already too long.)
|
190 |
|
|
|
191 |
|
|
To cope with architectures like this--the D10V is not the only
|
192 |
|
|
one!--GDB tries to distinguish between "addresses", which are byte
|
193 |
|
|
numbers, and "pointers", which are the target's representation of an
|
194 |
|
|
address of a particular type of data. In the example above, `0xC020'
|
195 |
|
|
is the pointer, which refers to one of the addresses `0xC020' or
|
196 |
|
|
`0x30080', depending on the type imposed upon it. GDB provides
|
197 |
|
|
functions for turning a pointer into an address and vice versa, in the
|
198 |
|
|
appropriate way for the current architecture.
|
199 |
|
|
|
200 |
|
|
Unfortunately, since addresses and pointers are identical on almost
|
201 |
|
|
all processors, this distinction tends to bit-rot pretty quickly. Thus,
|
202 |
|
|
each time you port GDB to an architecture which does distinguish
|
203 |
|
|
between pointers and addresses, you'll probably need to clean up some
|
204 |
|
|
architecture-independent code.
|
205 |
|
|
|
206 |
|
|
Here are functions which convert between pointers and addresses:
|
207 |
|
|
|
208 |
|
|
- Function: CORE_ADDR extract_typed_address (void *BUF, struct type
|
209 |
|
|
*TYPE)
|
210 |
|
|
Treat the bytes at BUF as a pointer or reference of type TYPE, and
|
211 |
|
|
return the address it represents, in a manner appropriate for the
|
212 |
|
|
current architecture. This yields an address GDB can use to read
|
213 |
|
|
target memory, disassemble, etc. Note that BUF refers to a buffer
|
214 |
|
|
in GDB's memory, not the inferior's.
|
215 |
|
|
|
216 |
|
|
For example, if the current architecture is the Intel x86, this
|
217 |
|
|
function extracts a little-endian integer of the appropriate
|
218 |
|
|
length from BUF and returns it. However, if the current
|
219 |
|
|
architecture is the D10V, this function will return a 16-bit
|
220 |
|
|
integer extracted from BUF, multiplied by four if TYPE is a
|
221 |
|
|
pointer to a function.
|
222 |
|
|
|
223 |
|
|
If TYPE is not a pointer or reference type, then this function
|
224 |
|
|
will signal an internal error.
|
225 |
|
|
|
226 |
|
|
- Function: CORE_ADDR store_typed_address (void *BUF, struct type
|
227 |
|
|
*TYPE, CORE_ADDR ADDR)
|
228 |
|
|
Store the address ADDR in BUF, in the proper format for a pointer
|
229 |
|
|
of type TYPE in the current architecture. Note that BUF refers to
|
230 |
|
|
a buffer in GDB's memory, not the inferior's.
|
231 |
|
|
|
232 |
|
|
For example, if the current architecture is the Intel x86, this
|
233 |
|
|
function stores ADDR unmodified as a little-endian integer of the
|
234 |
|
|
appropriate length in BUF. However, if the current architecture
|
235 |
|
|
is the D10V, this function divides ADDR by four if TYPE is a
|
236 |
|
|
pointer to a function, and then stores it in BUF.
|
237 |
|
|
|
238 |
|
|
If TYPE is not a pointer or reference type, then this function
|
239 |
|
|
will signal an internal error.
|
240 |
|
|
|
241 |
|
|
- Function: CORE_ADDR value_as_address (struct value *VAL)
|
242 |
|
|
Assuming that VAL is a pointer, return the address it represents,
|
243 |
|
|
as appropriate for the current architecture.
|
244 |
|
|
|
245 |
|
|
This function actually works on integral values, as well as
|
246 |
|
|
pointers. For pointers, it performs architecture-specific
|
247 |
|
|
conversions as described above for `extract_typed_address'.
|
248 |
|
|
|
249 |
|
|
- Function: CORE_ADDR value_from_pointer (struct type *TYPE, CORE_ADDR
|
250 |
|
|
ADDR)
|
251 |
|
|
Create and return a value representing a pointer of type TYPE to
|
252 |
|
|
the address ADDR, as appropriate for the current architecture.
|
253 |
|
|
This function performs architecture-specific conversions as
|
254 |
|
|
described above for `store_typed_address'.
|
255 |
|
|
|
256 |
|
|
GDB also provides functions that do the same tasks, but assume that
|
257 |
|
|
pointers are simply byte addresses; they aren't sensitive to the
|
258 |
|
|
current architecture, beyond knowing the appropriate endianness.
|
259 |
|
|
|
260 |
|
|
- Function: CORE_ADDR extract_address (void *ADDR, int len)
|
261 |
|
|
Extract a LEN-byte number from ADDR in the appropriate endianness
|
262 |
|
|
for the current architecture, and return it. Note that ADDR
|
263 |
|
|
refers to GDB's memory, not the inferior's.
|
264 |
|
|
|
265 |
|
|
This function should only be used in architecture-specific code; it
|
266 |
|
|
doesn't have enough information to turn bits into a true address
|
267 |
|
|
in the appropriate way for the current architecture. If you can,
|
268 |
|
|
use `extract_typed_address' instead.
|
269 |
|
|
|
270 |
|
|
- Function: void store_address (void *ADDR, int LEN, LONGEST VAL)
|
271 |
|
|
Store VAL at ADDR as a LEN-byte integer, in the appropriate
|
272 |
|
|
endianness for the current architecture. Note that ADDR refers to
|
273 |
|
|
a buffer in GDB's memory, not the inferior's.
|
274 |
|
|
|
275 |
|
|
This function should only be used in architecture-specific code; it
|
276 |
|
|
doesn't have enough information to turn a true address into bits
|
277 |
|
|
in the appropriate way for the current architecture. If you can,
|
278 |
|
|
use `store_typed_address' instead.
|
279 |
|
|
|
280 |
|
|
Here are some macros which architectures can define to indicate the
|
281 |
|
|
relationship between pointers and addresses. These have default
|
282 |
|
|
definitions, appropriate for architectures on which all pointers are
|
283 |
|
|
simple unsigned byte addresses.
|
284 |
|
|
|
285 |
|
|
- Target Macro: CORE_ADDR POINTER_TO_ADDRESS (struct type *TYPE, char
|
286 |
|
|
*BUF)
|
287 |
|
|
Assume that BUF holds a pointer of type TYPE, in the appropriate
|
288 |
|
|
format for the current architecture. Return the byte address the
|
289 |
|
|
pointer refers to.
|
290 |
|
|
|
291 |
|
|
This function may safely assume that TYPE is either a pointer or a
|
292 |
|
|
C++ reference type.
|
293 |
|
|
|
294 |
|
|
- Target Macro: void ADDRESS_TO_POINTER (struct type *TYPE, char *BUF,
|
295 |
|
|
CORE_ADDR ADDR)
|
296 |
|
|
Store in BUF a pointer of type TYPE representing the address ADDR,
|
297 |
|
|
in the appropriate format for the current architecture.
|
298 |
|
|
|
299 |
|
|
This function may safely assume that TYPE is either a pointer or a
|
300 |
|
|
C++ reference type.
|
301 |
|
|
|
302 |
|
|
Raw and Virtual Register Representations
|
303 |
|
|
========================================
|
304 |
|
|
|
305 |
|
|
_Maintainer note: This section is pretty much obsolete. The
|
306 |
|
|
functionality described here has largely been replaced by
|
307 |
|
|
pseudo-registers and the mechanisms described in *Note Using Different
|
308 |
|
|
Register and Memory Data Representations: Target Architecture
|
309 |
|
|
Definition. See also Bug Tracking Database
|
310 |
|
|
(http://www.gnu.org/software/gdb/bugs/) and ARI Index
|
311 |
|
|
(http://sources.redhat.com/gdb/current/ari/) for more up-to-date
|
312 |
|
|
information._
|
313 |
|
|
|
314 |
|
|
Some architectures use one representation for a value when it lives
|
315 |
|
|
in a register, but use a different representation when it lives in
|
316 |
|
|
memory. In GDB's terminology, the "raw" representation is the one used
|
317 |
|
|
in the target registers, and the "virtual" representation is the one
|
318 |
|
|
used in memory, and within GDB `struct value' objects.
|
319 |
|
|
|
320 |
|
|
_Maintainer note: Notice that the same mechanism is being used to
|
321 |
|
|
both convert a register to a `struct value' and alternative register
|
322 |
|
|
forms._
|
323 |
|
|
|
324 |
|
|
For almost all data types on almost all architectures, the virtual
|
325 |
|
|
and raw representations are identical, and no special handling is
|
326 |
|
|
needed. However, they do occasionally differ. For example:
|
327 |
|
|
|
328 |
|
|
* The x86 architecture supports an 80-bit `long double' type.
|
329 |
|
|
However, when we store those values in memory, they occupy twelve
|
330 |
|
|
bytes: the floating-point number occupies the first ten, and the
|
331 |
|
|
final two bytes are unused. This keeps the values aligned on
|
332 |
|
|
four-byte boundaries, allowing more efficient access. Thus, the
|
333 |
|
|
x86 80-bit floating-point type is the raw representation, and the
|
334 |
|
|
twelve-byte loosely-packed arrangement is the virtual
|
335 |
|
|
representation.
|
336 |
|
|
|
337 |
|
|
* Some 64-bit MIPS targets present 32-bit registers to GDB as 64-bit
|
338 |
|
|
registers, with garbage in their upper bits. GDB ignores the top
|
339 |
|
|
32 bits. Thus, the 64-bit form, with garbage in the upper 32
|
340 |
|
|
bits, is the raw representation, and the trimmed 32-bit
|
341 |
|
|
representation is the virtual representation.
|
342 |
|
|
|
343 |
|
|
In general, the raw representation is determined by the
|
344 |
|
|
architecture, or GDB's interface to the architecture, while the virtual
|
345 |
|
|
representation can be chosen for GDB's convenience. GDB's register
|
346 |
|
|
file, `registers', holds the register contents in raw format, and the
|
347 |
|
|
GDB remote protocol transmits register values in raw format.
|
348 |
|
|
|
349 |
|
|
Your architecture may define the following macros to request
|
350 |
|
|
conversions between the raw and virtual format:
|
351 |
|
|
|
352 |
|
|
- Target Macro: int REGISTER_CONVERTIBLE (int REG)
|
353 |
|
|
Return non-zero if register number REG's value needs different raw
|
354 |
|
|
and virtual formats.
|
355 |
|
|
|
356 |
|
|
You should not use `REGISTER_CONVERT_TO_VIRTUAL' for a register
|
357 |
|
|
unless this macro returns a non-zero value for that register.
|
358 |
|
|
|
359 |
|
|
- Target Macro: int REGISTER_RAW_SIZE (int REG)
|
360 |
|
|
The size of register number REG's raw value. This is the number
|
361 |
|
|
of bytes the register will occupy in `registers', or in a GDB
|
362 |
|
|
remote protocol packet.
|
363 |
|
|
|
364 |
|
|
- Target Macro: int REGISTER_VIRTUAL_SIZE (int REG)
|
365 |
|
|
The size of register number REG's value, in its virtual format.
|
366 |
|
|
This is the size a `struct value''s buffer will have, holding that
|
367 |
|
|
register's value.
|
368 |
|
|
|
369 |
|
|
- Target Macro: struct type *REGISTER_VIRTUAL_TYPE (int REG)
|
370 |
|
|
This is the type of the virtual representation of register number
|
371 |
|
|
REG. Note that there is no need for a macro giving a type for the
|
372 |
|
|
register's raw form; once the register's value has been obtained,
|
373 |
|
|
GDB always uses the virtual form.
|
374 |
|
|
|
375 |
|
|
- Target Macro: void REGISTER_CONVERT_TO_VIRTUAL (int REG, struct type
|
376 |
|
|
*TYPE, char *FROM, char *TO)
|
377 |
|
|
Convert the value of register number REG to TYPE, which should
|
378 |
|
|
always be `REGISTER_VIRTUAL_TYPE (REG)'. The buffer at FROM holds
|
379 |
|
|
the register's value in raw format; the macro should convert the
|
380 |
|
|
value to virtual format, and place it at TO.
|
381 |
|
|
|
382 |
|
|
Note that `REGISTER_CONVERT_TO_VIRTUAL' and
|
383 |
|
|
`REGISTER_CONVERT_TO_RAW' take their REG and TYPE arguments in
|
384 |
|
|
different orders.
|
385 |
|
|
|
386 |
|
|
You should only use `REGISTER_CONVERT_TO_VIRTUAL' with registers
|
387 |
|
|
for which the `REGISTER_CONVERTIBLE' macro returns a non-zero
|
388 |
|
|
value.
|
389 |
|
|
|
390 |
|
|
- Target Macro: void REGISTER_CONVERT_TO_RAW (struct type *TYPE, int
|
391 |
|
|
REG, char *FROM, char *TO)
|
392 |
|
|
Convert the value of register number REG to TYPE, which should
|
393 |
|
|
always be `REGISTER_VIRTUAL_TYPE (REG)'. The buffer at FROM holds
|
394 |
|
|
the register's value in raw format; the macro should convert the
|
395 |
|
|
value to virtual format, and place it at TO.
|
396 |
|
|
|
397 |
|
|
Note that REGISTER_CONVERT_TO_VIRTUAL and REGISTER_CONVERT_TO_RAW
|
398 |
|
|
take their REG and TYPE arguments in different orders.
|
399 |
|
|
|
400 |
|
|
Using Different Register and Memory Data Representations
|
401 |
|
|
========================================================
|
402 |
|
|
|
403 |
|
|
_Maintainer's note: The way GDB manipulates registers is undergoing
|
404 |
|
|
significant change. Many of the macros and functions refered to in this
|
405 |
|
|
section are likely to be subject to further revision. See A.R. Index
|
406 |
|
|
(http://sources.redhat.com/gdb/current/ari/) and Bug Tracking Database
|
407 |
|
|
(http://www.gnu.org/software/gdb/bugs) for further information.
|
408 |
|
|
cagney/2002-05-06._
|
409 |
|
|
|
410 |
|
|
Some architectures can represent a data object in a register using a
|
411 |
|
|
form that is different to the objects more normal memory representation.
|
412 |
|
|
For example:
|
413 |
|
|
|
414 |
|
|
* The Alpha architecture can represent 32 bit integer values in
|
415 |
|
|
floating-point registers.
|
416 |
|
|
|
417 |
|
|
* The x86 architecture supports 80-bit floating-point registers. The
|
418 |
|
|
`long double' data type occupies 96 bits in memory but only 80 bits
|
419 |
|
|
when stored in a register.
|
420 |
|
|
|
421 |
|
|
|
422 |
|
|
In general, the register representation of a data type is determined
|
423 |
|
|
by the architecture, or GDB's interface to the architecture, while the
|
424 |
|
|
memory representation is determined by the Application Binary Interface.
|
425 |
|
|
|
426 |
|
|
For almost all data types on almost all architectures, the two
|
427 |
|
|
representations are identical, and no special handling is needed.
|
428 |
|
|
However, they do occasionally differ. Your architecture may define the
|
429 |
|
|
following macros to request conversions between the register and memory
|
430 |
|
|
representations of a data type:
|
431 |
|
|
|
432 |
|
|
- Target Macro: int CONVERT_REGISTER_P (int REG)
|
433 |
|
|
Return non-zero if the representation of a data value stored in
|
434 |
|
|
this register may be different to the representation of that same
|
435 |
|
|
data value when stored in memory.
|
436 |
|
|
|
437 |
|
|
When non-zero, the macros `REGISTER_TO_VALUE' and
|
438 |
|
|
`VALUE_TO_REGISTER' are used to perform any necessary conversion.
|
439 |
|
|
|
440 |
|
|
- Target Macro: void REGISTER_TO_VALUE (int REG, struct type *TYPE,
|
441 |
|
|
char *FROM, char *TO)
|
442 |
|
|
Convert the value of register number REG to a data object of type
|
443 |
|
|
TYPE. The buffer at FROM holds the register's value in raw
|
444 |
|
|
format; the converted value should be placed in the buffer at TO.
|
445 |
|
|
|
446 |
|
|
Note that `REGISTER_TO_VALUE' and `VALUE_TO_REGISTER' take their
|
447 |
|
|
REG and TYPE arguments in different orders.
|
448 |
|
|
|
449 |
|
|
You should only use `REGISTER_TO_VALUE' with registers for which
|
450 |
|
|
the `CONVERT_REGISTER_P' macro returns a non-zero value.
|
451 |
|
|
|
452 |
|
|
- Target Macro: void VALUE_TO_REGISTER (struct type *TYPE, int REG,
|
453 |
|
|
char *FROM, char *TO)
|
454 |
|
|
Convert a data value of type TYPE to register number REG' raw
|
455 |
|
|
format.
|
456 |
|
|
|
457 |
|
|
Note that `REGISTER_TO_VALUE' and `VALUE_TO_REGISTER' take their
|
458 |
|
|
REG and TYPE arguments in different orders.
|
459 |
|
|
|
460 |
|
|
You should only use `VALUE_TO_REGISTER' with registers for which
|
461 |
|
|
the `CONVERT_REGISTER_P' macro returns a non-zero value.
|
462 |
|
|
|
463 |
|
|
- Target Macro: void REGISTER_CONVERT_TO_TYPE (int REGNUM, struct type
|
464 |
|
|
*TYPE, char *BUF)
|
465 |
|
|
See `mips-tdep.c'. It does not do what you want.
|
466 |
|
|
|
467 |
|
|
Frame Interpretation
|
468 |
|
|
====================
|
469 |
|
|
|
470 |
|
|
Inferior Call Setup
|
471 |
|
|
===================
|
472 |
|
|
|
473 |
|
|
Compiler Characteristics
|
474 |
|
|
========================
|
475 |
|
|
|
476 |
|
|
Target Conditionals
|
477 |
|
|
===================
|
478 |
|
|
|
479 |
|
|
This section describes the macros that you can use to define the
|
480 |
|
|
target machine.
|
481 |
|
|
|
482 |
|
|
`ADDITIONAL_OPTIONS'
|
483 |
|
|
`ADDITIONAL_OPTION_CASES'
|
484 |
|
|
`ADDITIONAL_OPTION_HANDLER'
|
485 |
|
|
`ADDITIONAL_OPTION_HELP'
|
486 |
|
|
These are a set of macros that allow the addition of additional
|
487 |
|
|
command line options to GDB. They are currently used only for the
|
488 |
|
|
unsupported i960 Nindy target, and should not be used in any other
|
489 |
|
|
configuration.
|
490 |
|
|
|
491 |
|
|
`ADDR_BITS_REMOVE (addr)'
|
492 |
|
|
If a raw machine instruction address includes any bits that are not
|
493 |
|
|
really part of the address, then define this macro to expand into
|
494 |
|
|
an expression that zeroes those bits in ADDR. This is only used
|
495 |
|
|
for addresses of instructions, and even then not in all contexts.
|
496 |
|
|
|
497 |
|
|
For example, the two low-order bits of the PC on the
|
498 |
|
|
Hewlett-Packard PA 2.0 architecture contain the privilege level of
|
499 |
|
|
the corresponding instruction. Since instructions must always be
|
500 |
|
|
aligned on four-byte boundaries, the processor masks out these
|
501 |
|
|
bits to generate the actual address of the instruction.
|
502 |
|
|
ADDR_BITS_REMOVE should filter out these bits with an expression
|
503 |
|
|
such as `((addr) & ~3)'.
|
504 |
|
|
|
505 |
|
|
`ADDRESS_TO_POINTER (TYPE, BUF, ADDR)'
|
506 |
|
|
Store in BUF a pointer of type TYPE representing the address ADDR,
|
507 |
|
|
in the appropriate format for the current architecture. This
|
508 |
|
|
macro may safely assume that TYPE is either a pointer or a C++
|
509 |
|
|
reference type. *Note Pointers Are Not Always Addresses: Target
|
510 |
|
|
Architecture Definition.
|
511 |
|
|
|
512 |
|
|
`BEFORE_MAIN_LOOP_HOOK'
|
513 |
|
|
Define this to expand into any code that you want to execute
|
514 |
|
|
before the main loop starts. Although this is not, strictly
|
515 |
|
|
speaking, a target conditional, that is how it is currently being
|
516 |
|
|
used. Note that if a configuration were to define it one way for
|
517 |
|
|
a host and a different way for the target, GDB will probably not
|
518 |
|
|
compile, let alone run correctly. This macro is currently used
|
519 |
|
|
only for the unsupported i960 Nindy target, and should not be used
|
520 |
|
|
in any other configuration.
|
521 |
|
|
|
522 |
|
|
`BELIEVE_PCC_PROMOTION'
|
523 |
|
|
Define if the compiler promotes a `short' or `char' parameter to
|
524 |
|
|
an `int', but still reports the parameter as its original type,
|
525 |
|
|
rather than the promoted type.
|
526 |
|
|
|
527 |
|
|
`BELIEVE_PCC_PROMOTION_TYPE'
|
528 |
|
|
Define this if GDB should believe the type of a `short' argument
|
529 |
|
|
when compiled by `pcc', but look within a full int space to get
|
530 |
|
|
its value. Only defined for Sun-3 at present.
|
531 |
|
|
|
532 |
|
|
`BITS_BIG_ENDIAN'
|
533 |
|
|
Define this if the numbering of bits in the targets does *not*
|
534 |
|
|
match the endianness of the target byte order. A value of 1 means
|
535 |
|
|
that the bits are numbered in a big-endian bit order, 0 means
|
536 |
|
|
little-endian.
|
537 |
|
|
|
538 |
|
|
`BREAKPOINT'
|
539 |
|
|
This is the character array initializer for the bit pattern to put
|
540 |
|
|
into memory where a breakpoint is set. Although it's common to
|
541 |
|
|
use a trap instruction for a breakpoint, it's not required; for
|
542 |
|
|
instance, the bit pattern could be an invalid instruction. The
|
543 |
|
|
breakpoint must be no longer than the shortest instruction of the
|
544 |
|
|
architecture.
|
545 |
|
|
|
546 |
|
|
`BREAKPOINT' has been deprecated in favor of `BREAKPOINT_FROM_PC'.
|
547 |
|
|
|
548 |
|
|
`BIG_BREAKPOINT'
|
549 |
|
|
`LITTLE_BREAKPOINT'
|
550 |
|
|
Similar to BREAKPOINT, but used for bi-endian targets.
|
551 |
|
|
|
552 |
|
|
`BIG_BREAKPOINT' and `LITTLE_BREAKPOINT' have been deprecated in
|
553 |
|
|
favor of `BREAKPOINT_FROM_PC'.
|
554 |
|
|
|
555 |
|
|
`REMOTE_BREAKPOINT'
|
556 |
|
|
`LITTLE_REMOTE_BREAKPOINT'
|
557 |
|
|
`BIG_REMOTE_BREAKPOINT'
|
558 |
|
|
Similar to BREAKPOINT, but used for remote targets.
|
559 |
|
|
|
560 |
|
|
`BIG_REMOTE_BREAKPOINT' and `LITTLE_REMOTE_BREAKPOINT' have been
|
561 |
|
|
deprecated in favor of `BREAKPOINT_FROM_PC'.
|
562 |
|
|
|
563 |
|
|
`BREAKPOINT_FROM_PC (PCPTR, LENPTR)'
|
564 |
|
|
Use the program counter to determine the contents and size of a
|
565 |
|
|
breakpoint instruction. It returns a pointer to a string of bytes
|
566 |
|
|
that encode a breakpoint instruction, stores the length of the
|
567 |
|
|
string to *LENPTR, and adjusts pc (if necessary) to point to the
|
568 |
|
|
actual memory location where the breakpoint should be inserted.
|
569 |
|
|
|
570 |
|
|
Although it is common to use a trap instruction for a breakpoint,
|
571 |
|
|
it's not required; for instance, the bit pattern could be an
|
572 |
|
|
invalid instruction. The breakpoint must be no longer than the
|
573 |
|
|
shortest instruction of the architecture.
|
574 |
|
|
|
575 |
|
|
Replaces all the other BREAKPOINT macros.
|
576 |
|
|
|
577 |
|
|
`MEMORY_INSERT_BREAKPOINT (ADDR, CONTENTS_CACHE)'
|
578 |
|
|
`MEMORY_REMOVE_BREAKPOINT (ADDR, CONTENTS_CACHE)'
|
579 |
|
|
Insert or remove memory based breakpoints. Reasonable defaults
|
580 |
|
|
(`default_memory_insert_breakpoint' and
|
581 |
|
|
`default_memory_remove_breakpoint' respectively) have been
|
582 |
|
|
provided so that it is not necessary to define these for most
|
583 |
|
|
architectures. Architectures which may want to define
|
584 |
|
|
`MEMORY_INSERT_BREAKPOINT' and `MEMORY_REMOVE_BREAKPOINT' will
|
585 |
|
|
likely have instructions that are oddly sized or are not stored in
|
586 |
|
|
a conventional manner.
|
587 |
|
|
|
588 |
|
|
It may also be desirable (from an efficiency standpoint) to define
|
589 |
|
|
custom breakpoint insertion and removal routines if
|
590 |
|
|
`BREAKPOINT_FROM_PC' needs to read the target's memory for some
|
591 |
|
|
reason.
|
592 |
|
|
|
593 |
|
|
`CALL_DUMMY_P'
|
594 |
|
|
A C expression that is non-zero when the target supports inferior
|
595 |
|
|
function calls.
|
596 |
|
|
|
597 |
|
|
`CALL_DUMMY_WORDS'
|
598 |
|
|
Pointer to an array of `LONGEST' words of data containing
|
599 |
|
|
host-byte-ordered `REGISTER_BYTES' sized values that partially
|
600 |
|
|
specify the sequence of instructions needed for an inferior
|
601 |
|
|
function call.
|
602 |
|
|
|
603 |
|
|
Should be deprecated in favor of a macro that uses
|
604 |
|
|
target-byte-ordered data.
|
605 |
|
|
|
606 |
|
|
`SIZEOF_CALL_DUMMY_WORDS'
|
607 |
|
|
The size of `CALL_DUMMY_WORDS'. When `CALL_DUMMY_P' this must
|
608 |
|
|
return a positive value. See also `CALL_DUMMY_LENGTH'.
|
609 |
|
|
|
610 |
|
|
`CALL_DUMMY'
|
611 |
|
|
A static initializer for `CALL_DUMMY_WORDS'. Deprecated.
|
612 |
|
|
|
613 |
|
|
`CALL_DUMMY_LOCATION'
|
614 |
|
|
See the file `inferior.h'.
|
615 |
|
|
|
616 |
|
|
`CALL_DUMMY_STACK_ADJUST'
|
617 |
|
|
Stack adjustment needed when performing an inferior function call.
|
618 |
|
|
|
619 |
|
|
Should be deprecated in favor of something like `STACK_ALIGN'.
|
620 |
|
|
|
621 |
|
|
`CALL_DUMMY_STACK_ADJUST_P'
|
622 |
|
|
Predicate for use of `CALL_DUMMY_STACK_ADJUST'.
|
623 |
|
|
|
624 |
|
|
Should be deprecated in favor of something like `STACK_ALIGN'.
|
625 |
|
|
|
626 |
|
|
`CANNOT_FETCH_REGISTER (REGNO)'
|
627 |
|
|
A C expression that should be nonzero if REGNO cannot be fetched
|
628 |
|
|
from an inferior process. This is only relevant if
|
629 |
|
|
`FETCH_INFERIOR_REGISTERS' is not defined.
|
630 |
|
|
|
631 |
|
|
`CANNOT_STORE_REGISTER (REGNO)'
|
632 |
|
|
A C expression that should be nonzero if REGNO should not be
|
633 |
|
|
written to the target. This is often the case for program
|
634 |
|
|
counters, status words, and other special registers. If this is
|
635 |
|
|
not defined, GDB will assume that all registers may be written.
|
636 |
|
|
|
637 |
|
|
`DO_DEFERRED_STORES'
|
638 |
|
|
`CLEAR_DEFERRED_STORES'
|
639 |
|
|
Define this to execute any deferred stores of registers into the
|
640 |
|
|
inferior, and to cancel any deferred stores.
|
641 |
|
|
|
642 |
|
|
Currently only implemented correctly for native Sparc
|
643 |
|
|
configurations?
|
644 |
|
|
|
645 |
|
|
`COERCE_FLOAT_TO_DOUBLE (FORMAL, ACTUAL)'
|
646 |
|
|
Return non-zero if GDB should promote `float' values to `double'
|
647 |
|
|
when calling a non-prototyped function. The argument ACTUAL is
|
648 |
|
|
the type of the value we want to pass to the function. The
|
649 |
|
|
argument FORMAL is the type of this argument, as it appears in the
|
650 |
|
|
function's definition. Note that FORMAL may be zero if we have no
|
651 |
|
|
debugging information for the function, or if we're passing more
|
652 |
|
|
arguments than are officially declared (for example, varargs).
|
653 |
|
|
This macro is never invoked if the function definitely has a
|
654 |
|
|
prototype.
|
655 |
|
|
|
656 |
|
|
How you should pass arguments to a function depends on whether it
|
657 |
|
|
was defined in K&R style or prototype style. If you define a
|
658 |
|
|
function using the K&R syntax that takes a `float' argument, then
|
659 |
|
|
callers must pass that argument as a `double'. If you define the
|
660 |
|
|
function using the prototype syntax, then you must pass the
|
661 |
|
|
argument as a `float', with no promotion.
|
662 |
|
|
|
663 |
|
|
Unfortunately, on certain older platforms, the debug info doesn't
|
664 |
|
|
indicate reliably how each function was defined. A function type's
|
665 |
|
|
`TYPE_FLAG_PROTOTYPED' flag may be unset, even if the function was
|
666 |
|
|
defined in prototype style. When calling a function whose
|
667 |
|
|
`TYPE_FLAG_PROTOTYPED' flag is unset, GDB consults the
|
668 |
|
|
`COERCE_FLOAT_TO_DOUBLE' macro to decide what to do.
|
669 |
|
|
|
670 |
|
|
For modern targets, it is proper to assume that, if the prototype
|
671 |
|
|
flag is unset, that can be trusted: `float' arguments should be
|
672 |
|
|
promoted to `double'. You should use the function
|
673 |
|
|
`standard_coerce_float_to_double' to get this behavior.
|
674 |
|
|
|
675 |
|
|
For some older targets, if the prototype flag is unset, that
|
676 |
|
|
doesn't tell us anything. So we guess that, if we don't have a
|
677 |
|
|
type for the formal parameter (i.e., the first argument to
|
678 |
|
|
`COERCE_FLOAT_TO_DOUBLE' is null), then we should promote it;
|
679 |
|
|
otherwise, we should leave it alone. The function
|
680 |
|
|
`default_coerce_float_to_double' provides this behavior; it is the
|
681 |
|
|
default value, for compatibility with older configurations.
|
682 |
|
|
|
683 |
|
|
`int CONVERT_REGISTER_P(REGNUM)'
|
684 |
|
|
Return non-zero if register REGNUM can represent data values in a
|
685 |
|
|
non-standard form. *Note Using Different Register and Memory Data
|
686 |
|
|
Representations: Target Architecture Definition.
|
687 |
|
|
|
688 |
|
|
`CPLUS_MARKER'
|
689 |
|
|
Define this to expand into the character that G++ uses to
|
690 |
|
|
distinguish compiler-generated identifiers from
|
691 |
|
|
programmer-specified identifiers. By default, this expands into
|
692 |
|
|
`'$''. Most System V targets should define this to `'.''.
|
693 |
|
|
|
694 |
|
|
`DBX_PARM_SYMBOL_CLASS'
|
695 |
|
|
Hook for the `SYMBOL_CLASS' of a parameter when decoding DBX symbol
|
696 |
|
|
information. In the i960, parameters can be stored as locals or as
|
697 |
|
|
args, depending on the type of the debug record.
|
698 |
|
|
|
699 |
|
|
`DECR_PC_AFTER_BREAK'
|
700 |
|
|
Define this to be the amount by which to decrement the PC after the
|
701 |
|
|
program encounters a breakpoint. This is often the number of
|
702 |
|
|
bytes in `BREAKPOINT', though not always. For most targets this
|
703 |
|
|
value will be 0.
|
704 |
|
|
|
705 |
|
|
`DECR_PC_AFTER_HW_BREAK'
|
706 |
|
|
Similarly, for hardware breakpoints.
|
707 |
|
|
|
708 |
|
|
`DISABLE_UNSETTABLE_BREAK (ADDR)'
|
709 |
|
|
If defined, this should evaluate to 1 if ADDR is in a shared
|
710 |
|
|
library in which breakpoints cannot be set and so should be
|
711 |
|
|
disabled.
|
712 |
|
|
|
713 |
|
|
`DO_REGISTERS_INFO'
|
714 |
|
|
If defined, use this to print the value of a register or all
|
715 |
|
|
registers.
|
716 |
|
|
|
717 |
|
|
This method is deprecated.
|
718 |
|
|
|
719 |
|
|
`PRINT_FLOAT_INFO()'
|
720 |
|
|
If defined, then the `info float' command will print information
|
721 |
|
|
about the processor's floating point unit.
|
722 |
|
|
|
723 |
|
|
`print_registers_info (GDBARCH, FRAME, REGNUM, ALL)'
|
724 |
|
|
If defined, pretty print the value of the register REGNUM for the
|
725 |
|
|
specified FRAME. If the value of REGNUM is -1, pretty print
|
726 |
|
|
either all registers (ALL is non zero) or a select subset of
|
727 |
|
|
registers (ALL is zero).
|
728 |
|
|
|
729 |
|
|
The default method prints one register per line, and if ALL is
|
730 |
|
|
zero omits floating-point registers.
|
731 |
|
|
|
732 |
|
|
`PRINT_VECTOR_INFO()'
|
733 |
|
|
If defined, then the `info vector' command will call this function
|
734 |
|
|
to print information about the processor's vector unit.
|
735 |
|
|
|
736 |
|
|
By default, the `info vector' command will print all vector
|
737 |
|
|
registers (the register's type having the vector attribute).
|
738 |
|
|
|
739 |
|
|
`DWARF_REG_TO_REGNUM'
|
740 |
|
|
Convert DWARF register number into GDB regnum. If not defined, no
|
741 |
|
|
conversion will be performed.
|
742 |
|
|
|
743 |
|
|
`DWARF2_REG_TO_REGNUM'
|
744 |
|
|
Convert DWARF2 register number into GDB regnum. If not defined,
|
745 |
|
|
no conversion will be performed.
|
746 |
|
|
|
747 |
|
|
`ECOFF_REG_TO_REGNUM'
|
748 |
|
|
Convert ECOFF register number into GDB regnum. If not defined, no
|
749 |
|
|
conversion will be performed.
|
750 |
|
|
|
751 |
|
|
`END_OF_TEXT_DEFAULT'
|
752 |
|
|
This is an expression that should designate the end of the text
|
753 |
|
|
section.
|
754 |
|
|
|
755 |
|
|
`EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF)'
|
756 |
|
|
Define this to extract a function's return value of type TYPE from
|
757 |
|
|
the raw register state REGBUF and copy that, in virtual format,
|
758 |
|
|
into VALBUF.
|
759 |
|
|
|
760 |
|
|
`EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF)'
|
761 |
|
|
When defined, extract from the array REGBUF (containing the raw
|
762 |
|
|
register state) the `CORE_ADDR' at which a function should return
|
763 |
|
|
its structure value.
|
764 |
|
|
|
765 |
|
|
If not defined, `EXTRACT_RETURN_VALUE' is used.
|
766 |
|
|
|
767 |
|
|
`EXTRACT_STRUCT_VALUE_ADDRESS_P()'
|
768 |
|
|
Predicate for `EXTRACT_STRUCT_VALUE_ADDRESS'.
|
769 |
|
|
|
770 |
|
|
`FLOAT_INFO'
|
771 |
|
|
Deprecated in favor of `PRINT_FLOAT_INFO'.
|
772 |
|
|
|
773 |
|
|
`FP_REGNUM'
|
774 |
|
|
If the virtual frame pointer is kept in a register, then define
|
775 |
|
|
this macro to be the number (greater than or equal to zero) of
|
776 |
|
|
that register.
|
777 |
|
|
|
778 |
|
|
This should only need to be defined if `TARGET_READ_FP' is not
|
779 |
|
|
defined.
|
780 |
|
|
|
781 |
|
|
`FRAMELESS_FUNCTION_INVOCATION(FI)'
|
782 |
|
|
Define this to an expression that returns 1 if the function
|
783 |
|
|
invocation represented by FI does not have a stack frame
|
784 |
|
|
associated with it. Otherwise return 0.
|
785 |
|
|
|
786 |
|
|
`FRAME_ARGS_ADDRESS_CORRECT'
|
787 |
|
|
See `stack.c'.
|
788 |
|
|
|
789 |
|
|
`FRAME_CHAIN(FRAME)'
|
790 |
|
|
Given FRAME, return a pointer to the calling frame.
|
791 |
|
|
|
792 |
|
|
`FRAME_CHAIN_VALID(CHAIN, THISFRAME)'
|
793 |
|
|
Define this to be an expression that returns zero if the given
|
794 |
|
|
frame is an outermost frame, with no caller, and nonzero
|
795 |
|
|
otherwise. Several common definitions are available:
|
796 |
|
|
|
797 |
|
|
* `file_frame_chain_valid' is nonzero if the chain pointer is
|
798 |
|
|
nonzero and given frame's PC is not inside the startup file
|
799 |
|
|
(such as `crt0.o').
|
800 |
|
|
|
801 |
|
|
* `func_frame_chain_valid' is nonzero if the chain pointer is
|
802 |
|
|
nonzero and the given frame's PC is not in `main' or a known
|
803 |
|
|
entry point function (such as `_start').
|
804 |
|
|
|
805 |
|
|
* `generic_file_frame_chain_valid' and
|
806 |
|
|
`generic_func_frame_chain_valid' are equivalent
|
807 |
|
|
implementations for targets using generic dummy frames.
|
808 |
|
|
|
809 |
|
|
`FRAME_INIT_SAVED_REGS(FRAME)'
|
810 |
|
|
See `frame.h'. Determines the address of all registers in the
|
811 |
|
|
current stack frame storing each in `frame->saved_regs'. Space for
|
812 |
|
|
`frame->saved_regs' shall be allocated by `FRAME_INIT_SAVED_REGS'
|
813 |
|
|
using either `frame_saved_regs_zalloc' or `frame_obstack_alloc'.
|
814 |
|
|
|
815 |
|
|
`FRAME_FIND_SAVED_REGS' and `EXTRA_FRAME_INFO' are deprecated.
|
816 |
|
|
|
817 |
|
|
`FRAME_NUM_ARGS (FI)'
|
818 |
|
|
For the frame described by FI return the number of arguments that
|
819 |
|
|
are being passed. If the number of arguments is not known, return
|
820 |
|
|
`-1'.
|
821 |
|
|
|
822 |
|
|
`FRAME_SAVED_PC(FRAME)'
|
823 |
|
|
Given FRAME, return the pc saved there. This is the return
|
824 |
|
|
address.
|
825 |
|
|
|
826 |
|
|
`FUNCTION_EPILOGUE_SIZE'
|
827 |
|
|
For some COFF targets, the `x_sym.x_misc.x_fsize' field of the
|
828 |
|
|
function end symbol is 0. For such targets, you must define
|
829 |
|
|
`FUNCTION_EPILOGUE_SIZE' to expand into the standard size of a
|
830 |
|
|
function's epilogue.
|
831 |
|
|
|
832 |
|
|
`FUNCTION_START_OFFSET'
|
833 |
|
|
An integer, giving the offset in bytes from a function's address
|
834 |
|
|
(as used in the values of symbols, function pointers, etc.), and
|
835 |
|
|
the function's first genuine instruction.
|
836 |
|
|
|
837 |
|
|
This is zero on almost all machines: the function's address is
|
838 |
|
|
usually the address of its first instruction. However, on the
|
839 |
|
|
VAX, for example, each function starts with two bytes containing a
|
840 |
|
|
bitmask indicating which registers to save upon entry to the
|
841 |
|
|
function. The VAX `call' instructions check this value, and save
|
842 |
|
|
the appropriate registers automatically. Thus, since the offset
|
843 |
|
|
from the function's address to its first instruction is two bytes,
|
844 |
|
|
`FUNCTION_START_OFFSET' would be 2 on the VAX.
|
845 |
|
|
|
846 |
|
|
`GCC_COMPILED_FLAG_SYMBOL'
|
847 |
|
|
`GCC2_COMPILED_FLAG_SYMBOL'
|
848 |
|
|
If defined, these are the names of the symbols that GDB will look
|
849 |
|
|
for to detect that GCC compiled the file. The default symbols are
|
850 |
|
|
`gcc_compiled.' and `gcc2_compiled.', respectively. (Currently
|
851 |
|
|
only defined for the Delta 68.)
|
852 |
|
|
|
853 |
|
|
`GDB_MULTI_ARCH'
|
854 |
|
|
If defined and non-zero, enables support for multiple architectures
|
855 |
|
|
within GDB.
|
856 |
|
|
|
857 |
|
|
This support can be enabled at two levels. At level one, only
|
858 |
|
|
definitions for previously undefined macros are provided; at level
|
859 |
|
|
two, a multi-arch definition of all architecture dependent macros
|
860 |
|
|
will be defined.
|
861 |
|
|
|
862 |
|
|
`GDB_TARGET_IS_HPPA'
|
863 |
|
|
This determines whether horrible kludge code in `dbxread.c' and
|
864 |
|
|
`partial-stab.h' is used to mangle multiple-symbol-table files from
|
865 |
|
|
HPPA's. This should all be ripped out, and a scheme like
|
866 |
|
|
`elfread.c' used instead.
|
867 |
|
|
|
868 |
|
|
`GET_LONGJMP_TARGET'
|
869 |
|
|
For most machines, this is a target-dependent parameter. On the
|
870 |
|
|
DECstation and the Iris, this is a native-dependent parameter,
|
871 |
|
|
since the header file `setjmp.h' is needed to define it.
|
872 |
|
|
|
873 |
|
|
This macro determines the target PC address that `longjmp' will
|
874 |
|
|
jump to, assuming that we have just stopped at a `longjmp'
|
875 |
|
|
breakpoint. It takes a `CORE_ADDR *' as argument, and stores the
|
876 |
|
|
target PC value through this pointer. It examines the current
|
877 |
|
|
state of the machine as needed.
|
878 |
|
|
|
879 |
|
|
`GET_SAVED_REGISTER'
|
880 |
|
|
Define this if you need to supply your own definition for the
|
881 |
|
|
function `get_saved_register'.
|
882 |
|
|
|
883 |
|
|
`IBM6000_TARGET'
|
884 |
|
|
Shows that we are configured for an IBM RS/6000 target. This
|
885 |
|
|
conditional should be eliminated (FIXME) and replaced by
|
886 |
|
|
feature-specific macros. It was introduced in a haste and we are
|
887 |
|
|
repenting at leisure.
|
888 |
|
|
|
889 |
|
|
`I386_USE_GENERIC_WATCHPOINTS'
|
890 |
|
|
An x86-based target can define this to use the generic x86
|
891 |
|
|
watchpoint support; see *Note I386_USE_GENERIC_WATCHPOINTS:
|
892 |
|
|
Algorithms.
|
893 |
|
|
|
894 |
|
|
`SYMBOLS_CAN_START_WITH_DOLLAR'
|
895 |
|
|
Some systems have routines whose names start with `$'. Giving this
|
896 |
|
|
macro a non-zero value tells GDB's expression parser to check for
|
897 |
|
|
such routines when parsing tokens that begin with `$'.
|
898 |
|
|
|
899 |
|
|
On HP-UX, certain system routines (millicode) have names beginning
|
900 |
|
|
with `$' or `$$'. For example, `$$dyncall' is a millicode routine
|
901 |
|
|
that handles inter-space procedure calls on PA-RISC.
|
902 |
|
|
|
903 |
|
|
`INIT_EXTRA_FRAME_INFO (FROMLEAF, FRAME)'
|
904 |
|
|
If additional information about the frame is required this should
|
905 |
|
|
be stored in `frame->extra_info'. Space for `frame->extra_info'
|
906 |
|
|
is allocated using `frame_obstack_alloc'.
|
907 |
|
|
|
908 |
|
|
`INIT_FRAME_PC (FROMLEAF, PREV)'
|
909 |
|
|
This is a C statement that sets the pc of the frame pointed to by
|
910 |
|
|
PREV. [By default...]
|
911 |
|
|
|
912 |
|
|
`INNER_THAN (LHS, RHS)'
|
913 |
|
|
Returns non-zero if stack address LHS is inner than (nearer to the
|
914 |
|
|
stack top) stack address RHS. Define this as `lhs < rhs' if the
|
915 |
|
|
target's stack grows downward in memory, or `lhs > rsh' if the
|
916 |
|
|
stack grows upward.
|
917 |
|
|
|
918 |
|
|
`gdbarch_in_function_epilogue_p (GDBARCH, PC)'
|
919 |
|
|
Returns non-zero if the given PC is in the epilogue of a function.
|
920 |
|
|
The epilogue of a function is defined as the part of a function
|
921 |
|
|
where the stack frame of the function already has been destroyed
|
922 |
|
|
up to the final `return from function call' instruction.
|
923 |
|
|
|
924 |
|
|
`SIGTRAMP_START (PC)'
|
925 |
|
|
`SIGTRAMP_END (PC)'
|
926 |
|
|
Define these to be the start and end address of the `sigtramp' for
|
927 |
|
|
the given PC. On machines where the address is just a compile time
|
928 |
|
|
constant, the macro expansion will typically just ignore the
|
929 |
|
|
supplied PC.
|
930 |
|
|
|
931 |
|
|
`IN_SOLIB_CALL_TRAMPOLINE (PC, NAME)'
|
932 |
|
|
Define this to evaluate to nonzero if the program is stopped in the
|
933 |
|
|
trampoline that connects to a shared library.
|
934 |
|
|
|
935 |
|
|
`IN_SOLIB_RETURN_TRAMPOLINE (PC, NAME)'
|
936 |
|
|
Define this to evaluate to nonzero if the program is stopped in the
|
937 |
|
|
trampoline that returns from a shared library.
|
938 |
|
|
|
939 |
|
|
`IN_SOLIB_DYNSYM_RESOLVE_CODE (PC)'
|
940 |
|
|
Define this to evaluate to nonzero if the program is stopped in the
|
941 |
|
|
dynamic linker.
|
942 |
|
|
|
943 |
|
|
`SKIP_SOLIB_RESOLVER (PC)'
|
944 |
|
|
Define this to evaluate to the (nonzero) address at which execution
|
945 |
|
|
should continue to get past the dynamic linker's symbol resolution
|
946 |
|
|
function. A zero value indicates that it is not important or
|
947 |
|
|
necessary to set a breakpoint to get through the dynamic linker
|
948 |
|
|
and that single stepping will suffice.
|
949 |
|
|
|
950 |
|
|
`INTEGER_TO_ADDRESS (TYPE, BUF)'
|
951 |
|
|
Define this when the architecture needs to handle non-pointer to
|
952 |
|
|
address conversions specially. Converts that value to an address
|
953 |
|
|
according to the current architectures conventions.
|
954 |
|
|
|
955 |
|
|
_Pragmatics: When the user copies a well defined expression from
|
956 |
|
|
their source code and passes it, as a parameter, to GDB's `print'
|
957 |
|
|
command, they should get the same value as would have been
|
958 |
|
|
computed by the target program. Any deviation from this rule can
|
959 |
|
|
cause major confusion and annoyance, and needs to be justified
|
960 |
|
|
carefully. In other words, GDB doesn't really have the freedom to
|
961 |
|
|
do these conversions in clever and useful ways. It has, however,
|
962 |
|
|
been pointed out that users aren't complaining about how GDB casts
|
963 |
|
|
integers to pointers; they are complaining that they can't take an
|
964 |
|
|
address from a disassembly listing and give it to `x/i'. Adding
|
965 |
|
|
an architecture method like `INTEGER_TO_ADDRESS' certainly makes
|
966 |
|
|
it possible for GDB to "get it right" in all circumstances._
|
967 |
|
|
|
968 |
|
|
*Note Pointers Are Not Always Addresses: Target Architecture
|
969 |
|
|
Definition.
|
970 |
|
|
|
971 |
|
|
`IS_TRAPPED_INTERNALVAR (NAME)'
|
972 |
|
|
This is an ugly hook to allow the specification of special actions
|
973 |
|
|
that should occur as a side-effect of setting the value of a
|
974 |
|
|
variable internal to GDB. Currently only used by the h8500. Note
|
975 |
|
|
that this could be either a host or target conditional.
|
976 |
|
|
|
977 |
|
|
`NEED_TEXT_START_END'
|
978 |
|
|
Define this if GDB should determine the start and end addresses of
|
979 |
|
|
the text section. (Seems dubious.)
|
980 |
|
|
|
981 |
|
|
`NO_HIF_SUPPORT'
|
982 |
|
|
(Specific to the a29k.)
|
983 |
|
|
|
984 |
|
|
`POINTER_TO_ADDRESS (TYPE, BUF)'
|
985 |
|
|
Assume that BUF holds a pointer of type TYPE, in the appropriate
|
986 |
|
|
format for the current architecture. Return the byte address the
|
987 |
|
|
pointer refers to. *Note Pointers Are Not Always Addresses:
|
988 |
|
|
Target Architecture Definition.
|
989 |
|
|
|
990 |
|
|
`REGISTER_CONVERTIBLE (REG)'
|
991 |
|
|
Return non-zero if REG uses different raw and virtual formats.
|
992 |
|
|
*Note Raw and Virtual Register Representations: Target
|
993 |
|
|
Architecture Definition.
|
994 |
|
|
|
995 |
|
|
`REGISTER_TO_VALUE(REGNUM, TYPE, FROM, TO)'
|
996 |
|
|
Convert the raw contents of register REGNUM into a value of type
|
997 |
|
|
TYPE. *Note Using Different Register and Memory Data
|
998 |
|
|
Representations: Target Architecture Definition.
|
999 |
|
|
|
1000 |
|
|
`REGISTER_RAW_SIZE (REG)'
|
1001 |
|
|
Return the raw size of REG; defaults to the size of the register's
|
1002 |
|
|
virtual type. *Note Raw and Virtual Register Representations:
|
1003 |
|
|
Target Architecture Definition.
|
1004 |
|
|
|
1005 |
|
|
`REGISTER_VIRTUAL_SIZE (REG)'
|
1006 |
|
|
Return the virtual size of REG; defaults to the size of the
|
1007 |
|
|
register's virtual type. Return the virtual size of REG. *Note
|
1008 |
|
|
Raw and Virtual Register Representations: Target Architecture
|
1009 |
|
|
Definition.
|
1010 |
|
|
|
1011 |
|
|
`REGISTER_VIRTUAL_TYPE (REG)'
|
1012 |
|
|
Return the virtual type of REG. *Note Raw and Virtual Register
|
1013 |
|
|
Representations: Target Architecture Definition.
|
1014 |
|
|
|
1015 |
|
|
`REGISTER_CONVERT_TO_VIRTUAL(REG, TYPE, FROM, TO)'
|
1016 |
|
|
Convert the value of register REG from its raw form to its virtual
|
1017 |
|
|
form. *Note Raw and Virtual Register Representations: Target
|
1018 |
|
|
Architecture Definition.
|
1019 |
|
|
|
1020 |
|
|
`REGISTER_CONVERT_TO_RAW(TYPE, REG, FROM, TO)'
|
1021 |
|
|
Convert the value of register REG from its virtual form to its raw
|
1022 |
|
|
form. *Note Raw and Virtual Register Representations: Target
|
1023 |
|
|
Architecture Definition.
|
1024 |
|
|
|
1025 |
|
|
`RETURN_VALUE_ON_STACK(TYPE)'
|
1026 |
|
|
Return non-zero if values of type TYPE are returned on the stack,
|
1027 |
|
|
using the "struct convention" (i.e., the caller provides a pointer
|
1028 |
|
|
to a buffer in which the callee should store the return value).
|
1029 |
|
|
This controls how the `finish' command finds a function's return
|
1030 |
|
|
value, and whether an inferior function call reserves space on the
|
1031 |
|
|
stack for the return value.
|
1032 |
|
|
|
1033 |
|
|
The full logic GDB uses here is kind of odd.
|
1034 |
|
|
|
1035 |
|
|
* If the type being returned by value is not a structure,
|
1036 |
|
|
union, or array, and `RETURN_VALUE_ON_STACK' returns zero,
|
1037 |
|
|
then GDB concludes the value is not returned using the struct
|
1038 |
|
|
convention.
|
1039 |
|
|
|
1040 |
|
|
* Otherwise, GDB calls `USE_STRUCT_CONVENTION' (see below). If
|
1041 |
|
|
that returns non-zero, GDB assumes the struct convention is
|
1042 |
|
|
in use.
|
1043 |
|
|
|
1044 |
|
|
In other words, to indicate that a given type is returned by value
|
1045 |
|
|
using the struct convention, that type must be either a struct,
|
1046 |
|
|
union, array, or something `RETURN_VALUE_ON_STACK' likes, _and_
|
1047 |
|
|
something that `USE_STRUCT_CONVENTION' likes.
|
1048 |
|
|
|
1049 |
|
|
Note that, in C and C++, arrays are never returned by value. In
|
1050 |
|
|
those languages, these predicates will always see a pointer type,
|
1051 |
|
|
never an array type. All the references above to arrays being
|
1052 |
|
|
returned by value apply only to other languages.
|
1053 |
|
|
|
1054 |
|
|
`SOFTWARE_SINGLE_STEP_P()'
|
1055 |
|
|
Define this as 1 if the target does not have a hardware single-step
|
1056 |
|
|
mechanism. The macro `SOFTWARE_SINGLE_STEP' must also be defined.
|
1057 |
|
|
|
1058 |
|
|
`SOFTWARE_SINGLE_STEP(SIGNAL, INSERT_BREAPOINTS_P)'
|
1059 |
|
|
A function that inserts or removes (depending on
|
1060 |
|
|
INSERT_BREAPOINTS_P) breakpoints at each possible destinations of
|
1061 |
|
|
the next instruction. See `sparc-tdep.c' and `rs6000-tdep.c' for
|
1062 |
|
|
examples.
|
1063 |
|
|
|
1064 |
|
|
`SOFUN_ADDRESS_MAYBE_MISSING'
|
1065 |
|
|
Somebody clever observed that, the more actual addresses you have
|
1066 |
|
|
in the debug information, the more time the linker has to spend
|
1067 |
|
|
relocating them. So whenever there's some other way the debugger
|
1068 |
|
|
could find the address it needs, you should omit it from the debug
|
1069 |
|
|
info, to make linking faster.
|
1070 |
|
|
|
1071 |
|
|
`SOFUN_ADDRESS_MAYBE_MISSING' indicates that a particular set of
|
1072 |
|
|
hacks of this sort are in use, affecting `N_SO' and `N_FUN'
|
1073 |
|
|
entries in stabs-format debugging information. `N_SO' stabs mark
|
1074 |
|
|
the beginning and ending addresses of compilation units in the text
|
1075 |
|
|
segment. `N_FUN' stabs mark the starts and ends of functions.
|
1076 |
|
|
|
1077 |
|
|
`SOFUN_ADDRESS_MAYBE_MISSING' means two things:
|
1078 |
|
|
|
1079 |
|
|
* `N_FUN' stabs have an address of zero. Instead, you should
|
1080 |
|
|
find the addresses where the function starts by taking the
|
1081 |
|
|
function name from the stab, and then looking that up in the
|
1082 |
|
|
minsyms (the linker/assembler symbol table). In other words,
|
1083 |
|
|
the stab has the name, and the linker/assembler symbol table
|
1084 |
|
|
is the only place that carries the address.
|
1085 |
|
|
|
1086 |
|
|
* `N_SO' stabs have an address of zero, too. You just look at
|
1087 |
|
|
the `N_FUN' stabs that appear before and after the `N_SO'
|
1088 |
|
|
stab, and guess the starting and ending addresses of the
|
1089 |
|
|
compilation unit from them.
|
1090 |
|
|
|
1091 |
|
|
`PCC_SOL_BROKEN'
|
1092 |
|
|
(Used only in the Convex target.)
|
1093 |
|
|
|
1094 |
|
|
`PC_IN_CALL_DUMMY'
|
1095 |
|
|
See `inferior.h'.
|
1096 |
|
|
|
1097 |
|
|
`PC_IN_SIGTRAMP (PC, NAME)'
|
1098 |
|
|
The "sigtramp" is a routine that the kernel calls (which then calls
|
1099 |
|
|
the signal handler). On most machines it is a library routine
|
1100 |
|
|
that is linked into the executable.
|
1101 |
|
|
|
1102 |
|
|
This function, given a program counter value in PC and the
|
1103 |
|
|
(possibly NULL) name of the function in which that PC resides,
|
1104 |
|
|
returns nonzero if the PC and/or NAME show that we are in sigtramp.
|
1105 |
|
|
|
1106 |
|
|
`PC_LOAD_SEGMENT'
|
1107 |
|
|
If defined, print information about the load segment for the
|
1108 |
|
|
program counter. (Defined only for the RS/6000.)
|
1109 |
|
|
|
1110 |
|
|
`PC_REGNUM'
|
1111 |
|
|
If the program counter is kept in a register, then define this
|
1112 |
|
|
macro to be the number (greater than or equal to zero) of that
|
1113 |
|
|
register.
|
1114 |
|
|
|
1115 |
|
|
This should only need to be defined if `TARGET_READ_PC' and
|
1116 |
|
|
`TARGET_WRITE_PC' are not defined.
|
1117 |
|
|
|
1118 |
|
|
`NPC_REGNUM'
|
1119 |
|
|
The number of the "next program counter" register, if defined.
|
1120 |
|
|
|
1121 |
|
|
`PARM_BOUNDARY'
|
1122 |
|
|
If non-zero, round arguments to a boundary of this many bits before
|
1123 |
|
|
pushing them on the stack.
|
1124 |
|
|
|
1125 |
|
|
`PRINT_REGISTER_HOOK (REGNO)'
|
1126 |
|
|
If defined, this must be a function that prints the contents of the
|
1127 |
|
|
given register to standard output.
|
1128 |
|
|
|
1129 |
|
|
`PRINT_TYPELESS_INTEGER'
|
1130 |
|
|
This is an obscure substitute for `print_longest' that seems to
|
1131 |
|
|
have been defined for the Convex target.
|
1132 |
|
|
|
1133 |
|
|
`PROCESS_LINENUMBER_HOOK'
|
1134 |
|
|
A hook defined for XCOFF reading.
|
1135 |
|
|
|
1136 |
|
|
`PROLOGUE_FIRSTLINE_OVERLAP'
|
1137 |
|
|
(Only used in unsupported Convex configuration.)
|
1138 |
|
|
|
1139 |
|
|
`PS_REGNUM'
|
1140 |
|
|
If defined, this is the number of the processor status register.
|
1141 |
|
|
(This definition is only used in generic code when parsing "$ps".)
|
1142 |
|
|
|
1143 |
|
|
`POP_FRAME'
|
1144 |
|
|
Used in `call_function_by_hand' to remove an artificial stack
|
1145 |
|
|
frame and in `return_command' to remove a real stack frame.
|
1146 |
|
|
|
1147 |
|
|
`PUSH_ARGUMENTS (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)'
|
1148 |
|
|
Define this to push arguments onto the stack for inferior function
|
1149 |
|
|
call. Returns the updated stack pointer value.
|
1150 |
|
|
|
1151 |
|
|
`PUSH_DUMMY_FRAME'
|
1152 |
|
|
Used in `call_function_by_hand' to create an artificial stack
|
1153 |
|
|
frame.
|
1154 |
|
|
|
1155 |
|
|
`REGISTER_BYTES'
|
1156 |
|
|
The total amount of space needed to store GDB's copy of the
|
1157 |
|
|
machine's register state.
|
1158 |
|
|
|
1159 |
|
|
`REGISTER_NAME(I)'
|
1160 |
|
|
Return the name of register I as a string. May return `NULL' or
|
1161 |
|
|
`NUL' to indicate that register I is not valid.
|
1162 |
|
|
|
1163 |
|
|
`REGISTER_NAMES'
|
1164 |
|
|
Deprecated in favor of `REGISTER_NAME'.
|
1165 |
|
|
|
1166 |
|
|
`REG_STRUCT_HAS_ADDR (GCC_P, TYPE)'
|
1167 |
|
|
Define this to return 1 if the given type will be passed by pointer
|
1168 |
|
|
rather than directly.
|
1169 |
|
|
|
1170 |
|
|
`SAVE_DUMMY_FRAME_TOS (SP)'
|
1171 |
|
|
Used in `call_function_by_hand' to notify the target dependent code
|
1172 |
|
|
of the top-of-stack value that will be passed to the the inferior
|
1173 |
|
|
code. This is the value of the `SP' after both the dummy frame
|
1174 |
|
|
and space for parameters/results have been allocated on the stack.
|
1175 |
|
|
|
1176 |
|
|
`SDB_REG_TO_REGNUM'
|
1177 |
|
|
Define this to convert sdb register numbers into GDB regnums. If
|
1178 |
|
|
not defined, no conversion will be done.
|
1179 |
|
|
|
1180 |
|
|
`SKIP_PERMANENT_BREAKPOINT'
|
1181 |
|
|
Advance the inferior's PC past a permanent breakpoint. GDB
|
1182 |
|
|
normally steps over a breakpoint by removing it, stepping one
|
1183 |
|
|
instruction, and re-inserting the breakpoint. However, permanent
|
1184 |
|
|
breakpoints are hardwired into the inferior, and can't be removed,
|
1185 |
|
|
so this strategy doesn't work. Calling
|
1186 |
|
|
`SKIP_PERMANENT_BREAKPOINT' adjusts the processor's state so that
|
1187 |
|
|
execution will resume just after the breakpoint. This macro does
|
1188 |
|
|
the right thing even when the breakpoint is in the delay slot of a
|
1189 |
|
|
branch or jump.
|
1190 |
|
|
|
1191 |
|
|
`SKIP_PROLOGUE (PC)'
|
1192 |
|
|
A C expression that returns the address of the "real" code beyond
|
1193 |
|
|
the function entry prologue found at PC.
|
1194 |
|
|
|
1195 |
|
|
`SKIP_TRAMPOLINE_CODE (PC)'
|
1196 |
|
|
If the target machine has trampoline code that sits between
|
1197 |
|
|
callers and the functions being called, then define this macro to
|
1198 |
|
|
return a new PC that is at the start of the real function.
|
1199 |
|
|
|
1200 |
|
|
`SP_REGNUM'
|
1201 |
|
|
If the stack-pointer is kept in a register, then define this macro
|
1202 |
|
|
to be the number (greater than or equal to zero) of that register.
|
1203 |
|
|
|
1204 |
|
|
This should only need to be defined if `TARGET_WRITE_SP' and
|
1205 |
|
|
`TARGET_WRITE_SP' are not defined.
|
1206 |
|
|
|
1207 |
|
|
`STAB_REG_TO_REGNUM'
|
1208 |
|
|
Define this to convert stab register numbers (as gotten from `r'
|
1209 |
|
|
declarations) into GDB regnums. If not defined, no conversion
|
1210 |
|
|
will be done.
|
1211 |
|
|
|
1212 |
|
|
`STACK_ALIGN (ADDR)'
|
1213 |
|
|
Define this to adjust the address to the alignment required for the
|
1214 |
|
|
processor's stack.
|
1215 |
|
|
|
1216 |
|
|
`STEP_SKIPS_DELAY (ADDR)'
|
1217 |
|
|
Define this to return true if the address is of an instruction
|
1218 |
|
|
with a delay slot. If a breakpoint has been placed in the
|
1219 |
|
|
instruction's delay slot, GDB will single-step over that
|
1220 |
|
|
instruction before resuming normally. Currently only defined for
|
1221 |
|
|
the Mips.
|
1222 |
|
|
|
1223 |
|
|
`STORE_RETURN_VALUE (TYPE, REGCACHE, VALBUF)'
|
1224 |
|
|
A C expression that writes the function return value, found in
|
1225 |
|
|
VALBUF, into the REGCACHE. TYPE is the type of the value that is
|
1226 |
|
|
to be returned.
|
1227 |
|
|
|
1228 |
|
|
`SUN_FIXED_LBRAC_BUG'
|
1229 |
|
|
(Used only for Sun-3 and Sun-4 targets.)
|
1230 |
|
|
|
1231 |
|
|
`SYMBOL_RELOADING_DEFAULT'
|
1232 |
|
|
The default value of the "symbol-reloading" variable. (Never
|
1233 |
|
|
defined in current sources.)
|
1234 |
|
|
|
1235 |
|
|
`TARGET_CHAR_BIT'
|
1236 |
|
|
Number of bits in a char; defaults to 8.
|
1237 |
|
|
|
1238 |
|
|
`TARGET_CHAR_SIGNED'
|
1239 |
|
|
Non-zero if `char' is normally signed on this architecture; zero if
|
1240 |
|
|
it should be unsigned.
|
1241 |
|
|
|
1242 |
|
|
The ISO C standard requires the compiler to treat `char' as
|
1243 |
|
|
equivalent to either `signed char' or `unsigned char'; any
|
1244 |
|
|
character in the standard execution set is supposed to be positive.
|
1245 |
|
|
Most compilers treat `char' as signed, but `char' is unsigned on
|
1246 |
|
|
the IBM S/390, RS6000, and PowerPC targets.
|
1247 |
|
|
|
1248 |
|
|
`TARGET_COMPLEX_BIT'
|
1249 |
|
|
Number of bits in a complex number; defaults to `2 *
|
1250 |
|
|
TARGET_FLOAT_BIT'.
|
1251 |
|
|
|
1252 |
|
|
At present this macro is not used.
|
1253 |
|
|
|
1254 |
|
|
`TARGET_DOUBLE_BIT'
|
1255 |
|
|
Number of bits in a double float; defaults to `8 *
|
1256 |
|
|
TARGET_CHAR_BIT'.
|
1257 |
|
|
|
1258 |
|
|
`TARGET_DOUBLE_COMPLEX_BIT'
|
1259 |
|
|
Number of bits in a double complex; defaults to `2 *
|
1260 |
|
|
TARGET_DOUBLE_BIT'.
|
1261 |
|
|
|
1262 |
|
|
At present this macro is not used.
|
1263 |
|
|
|
1264 |
|
|
`TARGET_FLOAT_BIT'
|
1265 |
|
|
Number of bits in a float; defaults to `4 * TARGET_CHAR_BIT'.
|
1266 |
|
|
|
1267 |
|
|
`TARGET_INT_BIT'
|
1268 |
|
|
Number of bits in an integer; defaults to `4 * TARGET_CHAR_BIT'.
|
1269 |
|
|
|
1270 |
|
|
`TARGET_LONG_BIT'
|
1271 |
|
|
Number of bits in a long integer; defaults to `4 *
|
1272 |
|
|
TARGET_CHAR_BIT'.
|
1273 |
|
|
|
1274 |
|
|
`TARGET_LONG_DOUBLE_BIT'
|
1275 |
|
|
Number of bits in a long double float; defaults to `2 *
|
1276 |
|
|
TARGET_DOUBLE_BIT'.
|
1277 |
|
|
|
1278 |
|
|
`TARGET_LONG_LONG_BIT'
|
1279 |
|
|
Number of bits in a long long integer; defaults to `2 *
|
1280 |
|
|
TARGET_LONG_BIT'.
|
1281 |
|
|
|
1282 |
|
|
`TARGET_PTR_BIT'
|
1283 |
|
|
Number of bits in a pointer; defaults to `TARGET_INT_BIT'.
|
1284 |
|
|
|
1285 |
|
|
`TARGET_SHORT_BIT'
|
1286 |
|
|
Number of bits in a short integer; defaults to `2 *
|
1287 |
|
|
TARGET_CHAR_BIT'.
|
1288 |
|
|
|
1289 |
|
|
`TARGET_READ_PC'
|
1290 |
|
|
`TARGET_WRITE_PC (VAL, PID)'
|
1291 |
|
|
`TARGET_READ_SP'
|
1292 |
|
|
`TARGET_WRITE_SP'
|
1293 |
|
|
`TARGET_READ_FP'
|
1294 |
|
|
These change the behavior of `read_pc', `write_pc', `read_sp',
|
1295 |
|
|
`write_sp' and `read_fp'. For most targets, these may be left
|
1296 |
|
|
undefined. GDB will call the read and write register functions
|
1297 |
|
|
with the relevant `_REGNUM' argument.
|
1298 |
|
|
|
1299 |
|
|
These macros are useful when a target keeps one of these registers
|
1300 |
|
|
in a hard to get at place; for example, part in a segment register
|
1301 |
|
|
and part in an ordinary register.
|
1302 |
|
|
|
1303 |
|
|
`TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFSETP)'
|
1304 |
|
|
Returns a `(register, offset)' pair representing the virtual frame
|
1305 |
|
|
pointer in use at the code address PC. If virtual frame pointers
|
1306 |
|
|
are not used, a default definition simply returns `FP_REGNUM',
|
1307 |
|
|
with an offset of zero.
|
1308 |
|
|
|
1309 |
|
|
`TARGET_HAS_HARDWARE_WATCHPOINTS'
|
1310 |
|
|
If non-zero, the target has support for hardware-assisted
|
1311 |
|
|
watchpoints. *Note watchpoints: Algorithms, for more details and
|
1312 |
|
|
other related macros.
|
1313 |
|
|
|
1314 |
|
|
`TARGET_PRINT_INSN (ADDR, INFO)'
|
1315 |
|
|
This is the function used by GDB to print an assembly instruction.
|
1316 |
|
|
It prints the instruction at address ADDR in debugged memory and
|
1317 |
|
|
returns the length of the instruction, in bytes. If a target
|
1318 |
|
|
doesn't define its own printing routine, it defaults to an
|
1319 |
|
|
accessor function for the global pointer `tm_print_insn'. This
|
1320 |
|
|
usually points to a function in the `opcodes' library (*note
|
1321 |
|
|
Opcodes: Support Libraries.). INFO is a structure (of type
|
1322 |
|
|
`disassemble_info') defined in `include/dis-asm.h' used to pass
|
1323 |
|
|
information to the instruction decoding routine.
|
1324 |
|
|
|
1325 |
|
|
`USE_STRUCT_CONVENTION (GCC_P, TYPE)'
|
1326 |
|
|
If defined, this must be an expression that is nonzero if a value
|
1327 |
|
|
of the given TYPE being returned from a function must have space
|
1328 |
|
|
allocated for it on the stack. GCC_P is true if the function
|
1329 |
|
|
being considered is known to have been compiled by GCC; this is
|
1330 |
|
|
helpful for systems where GCC is known to use different calling
|
1331 |
|
|
convention than other compilers.
|
1332 |
|
|
|
1333 |
|
|
`VALUE_TO_REGISTER(TYPE, REGNUM, FROM, TO)'
|
1334 |
|
|
Convert a value of type TYPE into the raw contents of register
|
1335 |
|
|
REGNUM's. *Note Using Different Register and Memory Data
|
1336 |
|
|
Representations: Target Architecture Definition.
|
1337 |
|
|
|
1338 |
|
|
`VARIABLES_INSIDE_BLOCK (DESC, GCC_P)'
|
1339 |
|
|
For dbx-style debugging information, if the compiler puts variable
|
1340 |
|
|
declarations inside LBRAC/RBRAC blocks, this should be defined to
|
1341 |
|
|
be nonzero. DESC is the value of `n_desc' from the `N_RBRAC'
|
1342 |
|
|
symbol, and GCC_P is true if GDB has noticed the presence of
|
1343 |
|
|
either the `GCC_COMPILED_SYMBOL' or the `GCC2_COMPILED_SYMBOL'.
|
1344 |
|
|
By default, this is 0.
|
1345 |
|
|
|
1346 |
|
|
`OS9K_VARIABLES_INSIDE_BLOCK (DESC, GCC_P)'
|
1347 |
|
|
Similarly, for OS/9000. Defaults to 1.
|
1348 |
|
|
|
1349 |
|
|
Motorola M68K target conditionals.
|
1350 |
|
|
|
1351 |
|
|
`BPT_VECTOR'
|
1352 |
|
|
Define this to be the 4-bit location of the breakpoint trap
|
1353 |
|
|
vector. If not defined, it will default to `0xf'.
|
1354 |
|
|
|
1355 |
|
|
`REMOTE_BPT_VECTOR'
|
1356 |
|
|
Defaults to `1'.
|
1357 |
|
|
|
1358 |
|
|
Adding a New Target
|
1359 |
|
|
===================
|
1360 |
|
|
|
1361 |
|
|
The following files add a target to GDB:
|
1362 |
|
|
|
1363 |
|
|
`gdb/config/ARCH/TTT.mt'
|
1364 |
|
|
Contains a Makefile fragment specific to this target. Specifies
|
1365 |
|
|
what object files are needed for target TTT, by defining
|
1366 |
|
|
`TDEPFILES=...' and `TDEPLIBS=...'. Also specifies the header
|
1367 |
|
|
file which describes TTT, by defining `TM_FILE= tm-TTT.h'.
|
1368 |
|
|
|
1369 |
|
|
You can also define `TM_CFLAGS', `TM_CLIBS', `TM_CDEPS', but these
|
1370 |
|
|
are now deprecated, replaced by autoconf, and may go away in
|
1371 |
|
|
future versions of GDB.
|
1372 |
|
|
|
1373 |
|
|
`gdb/TTT-tdep.c'
|
1374 |
|
|
Contains any miscellaneous code required for this target machine.
|
1375 |
|
|
On some machines it doesn't exist at all. Sometimes the macros in
|
1376 |
|
|
`tm-TTT.h' become very complicated, so they are implemented as
|
1377 |
|
|
functions here instead, and the macro is simply defined to call the
|
1378 |
|
|
function. This is vastly preferable, since it is easier to
|
1379 |
|
|
understand and debug.
|
1380 |
|
|
|
1381 |
|
|
`gdb/ARCH-tdep.c'
|
1382 |
|
|
`gdb/ARCH-tdep.h'
|
1383 |
|
|
This often exists to describe the basic layout of the target
|
1384 |
|
|
machine's processor chip (registers, stack, etc.). If used, it is
|
1385 |
|
|
included by `TTT-tdep.h'. It can be shared among many targets
|
1386 |
|
|
that use the same processor.
|
1387 |
|
|
|
1388 |
|
|
`gdb/config/ARCH/tm-TTT.h'
|
1389 |
|
|
(`tm.h' is a link to this file, created by `configure'). Contains
|
1390 |
|
|
macro definitions about the target machine's registers, stack frame
|
1391 |
|
|
format and instructions.
|
1392 |
|
|
|
1393 |
|
|
New targets do not need this file and should not create it.
|
1394 |
|
|
|
1395 |
|
|
`gdb/config/ARCH/tm-ARCH.h'
|
1396 |
|
|
This often exists to describe the basic layout of the target
|
1397 |
|
|
machine's processor chip (registers, stack, etc.). If used, it is
|
1398 |
|
|
included by `tm-TTT.h'. It can be shared among many targets that
|
1399 |
|
|
use the same processor.
|
1400 |
|
|
|
1401 |
|
|
New targets do not need this file and should not create it.
|
1402 |
|
|
|
1403 |
|
|
If you are adding a new operating system for an existing CPU chip,
|
1404 |
|
|
add a `config/tm-OS.h' file that describes the operating system
|
1405 |
|
|
facilities that are unusual (extra symbol table info; the breakpoint
|
1406 |
|
|
instruction needed; etc.). Then write a `ARCH/tm-OS.h' that just
|
1407 |
|
|
`#include's `tm-ARCH.h' and `config/tm-OS.h'.
|
1408 |
|
|
|
1409 |
|
|
Converting an existing Target Architecture to Multi-arch
|
1410 |
|
|
========================================================
|
1411 |
|
|
|
1412 |
|
|
This section describes the current accepted best practice for
|
1413 |
|
|
converting an existing target architecture to the multi-arch framework.
|
1414 |
|
|
|
1415 |
|
|
The process consists of generating, testing, posting and committing a
|
1416 |
|
|
sequence of patches. Each patch must contain a single change, for
|
1417 |
|
|
instance:
|
1418 |
|
|
|
1419 |
|
|
* Directly convert a group of functions into macros (the conversion
|
1420 |
|
|
does not change the behavior of any of the functions).
|
1421 |
|
|
|
1422 |
|
|
* Replace a non-multi-arch with a multi-arch mechanism (e.g.,
|
1423 |
|
|
`FRAME_INFO').
|
1424 |
|
|
|
1425 |
|
|
* Enable multi-arch level one.
|
1426 |
|
|
|
1427 |
|
|
* Delete one or more files.
|
1428 |
|
|
|
1429 |
|
|
|
1430 |
|
|
There isn't a size limit on a patch, however, a developer is strongly
|
1431 |
|
|
encouraged to keep the patch size down.
|
1432 |
|
|
|
1433 |
|
|
Since each patch is well defined, and since each change has been
|
1434 |
|
|
tested and shows no regressions, the patches are considered _fairly_
|
1435 |
|
|
obvious. Such patches, when submitted by developers listed in the
|
1436 |
|
|
`MAINTAINERS' file, do not need approval. Occasional steps in the
|
1437 |
|
|
process may be more complicated and less clear. The developer is
|
1438 |
|
|
expected to use their judgment and is encouraged to seek advice as
|
1439 |
|
|
needed.
|
1440 |
|
|
|
1441 |
|
|
Preparation
|
1442 |
|
|
-----------
|
1443 |
|
|
|
1444 |
|
|
The first step is to establish control. Build (with `-Werror'
|
1445 |
|
|
enabled) and test the target so that there is a baseline against which
|
1446 |
|
|
the debugger can be compared.
|
1447 |
|
|
|
1448 |
|
|
At no stage can the test results regress or GDB stop compiling with
|
1449 |
|
|
`-Werror'.
|
1450 |
|
|
|
1451 |
|
|
Add the multi-arch initialization code
|
1452 |
|
|
--------------------------------------
|
1453 |
|
|
|
1454 |
|
|
The objective of this step is to establish the basic multi-arch
|
1455 |
|
|
framework. It involves
|
1456 |
|
|
|
1457 |
|
|
* The addition of a `ARCH_gdbarch_init' function(2) that creates the
|
1458 |
|
|
architecture:
|
1459 |
|
|
static struct gdbarch *
|
1460 |
|
|
d10v_gdbarch_init (info, arches)
|
1461 |
|
|
struct gdbarch_info info;
|
1462 |
|
|
struct gdbarch_list *arches;
|
1463 |
|
|
{
|
1464 |
|
|
struct gdbarch *gdbarch;
|
1465 |
|
|
/* there is only one d10v architecture */
|
1466 |
|
|
if (arches != NULL)
|
1467 |
|
|
return arches->gdbarch;
|
1468 |
|
|
gdbarch = gdbarch_alloc (&info, NULL);
|
1469 |
|
|
return gdbarch;
|
1470 |
|
|
}
|
1471 |
|
|
|
1472 |
|
|
__
|
1473 |
|
|
|
1474 |
|
|
* A per-architecture dump function to print any architecture specific
|
1475 |
|
|
information:
|
1476 |
|
|
static void
|
1477 |
|
|
mips_dump_tdep (struct gdbarch *current_gdbarch,
|
1478 |
|
|
struct ui_file *file)
|
1479 |
|
|
{
|
1480 |
|
|
... code to print architecture specific info ...
|
1481 |
|
|
}
|
1482 |
|
|
|
1483 |
|
|
* A change to `_initialize_ARCH_tdep' to register this new
|
1484 |
|
|
architecture:
|
1485 |
|
|
void
|
1486 |
|
|
_initialize_mips_tdep (void)
|
1487 |
|
|
{
|
1488 |
|
|
gdbarch_register (bfd_arch_mips, mips_gdbarch_init,
|
1489 |
|
|
mips_dump_tdep);
|
1490 |
|
|
|
1491 |
|
|
* Add the macro `GDB_MULTI_ARCH', defined as 0 (zero), to the file
|
1492 |
|
|
`config/ARCH/tm-ARCH.h'.
|
1493 |
|
|
|
1494 |
|
|
|
1495 |
|
|
Update multi-arch incompatible mechanisms
|
1496 |
|
|
-----------------------------------------
|
1497 |
|
|
|
1498 |
|
|
Some mechanisms do not work with multi-arch. They include:
|
1499 |
|
|
|
1500 |
|
|
`EXTRA_FRAME_INFO'
|
1501 |
|
|
Delete.
|
1502 |
|
|
|
1503 |
|
|
`FRAME_FIND_SAVED_REGS'
|
1504 |
|
|
Replaced with `FRAME_INIT_SAVED_REGS'
|
1505 |
|
|
|
1506 |
|
|
At this stage you could also consider converting the macros into
|
1507 |
|
|
functions.
|
1508 |
|
|
|
1509 |
|
|
Prepare for multi-arch level to one
|
1510 |
|
|
-----------------------------------
|
1511 |
|
|
|
1512 |
|
|
Temporally set `GDB_MULTI_ARCH' to `GDB_MULTI_ARCH_PARTIAL' and then
|
1513 |
|
|
build and start GDB (the change should not be committed). GDB may not
|
1514 |
|
|
build, and once built, it may die with an internal error listing the
|
1515 |
|
|
architecture methods that must be provided.
|
1516 |
|
|
|
1517 |
|
|
Fix any build problems (patch(es)).
|
1518 |
|
|
|
1519 |
|
|
Convert all the architecture methods listed, which are only macros,
|
1520 |
|
|
into functions (patch(es)).
|
1521 |
|
|
|
1522 |
|
|
Update `ARCH_gdbarch_init' to set all the missing architecture
|
1523 |
|
|
methods and wrap the corresponding macros in `#if !GDB_MULTI_ARCH'
|
1524 |
|
|
(patch(es)).
|
1525 |
|
|
|
1526 |
|
|
Set multi-arch level one
|
1527 |
|
|
------------------------
|
1528 |
|
|
|
1529 |
|
|
Change the value of `GDB_MULTI_ARCH' to GDB_MULTI_ARCH_PARTIAL (a
|
1530 |
|
|
single patch).
|
1531 |
|
|
|
1532 |
|
|
Any problems with throwing "the switch" should have been fixed
|
1533 |
|
|
already.
|
1534 |
|
|
|
1535 |
|
|
Convert remaining macros
|
1536 |
|
|
------------------------
|
1537 |
|
|
|
1538 |
|
|
Suggest converting macros into functions (and setting the
|
1539 |
|
|
corresponding architecture method) in small batches.
|
1540 |
|
|
|
1541 |
|
|
Set multi-arch level to two
|
1542 |
|
|
---------------------------
|
1543 |
|
|
|
1544 |
|
|
This should go smoothly.
|
1545 |
|
|
|
1546 |
|
|
Delete the TM file
|
1547 |
|
|
------------------
|
1548 |
|
|
|
1549 |
|
|
The `tm-ARCH.h' can be deleted. `ARCH.mt' and `configure.in'
|
1550 |
|
|
updated.
|
1551 |
|
|
|
1552 |
|
|
---------- Footnotes ----------
|
1553 |
|
|
|