Previous: Target Conditionals, Up: Target Architecture Definition


9.12 Adding a New Target

The following files add a target to gdb:

gdb/config/arch/ttt.mt
Contains a Makefile fragment specific to this target. Specifies what object files are needed for target ttt, by defining `TDEPFILES=...' and `TDEPLIBS=...'. Also specifies the header file which describes ttt, by defining `TM_FILE= tm-ttt.h'.

You can also define `TM_CFLAGS', `TM_CLIBS', `TM_CDEPS', but these are now deprecated, replaced by autoconf, and may go away in future versions of gdb.

gdb/ttt-tdep.c
Contains any miscellaneous code required for this target machine. On some machines it doesn't exist at all. Sometimes the macros in tm-ttt.h become very complicated, so they are implemented as functions here instead, and the macro is simply defined to call the function. This is vastly preferable, since it is easier to understand and debug.
gdb/arch-tdep.c
gdb/arch-tdep.h
This often exists to describe the basic layout of the target machine's processor chip (registers, stack, etc.). If used, it is included by ttt-tdep.h. It can be shared among many targets that use the same processor.
gdb/config/arch/tm-ttt.h
(tm.h is a link to this file, created by configure). Contains macro definitions about the target machine's registers, stack frame format and instructions.

New targets do not need this file and should not create it.

gdb/config/arch/tm-arch.h
This often exists to describe the basic layout of the target machine's processor chip (registers, stack, etc.). If used, it is included by tm-ttt.h. It can be shared among many targets that use the same processor.

New targets do not need this file and should not create it.

If you are adding a new operating system for an existing CPU chip, add a config/tm-os.h file that describes the operating system facilities that are unusual (extra symbol table info; the breakpoint instruction needed; etc.). Then write a arch/tm-os.h that just #includes tm-arch.h and config/tm-os.h.