Go to the first, previous, next, last section, table of contents.

Defining a New Host or Target Architecture

When building support for a new host and/or target, much of the work you need to do is handled by specifying configuration files; see section Adding a New Configuration. Further work can be divided into "host-dependent" (see section Adding a New Host) and "target-dependent" (see section Adding a New Target). The following discussion is meant to explain the difference between hosts and targets.

What is considered "host-dependent" versus "target-dependent"?

Host refers to attributes of the system where GDB runs. Target refers to the system where the program being debugged executes. In most cases they are the same machine, in which case a third type of Native attributes come into play.

Defines and include files needed to build on the host are host support. Examples are tty support, system defined types, host byte order, host float format.

Defines and information needed to handle the target format are target dependent. Examples are the stack frame format, instruction set, breakpoint instruction, registers, and how to set up and tear down the stack to call a function.

Information that is only needed when the host and target are the same, is native dependent. One example is Unix child process support; if the host and target are not the same, doing a fork to start the target process is a bad idea. The various macros needed for finding the registers in the upage, running ptrace, and such are all in the native-dependent files.

Another example of native-dependent code is support for features that are really part of the target environment, but which require #include files that are only available on the host system. Core file handling and setjmp handling are two common cases.

When you want to make GDB work "native" on a particular machine, you have to include all three kinds of information.

The dependent information in GDB is organized into files by naming conventions.

Host-Dependent Files

`config/*/*.mh'
Sets Makefile parameters
`config/*/xm-*.h'
Global #include's and #define's and definitions
`*-xdep.c'
Global variables and functions

Native-Dependent Files

`config/*/*.mh'
Sets Makefile parameters (for both host and native)
`config/*/nm-*.h'
#include's and #define's and definitions. This file is only included by the small number of modules that need it, so beware of doing feature-test #define's from its macros.
`*-nat.c'
global variables and functions

Target-Dependent Files

`config/*/*.mt'
Sets Makefile parameters
`config/*/tm-*.h'
Global #include's and #define's and definitions
`*-tdep.c'
Global variables and functions

At this writing, most supported hosts have had their host and native dependencies sorted out properly. There are a few stragglers, which can be recognized by the absence of NATDEPFILES lines in their `config/*/*.mh'.


Go to the first, previous, next, last section, table of contents.