Attaching to OS161 with GDB
The debugger we will use for this course is called
You will have
- In your installation root directory (
~/os161/root/ ), launch System/161 but have it wait for a debugger connection:sys161 -w kernel
- In a different terminal window, again in your installation root directory, launch
os161-gdb , giving it the binary that you want to debug:os161-gdb kernel
- Next, tell gdb where to find the sources for your kernel, so you know where you are in the source as you step through the code.
(gdb) directory ~/os161/src/kern/compile/DUMBVM
Hint: you can put this line in the
.gdbinit file in your~/os161/root directory, so you don't have to perform this step every time.Once in gdb, instruct gdb to connect to System/161:
(gdb) target remote unix:.sockets/gdb
Take a look at this sample
For instance, once that file is in place, instead of typing
the
Now that you are connected, carefully study this document to understand what