Understanding and Debugging OS161

To determine a root cause of the bug you need to have a very good understanding of what happens in your program. One way to develop this understanding is to browse the source code. Another way is to step through your program with a debugger, such as gdb, which can tell you exactly what steps your program took before it crashed or exactly where the threads are waiting upon a deadlock. The following documents will teach you to efficiently browsing the source code and to use gdb.

Before you begin: many of the tutorials below assume the knowledge of text editors, such as emacs, vim, or sublime which are typically used by OS hackers for kernel development. You can find tutorials and documentaton for them online.

Browsing the source code.

Attaching to OS161 with gdb.

Examining your program with gdb.