Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Kernel Debugging

Graham MacDonald edited this page Jan 31, 2018 · 3 revisions

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> 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.