A set of function members of struct gdbarch define aspects of the architecture and its ABI. For some of these functions, defaults are provided which will be suitable for most architectures.
return_value
. This function determines the
return convention for a given data type. For example on the
OpenRISC 1000, structs/unions and large (>32 bit) scalars are
returned as references, while small scalars are returned in
GPR 11. This function should always be defined.
breakpoint_from_pc
. Returns the breakpoint
instruction to be used when the PC is at a particular location
in memory. For architectures with variable length instructions,
the choice of breakpoint instruction may depend on the length of
the instruction at the program counter. Returns the instruction
sequence and its length.
The default value is NULL
(undefined). This function should
always be defined if GDB is to support breakpointing for this
architecture.
adjust_breakpoint_address
. Some
architectures do not allow breakpoints to be placed at all
points. Given a program counter, this function returns an
address where a breakpoint can be
placed. Default value is NULL
(undefined). The function need
only be defined for architectures which cannot accept a
breakpoint at all program counter locations.
memory_insert_breakpoint
and
memory_remove_breakpoint
. These functions
insert or remove memory based (a.k.a. soft) breakpoints. The
default values
default_memory_insert_breakpoint
and
default_memory_remove_breakpoint
are
suitable for most architectures, so in most cases these
functions need not be defined.
decr_pc_after_break
. Some architectures
require the program counter to be decremented after a break, to
allow the broken instruction to be executed on resumption. This
function returns the number of bytes by which to decrement the
address. The default value is NULL
(undefined) which means the
program counter is left unchanged. This function need only be
defined if the functionality is required.
In practice this function is only of use for the very simplest
architectures. It applies only to software breakpoints, not
watchpoints or hardware breakpoints. It is more usual to adjust
the program counter as required in the target
to_wait
and to_resume
functions (see Section 2.4).
single_step_through_delay
. Returns 1 if the
target is executing a delay slot and a further single step is
needed before the instruction finishes. The default value is
NULL
(not defined). This function should be implemented if the
target has delay slots.
print_insn
. Disassemble an instruction and
print it. Default value is NULL
(undefined). This function
should be defined if disassembly of code is to be supported.
Disassembly is a function required by the
binutils library. This function is
defined in the opcodes
sub-directory. A
suitable implementation may already exist if
binutils has already been ported.