Remote Debugging for SPIN

Overview

Spin supports an Ethernet debugging protocol called TTD that stands for "Topaz Teledebugging Protocol". TTD allows you to debug your SPIN kernel or user-level program over the network. If you know how to use gdb then you shouldn't have much trouble getting started.

The basic idea is that you run a modified version of gdb called m3gdbttd on your development (Linux) machine and you connect to the target machine, which is your crashbox running SPIN, over the network.


Getting Started

The executable you need to run is spin/local/LINUXELF/bin/m3gdbttd. When you start up m3gdbttd you need to specify the kernel image with debugging symbols, this is spin/kernel/sal/i386_freebsd/compile/SPIN/kernel.withsyms.

For this example let's pretend the SPIN source tree is located in /home/myspin/.

Start gdb like this:

#cd /home/myspin/spin   (This is so the next command isn't so long)
#local/LINUXELF/bin/m3gdbttd   kernel/sal/i386_freebsd/compile/SPIN/kernel.withsyms

Now you should see something like this:

GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.13 (i486--linuxelf --target freebsd386), Copyright 1994 Free Software Foundation, Inc...Naming default domain 'default': /spin/kernel/sal/i386_freebsd/compile/SPIN/kernel.withsyms

(gdb)

Specify the target machine:

(gdb) target ttd loom16
(Substitute your crashbox for loom16)

Now you will see something like:

Attaching to remote machine across net...
Attached to loom16, an AT386
Connected to SPIN

Current language: auto; currently c

ttd_intr_called () at ../../../ttd/ttd_i386.c:104
104 }
(gdb)

You are now connected to your target machine and can begin debugging your kernel. Listed below are some useful commands. For more detailed information on using the ttd debugger, look at the user documentation provided with the source code.


Some Useful Commands

thread sweep
probes the target for all known threads
backtrace (bt)
backtraces the call stack of the current thread
thread number
changes the current thread to that designated by number
thread apply all command
applies command to all known threads
A useful command is:
      thread apply all bt
This will give a backtrace for all known threads.

Questions/Comments

Copyright (c) 1997 The University of Washington. All rights reserved.