Node:Target Architecture Definition, Next:Target Vector Definition, Previous:Host Definition, Up:Top
The target architecture object is implemented as the C structure
struct gdbarch *
. The structure, and its methods, are generated
using the Bourne shell script gdbarch.sh
.
REGISTER_NAME
and related macros.
GDB can handle big-endian, little-endian, and bi-endian architectures.
On almost all 32-bit architectures, the representation of a pointer is indistinguishable from the representation of some fixed-length number whose value is the byte address of the object pointed to. On such machines, the words "pointer" and "address" can be used interchangeably. However, architectures with smaller word sizes are often cramped for address space, so they may choose a pointer representation that breaks this identity, and allows a larger code address space.
For example, the Mitsubishi D10V is a 16-bit VLIW processor whose instructions are 32 bits long1. If the D10V used ordinary byte addresses to refer to code locations, then the processor would only be able to address 64kb of instructions. However, since instructions must be aligned on four-byte boundaries, the low two bits of any valid instruction's byte address are always zero--byte addresses waste two bits. So instead of byte addresses, the D10V uses word addresses--byte addresses shifted right two bits--to refer to code. Thus, the D10V can use 16-bit words to address 256kb of code space.
However, this means that code pointers and data pointers have different
forms on the D10V. The 16-bit word 0xC020
refers to byte address
0xC020
when used as a data address, but refers to byte address
0x30080
when used as a code address.
(The D10V also uses separate code and data address spaces, which also affects the correspondence between pointers and addresses, but we're going to ignore that here; this example is already too long.)
To cope with architectures like this--the D10V is not the only
one!--GDB tries to distinguish between addresses, which are
byte numbers, and pointers, which are the target's representation
of an address of a particular type of data. In the example above,
0xC020
is the pointer, which refers to one of the addresses
0xC020
or 0x30080
, depending on the type imposed upon it.
GDB provides functions for turning a pointer into an address
and vice versa, in the appropriate way for the current architecture.
Unfortunately, since addresses and pointers are identical on almost all processors, this distinction tends to bit-rot pretty quickly. Thus, each time you port GDB to an architecture which does distinguish between pointers and addresses, you'll probably need to clean up some architecture-independent code.
Here are functions which convert between pointers and addresses:
CORE_ADDR extract_typed_address (void *buf, struct type *type) | Function |
Treat the bytes at buf as a pointer or reference of type
type, and return the address it represents, in a manner
appropriate for the current architecture. This yields an address
GDB can use to read target memory, disassemble, etc. Note that
buf refers to a buffer in GDB's memory, not the
inferior's.
For example, if the current architecture is the Intel x86, this function extracts a little-endian integer of the appropriate length from buf and returns it. However, if the current architecture is the D10V, this function will return a 16-bit integer extracted from buf, multiplied by four if type is a pointer to a function. If type is not a pointer or reference type, then this function will signal an internal error. |
CORE_ADDR store_typed_address (void *buf, struct type *type, CORE_ADDR addr) | Function |
Store the address addr in buf, in the proper format for a
pointer of type type in the current architecture. Note that
buf refers to a buffer in GDB's memory, not the
inferior's.
For example, if the current architecture is the Intel x86, this function stores addr unmodified as a little-endian integer of the appropriate length in buf. However, if the current architecture is the D10V, this function divides addr by four if type is a pointer to a function, and then stores it in buf. If type is not a pointer or reference type, then this function will signal an internal error. |
CORE_ADDR value_as_address (struct value *val) | Function |
Assuming that val is a pointer, return the address it represents,
as appropriate for the current architecture.
This function actually works on integral values, as well as pointers.
For pointers, it performs architecture-specific conversions as
described above for |
CORE_ADDR value_from_pointer (struct type *type, CORE_ADDR addr) | Function |
Create and return a value representing a pointer of type type to
the address addr, as appropriate for the current architecture.
This function performs architecture-specific conversions as described
above for store_typed_address .
|
CORE_ADDR extract_address (void *addr, int len) | Function |
Extract a len-byte number from addr in the appropriate
endianness for the current architecture, and return it. Note that
addr refers to GDB's memory, not the inferior's.
This function should only be used in architecture-specific code; it
doesn't have enough information to turn bits into a true address in the
appropriate way for the current architecture. If you can, use
|
void store_address (void *addr, int len, LONGEST val) | Function |
Store val at addr as a len-byte integer, in the
appropriate endianness for the current architecture. Note that
addr refers to a buffer in GDB's memory, not the
inferior's.
This function should only be used in architecture-specific code; it
doesn't have enough information to turn a true address into bits in the
appropriate way for the current architecture. If you can, use
|
Here are some macros which architectures can define to indicate the relationship between pointers and addresses. These have default definitions, appropriate for architectures on which all pointers are simple unsigned byte addresses.
CORE_ADDR POINTER_TO_ADDRESS (struct type *type, char *buf) | Target Macro |
Assume that buf holds a pointer of type type, in the
appropriate format for the current architecture. Return the byte
address the pointer refers to.
This function may safely assume that type is either a pointer or a C++ reference type. |
void ADDRESS_TO_POINTER (struct type *type, char *buf, CORE_ADDR addr) | Target Macro |
Store in buf a pointer of type type representing the address
addr, in the appropriate format for the current architecture.
This function may safely assume that type is either a pointer or a C++ reference type. |
Maintainer's note: The way GDB manipulates registers is undergoing
significant change. Many of the macros and functions refered to in the
sections below are likely to be made obsolete. See the file TODO
for more up-to-date information.
Some architectures use one representation for a value when it lives in a
register, but use a different representation when it lives in memory.
In GDB's terminology, the raw representation is the one used in
the target registers, and the virtual representation is the one
used in memory, and within GDB struct value
objects.
For almost all data types on almost all architectures, the virtual and raw representations are identical, and no special handling is needed. However, they do occasionally differ. For example:
long double
type. However, when
we store those values in memory, they occupy twelve bytes: the
floating-point number occupies the first ten, and the final two bytes
are unused. This keeps the values aligned on four-byte boundaries,
allowing more efficient access. Thus, the x86 80-bit floating-point
type is the raw representation, and the twelve-byte loosely-packed
arrangement is the virtual representation.
In general, the raw representation is determined by the architecture, or
GDB's interface to the architecture, while the virtual representation
can be chosen for GDB's convenience. GDB's register file,
registers
, holds the register contents in raw format, and the
GDB remote protocol transmits register values in raw format.
Your architecture may define the following macros to request conversions between the raw and virtual format:
int REGISTER_CONVERTIBLE (int reg) | Target Macro |
Return non-zero if register number reg's value needs different raw
and virtual formats.
You should not use |
int REGISTER_RAW_SIZE (int reg) | Target Macro |
The size of register number reg's raw value. This is the number
of bytes the register will occupy in registers , or in a GDB
remote protocol packet.
|
int REGISTER_VIRTUAL_SIZE (int reg) | Target Macro |
The size of register number reg's value, in its virtual format.
This is the size a struct value 's buffer will have, holding that
register's value.
|
struct type *REGISTER_VIRTUAL_TYPE (int reg) | Target Macro |
This is the type of the virtual representation of register number reg. Note that there is no need for a macro giving a type for the register's raw form; once the register's value has been obtained, GDB always uses the virtual form. |
void REGISTER_CONVERT_TO_VIRTUAL (int reg, struct type *type, char *from, char *to) | Target Macro |
Convert the value of register number reg to type, which
should always be REGISTER_VIRTUAL_TYPE ( reg) . The buffer
at from holds the register's value in raw format; the macro should
convert the value to virtual format, and place it at to.
Note that You should only use |
void REGISTER_CONVERT_TO_RAW (struct type *type, int reg, char *from, char *to) | Target Macro |
Convert the value of register number reg to type, which
should always be REGISTER_VIRTUAL_TYPE ( reg) . The buffer
at from holds the register's value in raw format; the macro should
convert the value to virtual format, and place it at to.
Note that REGISTER_CONVERT_TO_VIRTUAL and REGISTER_CONVERT_TO_RAW take their reg and type arguments in different orders. |
This section describes the macros that you can use to define the target machine.
ADDITIONAL_OPTIONS
ADDITIONAL_OPTION_CASES
ADDITIONAL_OPTION_HANDLER
ADDITIONAL_OPTION_HELP
ADDR_BITS_REMOVE (addr)
For example, the two low-order bits of the PC on the Hewlett-Packard PA
2.0 architecture contain the privilege level of the corresponding
instruction. Since instructions must always be aligned on four-byte
boundaries, the processor masks out these bits to generate the actual
address of the instruction. ADDR_BITS_REMOVE should filter out these
bits with an expression such as ((addr) & ~3)
.
ADDRESS_TO_POINTER (
type,
buf,
addr)
BEFORE_MAIN_LOOP_HOOK
BELIEVE_PCC_PROMOTION
short
or char
parameter to an int
, but still reports the parameter as its
original type, rather than the promoted type.
BELIEVE_PCC_PROMOTION_TYPE
short
argument when compiled by pcc
, but look within a full int space to get
its value. Only defined for Sun-3 at present.
BITS_BIG_ENDIAN
BREAKPOINT
BREAKPOINT
has been deprecated in favor of
BREAKPOINT_FROM_PC
.
BIG_BREAKPOINT
LITTLE_BREAKPOINT
BIG_BREAKPOINT
and LITTLE_BREAKPOINT
have been deprecated in
favor of BREAKPOINT_FROM_PC
.
REMOTE_BREAKPOINT
LITTLE_REMOTE_BREAKPOINT
BIG_REMOTE_BREAKPOINT
BIG_REMOTE_BREAKPOINT
and LITTLE_REMOTE_BREAKPOINT
have been
deprecated in favor of BREAKPOINT_FROM_PC
.
BREAKPOINT_FROM_PC (
pcptr,
lenptr)
Although it is common to use a trap instruction for a breakpoint, it's not required; for instance, the bit pattern could be an invalid instruction. The breakpoint must be no longer than the shortest instruction of the architecture.
Replaces all the other BREAKPOINT macros.
MEMORY_INSERT_BREAKPOINT (
addr,
contents_cache)
MEMORY_REMOVE_BREAKPOINT (
addr,
contents_cache)
default_memory_insert_breakpoint
and
default_memory_remove_breakpoint
respectively) have been
provided so that it is not necessary to define these for most
architectures. Architectures which may want to define
MEMORY_INSERT_BREAKPOINT
and MEMORY_REMOVE_BREAKPOINT
will
likely have instructions that are oddly sized or are not stored in a
conventional manner.
It may also be desirable (from an efficiency standpoint) to define
custom breakpoint insertion and removal routines if
BREAKPOINT_FROM_PC
needs to read the target's memory for some
reason.
CALL_DUMMY_P
CALL_DUMMY_WORDS
LONGEST
words of data containing
host-byte-ordered REGISTER_BYTES
sized values that partially
specify the sequence of instructions needed for an inferior function
call.
Should be deprecated in favor of a macro that uses target-byte-ordered
data.
SIZEOF_CALL_DUMMY_WORDS
CALL_DUMMY_WORDS
. When CALL_DUMMY_P
this must
return a positive value. See also CALL_DUMMY_LENGTH
.
CALL_DUMMY
CALL_DUMMY_WORDS
. Deprecated.
CALL_DUMMY_LOCATION
inferior.h
.
CALL_DUMMY_STACK_ADJUST
Should be deprecated in favor of something like STACK_ALIGN
.
CALL_DUMMY_STACK_ADJUST_P
CALL_DUMMY_STACK_ADJUST
.
Should be deprecated in favor of something like STACK_ALIGN
.
CANNOT_FETCH_REGISTER (
regno)
FETCH_INFERIOR_REGISTERS
is not defined.
CANNOT_STORE_REGISTER (
regno)
DO_DEFERRED_STORES
CLEAR_DEFERRED_STORES
Currently only implemented correctly for native Sparc configurations?
COERCE_FLOAT_TO_DOUBLE (
formal,
actual)
float
values to
double
when calling a non-prototyped function. The argument
actual is the type of the value we want to pass to the function.
The argument formal is the type of this argument, as it appears in
the function's definition. Note that formal may be zero if we
have no debugging information for the function, or if we're passing more
arguments than are officially declared (for example, varargs). This
macro is never invoked if the function definitely has a prototype.
How you should pass arguments to a function depends on whether it was
defined in K&R style or prototype style. If you define a function using
the K&R syntax that takes a float
argument, then callers must
pass that argument as a double
. If you define the function using
the prototype syntax, then you must pass the argument as a float
,
with no promotion.
Unfortunately, on certain older platforms, the debug info doesn't
indicate reliably how each function was defined. A function type's
TYPE_FLAG_PROTOTYPED
flag may be unset, even if the function was
defined in prototype style. When calling a function whose
TYPE_FLAG_PROTOTYPED
flag is unset, GDB consults the
COERCE_FLOAT_TO_DOUBLE
macro to decide what to do.
For modern targets, it is proper to assume that, if the prototype flag
is unset, that can be trusted: float
arguments should be promoted
to double
. You should use the function
standard_coerce_float_to_double
to get this behavior.
For some older targets, if the prototype flag is unset, that doesn't
tell us anything. So we guess that, if we don't have a type for the
formal parameter (i.e., the first argument to
COERCE_FLOAT_TO_DOUBLE
is null), then we should promote it;
otherwise, we should leave it alone. The function
default_coerce_float_to_double
provides this behavior; it is the
default value, for compatibility with older configurations.
CPLUS_MARKER
'$'
. Most System V targets should
define this to '.'
.
DBX_PARM_SYMBOL_CLASS
SYMBOL_CLASS
of a parameter when decoding DBX symbol
information. In the i960, parameters can be stored as locals or as
args, depending on the type of the debug record.
DECR_PC_AFTER_BREAK
BREAKPOINT
, though not always. For most targets this value will be 0.
DECR_PC_AFTER_HW_BREAK
DISABLE_UNSETTABLE_BREAK (
addr)
DO_REGISTERS_INFO
PRINT_FLOAT_INFO()
info float
command will print information about
the processor's floating point unit.
DWARF_REG_TO_REGNUM
DWARF2_REG_TO_REGNUM
ECOFF_REG_TO_REGNUM
END_OF_TEXT_DEFAULT
EXTRACT_RETURN_VALUE(
type,
regbuf,
valbuf)
EXTRACT_STRUCT_VALUE_ADDRESS(
regbuf)
CORE_ADDR
at which a function should return
its structure value.
If not defined, EXTRACT_RETURN_VALUE
is used.
EXTRACT_STRUCT_VALUE_ADDRESS_P()
EXTRACT_STRUCT_VALUE_ADDRESS
.
FLOAT_INFO
PRINT_FLOAT_INFO
.
FP_REGNUM
This should only need to be defined if TARGET_READ_FP
and
TARGET_WRITE_FP
are not defined.
FRAMELESS_FUNCTION_INVOCATION(
fi)
FRAME_ARGS_ADDRESS_CORRECT
stack.c
.
FRAME_CHAIN(
frame)
FRAME_CHAIN_COMBINE(
chain,
frame)
FRAME_CHAIN_VALID(
chain,
thisframe)
file_frame_chain_valid
is nonzero if the chain pointer is nonzero
and given frame's PC is not inside the startup file (such as
crt0.o
).
func_frame_chain_valid
is nonzero if the chain
pointer is nonzero and the given frame's PC is not in main
or a
known entry point function (such as _start
).
generic_file_frame_chain_valid
and
generic_func_frame_chain_valid
are equivalent implementations for
targets using generic dummy frames.
FRAME_INIT_SAVED_REGS(
frame)
frame.h
. Determines the address of all registers in the
current stack frame storing each in frame->saved_regs
. Space for
frame->saved_regs
shall be allocated by
FRAME_INIT_SAVED_REGS
using either
frame_saved_regs_zalloc
or frame_obstack_alloc
.
FRAME_FIND_SAVED_REGS
and EXTRA_FRAME_INFO
are deprecated.
FRAME_NUM_ARGS (
fi)
-1
.
FRAME_SAVED_PC(
frame)
FUNCTION_EPILOGUE_SIZE
x_sym.x_misc.x_fsize
field of the
function end symbol is 0. For such targets, you must define
FUNCTION_EPILOGUE_SIZE
to expand into the standard size of a
function's epilogue.
FUNCTION_START_OFFSET
This is zero on almost all machines: the function's address is usually
the address of its first instruction. However, on the VAX, for example,
each function starts with two bytes containing a bitmask indicating
which registers to save upon entry to the function. The VAX call
instructions check this value, and save the appropriate registers
automatically. Thus, since the offset from the function's address to
its first instruction is two bytes, FUNCTION_START_OFFSET
would
be 2 on the VAX.
GCC_COMPILED_FLAG_SYMBOL
GCC2_COMPILED_FLAG_SYMBOL
gcc_compiled.
and gcc2_compiled.
,
respectively. (Currently only defined for the Delta 68.)
GDB_MULTI_ARCH
This support can be enabled at two levels. At level one, only
definitions for previously undefined macros are provided; at level two,
a multi-arch definition of all architecture dependant macros will be
defined.
GDB_TARGET_IS_HPPA
dbxread.c
and
partial-stab.h
is used to mangle multiple-symbol-table files from
HPPA's. This should all be ripped out, and a scheme like elfread.c
used instead.
GET_LONGJMP_TARGET
setjmp.h
is needed to define it.
This macro determines the target PC address that longjmp
will jump to,
assuming that we have just stopped at a longjmp
breakpoint. It takes a
CORE_ADDR *
as argument, and stores the target PC value through this
pointer. It examines the current state of the machine as needed.
GET_SAVED_REGISTER
get_saved_register
.
HAVE_REGISTER_WINDOWS
REGISTER_IN_WINDOW_P (
regnum)
IBM6000_TARGET
I386_USE_GENERIC_WATCHPOINTS
SYMBOLS_CAN_START_WITH_DOLLAR
$
. Giving this
macro a non-zero value tells GDB's expression parser to check for such
routines when parsing tokens that begin with $
.
On HP-UX, certain system routines (millicode) have names beginning with
$
or $$
. For example, $$dyncall
is a millicode
routine that handles inter-space procedure calls on PA-RISC.
INIT_EXTRA_FRAME_INFO (
fromleaf,
frame)
frame->extra_info
. Space for frame->extra_info
is allocated using frame_obstack_alloc
.
INIT_FRAME_PC (
fromleaf,
prev)
INNER_THAN (
lhs,
rhs)
lhs < rhs
if
the target's stack grows downward in memory, or lhs > rsh
if the
stack grows upward.
gdbarch_in_function_epilogue_p (
gdbarch,
pc)
IN_SIGTRAMP (
pc,
name)
sigtramp
.
SIGTRAMP_START (
pc)
SIGTRAMP_END (
pc)
sigtramp
for the
given pc. On machines where the address is just a compile time
constant, the macro expansion will typically just ignore the supplied
pc.
IN_SOLIB_CALL_TRAMPOLINE (
pc,
name)
IN_SOLIB_RETURN_TRAMPOLINE (
pc,
name)
IN_SOLIB_DYNSYM_RESOLVE_CODE (
pc)
SKIP_SOLIB_RESOLVER (
pc)
INTEGER_TO_ADDRESS (
type,
buf)
Pragmatics: When the user copies a well defined expression from
their source code and passes it, as a parameter, to GDB's
print
command, they should get the same value as would have been
computed by the target program. Any deviation from this rule can cause
major confusion and annoyance, and needs to be justified carefully. In
other words, GDB doesn't really have the freedom to do these
conversions in clever and useful ways. It has, however, been pointed
out that users aren't complaining about how GDB casts integers
to pointers; they are complaining that they can't take an address from a
disassembly listing and give it to x/i
. Adding an architecture
method like INTEGER_TO_ADDRESS
certainly makes it possible for
GDB to "get it right" in all circumstances.
IS_TRAPPED_INTERNALVAR (
name)
NEED_TEXT_START_END
NO_HIF_SUPPORT
POINTER_TO_ADDRESS (
type,
buf)
REGISTER_CONVERTIBLE (
reg)
REGISTER_RAW_SIZE (
reg)
REGISTER_VIRTUAL_SIZE (
reg)
REGISTER_VIRTUAL_TYPE (
reg)
REGISTER_CONVERT_TO_VIRTUAL(
reg,
type,
from,
to)
REGISTER_CONVERT_TO_RAW(
type,
reg,
from,
to)
RETURN_VALUE_ON_STACK(
type)
Return non-zero if values of type TYPE are returned on the stack, using
the "struct convention" (i.e., the caller provides a pointer to a
buffer in which the callee should store the return value). This
controls how the finish
command finds a function's return value,
and whether an inferior function call reserves space on the stack for
the return value.
The full logic GDB uses here is kind of odd.
RETURN_VALUE_ON_STACK
returns zero, then GDB
concludes the value is not returned using the struct convention.
USE_STRUCT_CONVENTION
(see below).
If that returns non-zero, GDB assumes the struct convention is
in use.
In other words, to indicate that a given type is returned by value using
the struct convention, that type must be either a struct, union, array,
or something RETURN_VALUE_ON_STACK
likes, and something
that USE_STRUCT_CONVENTION
likes.
Note that, in C and C++, arrays are never returned by value. In those
languages, these predicates will always see a pointer type, never an
array type. All the references above to arrays being returned by value
apply only to other languages.
SOFTWARE_SINGLE_STEP_P()
SOFTWARE_SINGLE_STEP
must also be defined.
SOFTWARE_SINGLE_STEP(
signal,
insert_breapoints_p)
sparc-tdep.c
and rs6000-tdep.c
for examples.
SOFUN_ADDRESS_MAYBE_MISSING
SOFUN_ADDRESS_MAYBE_MISSING
indicates that a particular set of
hacks of this sort are in use, affecting N_SO
and N_FUN
entries in stabs-format debugging information. N_SO
stabs mark
the beginning and ending addresses of compilation units in the text
segment. N_FUN
stabs mark the starts and ends of functions.
SOFUN_ADDRESS_MAYBE_MISSING
means two things:
N_FUN
stabs have an address of zero. Instead, you should find the
addresses where the function starts by taking the function name from
the stab, and then looking that up in the minsyms (the
linker/assembler symbol table). In other words, the stab has the
name, and the linker/assembler symbol table is the only place that carries
the address.
N_SO
stabs have an address of zero, too. You just look at the
N_FUN
stabs that appear before and after the N_SO
stab,
and guess the starting and ending addresses of the compilation unit from
them.
PCC_SOL_BROKEN
PC_IN_CALL_DUMMY
inferior.h
.
PC_LOAD_SEGMENT
PC_REGNUM
This should only need to be defined if TARGET_READ_PC
and
TARGET_WRITE_PC
are not defined.
NPC_REGNUM
NNPC_REGNUM
PARM_BOUNDARY
PRINT_REGISTER_HOOK (
regno)
PRINT_TYPELESS_INTEGER
print_longest
that seems to
have been defined for the Convex target.
PROCESS_LINENUMBER_HOOK
PROLOGUE_FIRSTLINE_OVERLAP
PS_REGNUM
POP_FRAME
call_function_by_hand
to remove an artificial stack
frame and in return_command
to remove a real stack frame.
PUSH_ARGUMENTS (
nargs,
args,
sp,
struct_return,
struct_addr)
PUSH_DUMMY_FRAME
call_function_by_hand
to create an artificial stack frame.
REGISTER_BYTES
REGISTER_NAME(
i)
NULL
or NUL
to indicate that register i is not valid.
REGISTER_NAMES
REGISTER_NAME
.
REG_STRUCT_HAS_ADDR (
gcc_p,
type)
SAVE_DUMMY_FRAME_TOS (
sp)
call_function_by_hand
to notify the target dependent code
of the top-of-stack value that will be passed to the the inferior code.
This is the value of the SP
after both the dummy frame and space
for parameters/results have been allocated on the stack.
SDB_REG_TO_REGNUM
SHIFT_INST_REGS
SKIP_PERMANENT_BREAKPOINT
SKIP_PERMANENT_BREAKPOINT
adjusts the processor's
state so that execution will resume just after the breakpoint. This
macro does the right thing even when the breakpoint is in the delay slot
of a branch or jump.
SKIP_PROLOGUE (
pc)
SKIP_PROLOGUE_FRAMELESS_P
SKIP_PROLOGUE
will be used instead.
SKIP_TRAMPOLINE_CODE (
pc)
SP_REGNUM
This should only need to be defined if TARGET_WRITE_SP
and
TARGET_WRITE_SP
are not defined.
STAB_REG_TO_REGNUM
STACK_ALIGN (
addr)
STEP_SKIPS_DELAY (
addr)
STORE_RETURN_VALUE (
type,
valbuf)
SUN_FIXED_LBRAC_BUG
SYMBOL_RELOADING_DEFAULT
TARGET_CHAR_BIT
TARGET_CHAR_SIGNED
char
is normally signed on this architecture; zero if
it should be unsigned.
The ISO C standard requires the compiler to treat char
as
equivalent to either signed char
or unsigned char
; any
character in the standard execution set is supposed to be positive.
Most compilers treat char
as signed, but char
is unsigned
on the IBM S/390, RS6000, and PowerPC targets.
TARGET_COMPLEX_BIT
2 * TARGET_FLOAT_BIT
.
At present this macro is not used.
TARGET_DOUBLE_BIT
8 * TARGET_CHAR_BIT
.
TARGET_DOUBLE_COMPLEX_BIT
2 * TARGET_DOUBLE_BIT
.
At present this macro is not used.
TARGET_FLOAT_BIT
4 * TARGET_CHAR_BIT
.
TARGET_INT_BIT
4 * TARGET_CHAR_BIT
.
TARGET_LONG_BIT
4 * TARGET_CHAR_BIT
.
TARGET_LONG_DOUBLE_BIT
2 * TARGET_DOUBLE_BIT
.
TARGET_LONG_LONG_BIT
2 * TARGET_LONG_BIT
.
TARGET_PTR_BIT
TARGET_INT_BIT
.
TARGET_SHORT_BIT
2 * TARGET_CHAR_BIT
.
TARGET_READ_PC
TARGET_WRITE_PC (
val,
pid)
TARGET_READ_SP
TARGET_WRITE_SP
TARGET_READ_FP
TARGET_WRITE_FP
read_pc
, write_pc
,
read_sp
, write_sp
, read_fp
and write_fp
.
For most targets, these may be left undefined. GDB will call the read
and write register functions with the relevant _REGNUM
argument.
These macros are useful when a target keeps one of these registers in a
hard to get at place; for example, part in a segment register and part
in an ordinary register.
TARGET_VIRTUAL_FRAME_POINTER(
pc,
regp,
offsetp)
(register, offset)
pair representing the virtual
frame pointer in use at the code address pc. If virtual
frame pointers are not used, a default definition simply returns
FP_REGNUM
, with an offset of zero.
TARGET_HAS_HARDWARE_WATCHPOINTS
TARGET_PRINT_INSN (
addr,
info)
tm_print_insn
. This
usually points to a function in the opcodes
library (see Opcodes). info is a structure (of type
disassemble_info
) defined in include/dis-asm.h
used to
pass information to the instruction decoding routine.
USE_STRUCT_CONVENTION (
gcc_p,
type)
VARIABLES_INSIDE_BLOCK (
desc,
gcc_p)
n_desc
from the
N_RBRAC
symbol, and gcc_p is true if GDB has noticed the
presence of either the GCC_COMPILED_SYMBOL
or the
GCC2_COMPILED_SYMBOL
. By default, this is 0.
OS9K_VARIABLES_INSIDE_BLOCK (
desc,
gcc_p)
Motorola M68K target conditionals.
BPT_VECTOR
0xf
.
REMOTE_BPT_VECTOR
1
.
The following files add a target to GDB:
gdb/config/
arch/
ttt.mt
TDEPFILES=...
and TDEPLIBS=...
. Also specifies
the header file which describes ttt, by defining TM_FILE=
tm-
ttt.h
.
You can also define TM_CFLAGS
, TM_CLIBS
, TM_CDEPS
,
but these are now deprecated, replaced by autoconf, and may go away in
future versions of GDB.
gdb/
ttt-tdep.c
tm-
ttt.h
become very complicated, so they are implemented
as functions here instead, and the macro is simply defined to call the
function. This is vastly preferable, since it is easier to understand
and debug.
gdb/
arch-tdep.c
gdb/
arch-tdep.h
ttt-tdep.h
. It can be shared among many targets that use
the same processor.
gdb/config/
arch/tm-
ttt.h
tm.h
is a link to this file, created by configure
). Contains
macro definitions about the target machine's registers, stack frame
format and instructions.
New targets do not need this file and should not create it.
gdb/config/
arch/tm-
arch.h
tm-
ttt.h
. It can be shared among many targets that use the
same processor.
New targets do not need this file and should not create it.
If you are adding a new operating system for an existing CPU chip, add a
config/tm-
os.h
file that describes the operating system
facilities that are unusual (extra symbol table info; the breakpoint
instruction needed; etc.). Then write a arch
/tm-
os.h
that just #include
s tm-
arch.h
and
config/tm-
os.h
.