You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This page is a collection of various techniques and tips for debugging the Harvey kernel.
Connecting gdb to Harvey
When running Harvey in QEMU using the usual launch scripts, you can connect gdb by running:
gdb sys/src/9/amd64/harvey
gdb> set architecture i386:x86-64
The target architecture is assumed to be i386:x86-64
gdb> target remote localhost:1234
Compile-Time Breakpoints
Insert die("labelfoo") where you want the kernel to stop. Once the kernel prints out labelfoo, connect gdb as shown here. Inside die() the CPU is spinning on the variable staydead. From gdb, set staydead=0 to enable Harvey to continue.
Print syscalls
To print info for every syscall enter and exit, go to syscall.c, set the variable printallsyscalls to 1 and recompile the kernel.
Run on a single core
The Harvey kernel can be forced to run on only a single core by setting nosmp=1 in the sys/src/9/amd64/main.c.
Another option is to modify the GO9PCPU or GO9PTERM script to change the -smp 4 flag to -smp 1.