The first argument to the architecture initialization function is a
struct gdbarch_info containing all the known information about this
architecture (deduced from the BFD enumeration provided to
gdbarch_register
). The second argument is a list
of the currently defined architectures within GDB.
The lookup is done using
gdbarch_list_lookup_by_info
. It is passed the
list of existing architectures and the struct gdbarch_info (possibly
updated) and returns the first matching architecture it finds, or
NULL
if none are found. If an architecture is found, the
initialization function can finish, returning the found architecture
as result.
The struct gdbarch_info has the following components:
struct gdbarch_info { const struct bfd_arch_info *bfd_arch_info; int byte_order; bfd *abfd; struct gdbarch_tdep_info *tdep_info; enum gdb_osabi osabi; const struct target_desc *target_desc; };
bfd_arch_info
holds the key details about the
architecture. byte_order
is an enumeration
indicating the endianism. abfd
is a pointer to
the full BFD, tdep_info
is additional custom
target specific information, gdb_osabi
is an
enumeration identifying which (if any) of a number of operating
specific ABIs are used by this architecture and
target_desc
is a set of name-value pairs with
information about register usage in this target.
When the struct gdbarch initialization function is called, not all the
fields are provided—only those which can be deduced from the
BFD. The struct gdbarch_info is used as a look-up key with the list of
existing architectures (the second argument to the initialization
function) to see if a suitable architecture already exists. The
tdep_info
osabi
and
target_desc
fields may be added before this
lookup to refine the search.