====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dev:gdbstub [2008/08/06 11:26] stefanha |
dev:gdbstub [2010/03/28 21:27] (current) stefanha |
||
---|---|---|---|
Line 2: | Line 2: | ||
===== Overview ===== | ===== Overview ===== | ||
- | You can use the [[http://www.gnu.org/software/gdb/|GNU Project Debugger (GDB)]] to debug gPXE. You either need two computers or virtualization software (e.g. [[http://bellard.org/qemu/|QEMU]]). One host runs gPXE while the other runs GDB. | + | You can use the [[http://www.gnu.org/software/gdb/|GNU Project Debugger (GDB)]] to debug gPXE. You either need two computers or virtualization software (e.g. [[http://qemu.org/|QEMU]]). One host runs gPXE while the other runs GDB. |
gPXE supports debugging via serial port or over the network. For serial, you need a null modem serial cable. For network, you need the machine to be connected to a network with UDP port 43770 traffic allowed. | gPXE supports debugging via serial port or over the network. For serial, you need a null modem serial cable. For network, you need the machine to be connected to a network with UDP port 43770 traffic allowed. | ||
Line 23: | Line 23: | ||
This file overrides ''src/config.h'' but is not under version control. Therefore you will never accidentally commit a patch that enables GDB debugging. | This file overrides ''src/config.h'' but is not under version control. Therefore you will never accidentally commit a patch that enables GDB debugging. | ||
+ | Sometimes you also need to remove/define ''GDBSERIAL'' in ''config/general.h'' to get serial debugging to work. | ||
+ | <code>#define GDBSERIAL /* Remote GDB debugging over serial */ | ||
+ | </code> | ||
Now build gPXE: | Now build gPXE: | ||
Line 62: | Line 65: | ||
The ''.tmp'' file must correspond to your gPXE image. For example, ''gpxe.dsk'' -> ''gpxe.dsk.tmp'', ''gpxe.pxe'' -> ''gpxe.pxe.tmp'', and ''gpxe.usb'' -> ''gpxe.hd.tmp''. | The ''.tmp'' file must correspond to your gPXE image. For example, ''gpxe.dsk'' -> ''gpxe.dsk.tmp'', ''gpxe.pxe'' -> ''gpxe.pxe.tmp'', and ''gpxe.usb'' -> ''gpxe.hd.tmp''. | ||
- | Next you should set up the serial port in GDB if you are debugging via serial. The ''set remotebaud N'' command is used to set the serial port baud rate to ''N''. See [[http://sourceware.org/gdb/current/onlinedocs/gdb_18.html#SEC173|Remote Configuration]] in the GDB Manual. | + | Next you should set up the serial port in GDB if you are debugging via serial. The ''set remotebaud N'' command is used to set the serial port baud rate to ''N''. See [[http://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Configuration.html#Remote-Configuration|Remote Configuration]] in the GDB Manual. |
Now connect to gPXE, which is already waiting since we entered the ''gdbstub'' command in the gPXE shell: | Now connect to gPXE, which is already waiting since we entered the ''gdbstub'' command in the gPXE shell: | ||
Line 153: | Line 156: | ||
* **CPU registers** (''i r'') shows many but not all of the registers. | * **CPU registers** (''i r'') shows many but not all of the registers. | ||
- | <code> | ||
- | TODO | ||
- | </code> | ||
- | * **Print** (''p'') shows the value of program variables and arbitrary expressions in C-like syntax (see [[http://sourceware.org/gdb/current/onlinedocs/gdb_9.html#SEC58|GDB Manual]]). | + | * **Print** (''p'') shows the value of program variables and arbitrary expressions in C-like syntax (see [[http://sourceware.org/gdb/current/onlinedocs/gdb/Data.html|GDB Manual]]). |
<code> | <code> | ||
(gdb) p response | (gdb) p response | ||
Line 169: | Line 169: | ||
===== GDB documentation ===== | ===== GDB documentation ===== | ||
- | * [[http://sourceware.org/gdb/current/onlinedocs/gdb_toc.html|Debugging with GDB (official manual)]] | + | * [[http://sourceware.org/gdb/current/onlinedocs/gdb/index.html|Debugging with GDB (official manual)]] |
* [[http://darkdust.net/files/GDB%20Cheat%20Sheet.pdf|A cheatsheet]], note that there are several others [[http://google.com/search?q=gdb+cheat+sheet|available]]. | * [[http://darkdust.net/files/GDB%20Cheat%20Sheet.pdf|A cheatsheet]], note that there are several others [[http://google.com/search?q=gdb+cheat+sheet|available]]. | ||
- | ===== Getting help ===== | + | |
- | You can email the [[https://lists.sourceforge.net/lists/listinfo/etherboot-developers|Etherboot-Developers]] list or ask on the [[http://www.etherboot.org/wiki/contact|IRC channel]]. | + |