Link Search Menu Expand Document

Switching threads

It is sometimes useful while debugging to switch between threads. You’ll need to use the Bochs emulator for this to work (see Debugging Page Faults for instructions on how to do this). To observe the context switch, do the following in a fresh (i.e. with no existing breakpoints set) GDB session. Lines below starting with “#” are comments.

break process.c:process_exit
# Shows you the current thread id
call thread_current()->tid
# Sets a breakpoint immediately after the call to sema_down in process_wait
break 95
# You should see a different thread id than before
call thread_current()->tid
# Shows other threads currently present in Pintos
dumplist &all_list thread allelem