How-To Build GDB for Systemsim

New: In most cases it is no longer necessary to build a special version of gdb for use with Systemsim. Only the PowerPC 750 versions of Systemsim require a modified gdb.

Files you will need

Get the GDB source code

Download the source code and patch it for Systemsim.
    % wget ftp://sources.redhat.com/pub/gdb/releases/gdb-6.3.tar.gz
    % tar -zxvf gdb-6.3.tar.gz
    % cd gdb-6.3
    % patch -p1 < systemsim_gdb-6.3.diff

Compile the source code

By default, GDB installs itself in the /usr/local directory. Use the configure option
    --prefix {directory}
to install somewhere else, e.g., /opt/ppc32-tools.
    % ./configure --prefix /opt/ppc32-tools --target=powerpc-ibm-eabi --disable-nls --disable-tui \
        --disable-gdbtk --disable-profiling --disable-sim
    % make all

Install GDB

Install from the root account.
    % su
    % make install

Note: If you wish to use a different debugger, like DDD, that just uses the CLI version of gdb,
you should tell DDD to use the actual gdb program file in /opt/ppc32-tools/bin.

Setting up your GDB environment

The main change to GDB is to enable it to handle the full set of system registers for the PowerPC 750. In the modified version of gdb, you enable this feature with the set architecture command:

    (gdb) set architecture powerpc:750

Once you set up the architecture you may now use the standard remote method. First, tell Systemsim to connect to gdb with the command:

    systemsim% mysim debugger wait 0
Systemsim will print the port number it is using for the GDB connection.

Then, in GDB:

    (gdb) target remote :<port>

It is possible to send tcl commands to systemsim from GDB. The output will appear on the systemsim console as if it was typed there. This command is:

    (gdb) monitor <tcl command>