This page was produced by an automated import process, and may have formatting errors; feel free to fix.
Adding a New Target
The following files add a target to GDB:
Contains any miscellaneous code required for this target machine. On some machines it doesn’t exist at all.
This is required to describe the basic layout of the target machine’s processor chip (registers, stack, etc.). It can be shared among many targets that use the same processor architecture.
(Target header files such as gdb/config/''arch''/tm-''ttt''.h, gdb/config/''arch''/tm-''arch''.h, and config/tm-''os''.h are no longer used.)
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 object file resulting from compiling this source file, which will contain the implementation of the _initialize_''arch''_tdep function is specified in the GDB configure.tgt file, which includes a large case statement pattern matching against the --target option of the configure script.
Note: If the architecture requires multiple source files, the corresponding binaries should be included in configure.tgt. However if there are header files, the dependencies on these will not be picked up from the entries in configure.tgt. The Makefile.in file will need extending to show these dependencies.
A new struct gdbarch, defining the new architecture, 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);
This function has been described fully in an earlier section. See How an Architecture is Represented.
The new struct gdbarch should contain implementations of the necessary functions (described in the previous sections) to describe the basic layout of the target machine’s processor chip (registers, stack, etc.). It can be shared among many targets that use the same processor architecture.