GNU/Linux ◆ xterm-256color ◆ bash 110 views

This recording shows how to start the debugger and attach pintos. pintos-dbg is a wrapper that starts gdb. It loads a set of user defined commands. debugpintos then attaches to the emulator. I’m setting a breakpoint in switch_threads where the context switch happens.

I’ll then either single-step through the context switch code or use the ‘finish’ gdb command to advance to the end of the function. Using the backtrace command, I’m showing the context - you can see that one thread calls switch_threads, and another one returns.

(backtrace (bt) inside switch_threads doesn’t quite work since it doesn’t establish a proper prologue that saves the bp register, that’s why gdb thinks it’s corrupted.)