Master the fundamental concepts of debugging mastery through this focused micro-challenge.
QEMU includes a built-in GDB stub that allows remote debugging of operating systems and kernel code without physical hardware. Kernel developers and security researchers use this workflow daily.
Start QEMU with the GDB stub:
-s: Shorthand for -gdb tcp::1234-S: Pause CPU at startup until GDB connectsConnect from GDB:
cLoading…
Once connected, you can examine registers with info registers, step through boot code with stepi, and inspect memory at known addresses with x/10x 0x100000.
You will document the QEMU + GDB remote debugging workflow for kernel development. This exercise asks you to explain how to set breakpoints in kernel code and load module symbols, skills you will need when analyzing OS behavior or developing kernel modules.
After the guest boots, load a module with insmod and find its base address in /proc/modules. In GDB, use add-symbol-file module.ko 0xaddress to load debug symbols at the correct relocation. Without this step, breakpoints in module code miss because GDB only knows the kernel's main symbol table. QEMU's stub exposes the full guest register set as if you were debugging bare metal.
Write a C program that documents the QEMU + GDB remote debugging workflow for kernel development.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github