Thanks for this patch nice patch!
Michael (mcb30) is away for a few days but should be back at the end of
the week, and I am sure he will have some specific comments about it.
Stefan may have some thoughts too, since he wrote our GDB remote
debugging code last year.
The general capability seems useful, and it appears at first read that
you have followed our architectural strategy of compiling everything and
letting the linker sort things out, so it would not be included in an
image unless the feature was specifically requested.
Thanks again for your effort and your contribution.
Joshua Oreman wrote:
> Hi all,
> I've implemented support for debugging gPXE over a FireWire link, for
> the cases (like my Mac laptop) where no serial port is available. In my
> tests it's worked very well, though I haven't gotten around to fixing
> any bugs with it yet :-)
> This patch draws on a Linux kernel patch to add (when GDBFIRE is defined
> in the configuration) just enough FireWire support that the debugging
> host can use physical DMA requests to read and modify memory on the gPXE
> target. The driver is about 1kb of code. The GDB stub portion I wrote on
> top of it knows nothing about FireWire; instead, it keeps a couple of
> ring buffers in memory organized such that it's fairly easy to read and
> write them over FireWire. Instead of modifying the GDB code to do that,
> I created a "middle-end" named firebug. It listens for a connection from
> GDB over TCP and proxies it over the FireWire memory-mapped link.
> I wrote firebug to use the libraw1394 library and raw1394 kernel module,
> both of which are readily available for Linux.
> To debug over FireWire:
> * Apply the attached patch and enable GDBFIRE in config/general.h.
> Compile gPXE as normal. Also `make util/firebug' to compile the
> GDB-to-FireWire proxy.
> * Connect a FireWire cable between the debugging host computer and the
> gPXE target computer. The host can have other devices, but the gPXE
> target should not. You shouldn't add or remove anything from the
> FireWire bus while debugging, as that triggers a bus reset that will
> disable physical DMA.
> * Start gPXE and press Ctrl+B for a command line. Type
> gPXE> gdbstub firewire
> The stub code will print an address that you must use to start
> firebug (so it can find the link structure in memory).
> * Run firebug on the debugging host with the address (e.g. 1DEE6190)
> as an argument. There are several optional command-line options;
> firebug --help for details. Depending on the permissions of
> /dev/raw1394, you may need to run as root.
> * Start GDB on bin/gpxe.lkrn.tmp (or another .tmp file) and connect to
> gdb> target remote localhost:1278
> (I picked port 1278 randomly after checking it wasn't
> in /etc/services.) You can also run the debugger and firebug on
> separate hosts.
> * Debug as usual.
> See util/firebug.c in the patch for a large comment block explaining
> most of the implementation details.
> -- Josh