User's Manual

www.openmoko.com
30
Some cross toolchains come with GDB already set up. Otherwise building
cross-GDB yourself is quick and easy (compared to building binutils and
cross-gcc).
To debug u-boot, load the file "u-boot" into gdb (not "u-boot.bin") that is
produced by "make" when building u-boot. To debug a Linux kernel, load
the file "vmlinux" from the main source directory into gdb. These files are
in ELF format and contain all the symbol information and are not stripped
of debugging data until you run "strip" on them, unlike "u-boot.bin" and
"Image"/"zImage"/"uImage". Next, tell QEMU to enable the gdbserver by
appending the "-s" switch or issuing "gdbserver" in the monitor. Use the
command
(gdb) target remote localhost:1234
to make a connection to the emulator. From there you should be able to
use all the usual GDB commands, including stepping instructions, setting
breakpoints, watchpoints, inspecting stack, variables, registers and more.
If gdb is running in the same directory from which it grabbed the ELF
executable, the "edit" command should work so you can jump right to the
source line which is executing.
Simple network connection with pppd
One simple way to get a network connection from the emulated Neo is via
an emulated serial port and pppd. Add -serial vc -serial pty to the QEMU
command line, and QEMU prints a device name on a line like "char device
redirected to /dev/pts/12".
On the Neo side, open a terminal and run the command "pppd nodetach
debug /dev/ttySAC1".
On the host computer side, open a root terminal and run the command
"pppd nodetach debug 192.168.68.1:192.168.68.2 noauth /dev/pts/12",
substituting the actual device name from above.
Now on the host computer side, you should be able to "ping 192.168.68.2"
and "ssh root@192.168.68.2".