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

# Adding a New Host

Once you have specified a new configuration for your host (see section Adding a New Configuration), there are three remaining pieces to making GDB work on a new machine. First, you have to make it host on the new machine (compile there, handle that machine's terminals properly, etc). If you will be cross-debugging to some other kind of system that's already supported, you are done.

If you want to use GDB to debug programs that run on the new machine, you have to get it to understand the machine's object files, symbol files, and interfaces to processes; see section Adding a New Target and see section Adding a New Native Configuration

Several files control GDB's configuration for host systems:

``gdb/config/arch/xxx.mh'`
  Specifies Makefile fragments needed when hosting on machine xxx. In particular, this lists the required machine-dependent object files, by defining ``XDEPFILES=...'`. Also specifies the header file which describes host xxx, by defining `XM_FILE= xm-xxx.h`. You can also define `CC`, `REGEX` and `REGEX1`, `SYSV_DEFINE`, `XM_CFLAGS`, `XM_ADD_FILES`, `XM_CLIBS`, `XM_CDEPS`, etc.; see ``Makefile.in'`.
``gdb/config/arch/xm-xxx.h'`
  (``xm.h'` is a link to this file, created by configure). Contains C macro definitions describing the host system environment, such as byte order, host C compiler and library, ptrace support, and core file structure. Crib from existing ``xm-*.h'` files to create a new one.
``gdb/xxx-xdep.c'`
  Contains any miscellaneous C code required for this machine as a host. On many machines it doesn't exist at all. If it does exist, put ``xxx-xdep.o'` into the `XDEPFILES` line in ``gdb/config/mh-xxx'`.

### Generic Host Support Files

There are some "generic" versions of routines that can be used by various systems. These can be customized in various ways by macros defined in your ``xm-xxx.h'` file. If these routines work for the xxx host, you can just include the generic file's name (with ``.o'`, not ``.c'`) in `XDEPFILES`.

Otherwise, if your machine needs custom support routines, you will need to write routines that perform the same functions as the generic file. Put them into `xxx-xdep.c`, and put `xxx-xdep.o` into `XDEPFILES`.

``ser-bsd.c'`
  This contains serial line support for Berkeley-derived Unix systems.
``ser-go32.c'`
  This contains serial line support for 32-bit programs running under DOS using the GO32 execution environment.
``ser-termios.c'`
  This contains serial line support for System V-derived Unix systems.

Now, you are now ready to try configuring GDB to compile using your system as its host. From the top level (above ``bfd'`, ``gdb'`, etc), do:

    ./configure xxx --target=vxworks960

This will configure your system to cross-compile for VxWorks on the Intel 960, which is probably not what you really want, but it's a test case that works at this stage. (You haven't set up to be able to debug programs that run on xxx yet.)

If this succeeds, you can try building it all with:

    make

Repeat until the program configures, compiles, links, and runs. When run, it won't be able to do much (unless you have a VxWorks/960 board on your network) but you will know that the host support is pretty well done.

Good luck! Comments and suggestions about this section are particularly welcome; send them to ``bug-gdb@prep.ai.mit.edu'`.

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