If no architecture is found, then a new architecture must be
created, by calling gdbarch_alloc
using the
supplied struct gdbarch_info and and any additional custom target specific
information in a struct gdbarch_tdep.
The newly created struct gdbarch must then be populated. Although there are
default values, in most cases they are not what is required. For each
element, X, there is a corresponding accessor
function to set the value of that element,
set_gdbarch_X
.
The following sections identify the main elements that should be set
in this way. This is not the complete list, but represents the
functions and elements that must commonly be specified for a new
architecture. Many of the functions are described in the header file,
gdbarch.h
and many may be found in the GDB
Internals document [4].
struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
struct gdbarch_tdep is not defined within GDB—it is up to the
user to define this struct
if it is needed to
hold custom target information that is not covered by the standard
struct gdbarch. For example with the OpenRISC 1000 architecture it is
used to hold the number of matchpoints available in the target
(along with other information). If there is no additional target
specific information, it can be set to NULL
.