This page was produced by an automated import process, and may have formatting errors; feel free to fix.

How an Architecture is Represented

Each gdbarch is associated with a single BFD architecture, via a bfd_arch_''arch'' in the bfd_architecture enumeration. The gdbarch is registered by a call to register_gdbarch_init, usually from the file’s _initialize_''filename'' routine, which will be automatically called during GDB startup. The arguments are a BFD architecture constant and an initialization function.

A GDB description for a new architecture, arch is created by defining a global function _initialize_''arch''_tdep, by convention in the source file ''arch''-tdep.c. For example, in the case of the OpenRISC 1000, this function is called _initialize_or1k_tdep and is found in the file or1k-tdep.c.

The resulting object files containing the implementation of the _initialize_''arch''_tdep function are specified in the GDB configure.tgt file, which includes a large case statement pattern matching against the --target option of the configure script. The new struct gdbarch is created within the _initialize_''arch''_tdep function by calling gdbarch_register:

void gdbarch_register (enum bfd_architecture    ''architecture'',
                       gdbarch_init_ftype      *''init_func'',
                       gdbarch_dump_tdep_ftype *''tdep_dump_func'');

The architecture will identify the unique BFD to be associated with this gdbarch. The init_func funciton is called to create and return the new struct gdbarch. The tdep_dump_func function will dump the target specific details associated with this architecture.

For example the function _initialize_or1k_tdep creates its architecture for 32-bit OpenRISC 1000 architectures by calling:

gdbarch_register (bfd_arch_or32, or1k_gdbarch_init, or1k_dump_tdep);

None: Internals How-an-Architecture-is-Represented (last edited 2013-08-20 23:40:54 by StanShebs)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.