1 # C Development Under DragonFly BSD Volume 3: Developing the DragonFly BSD Kernel
9 ## Working on the kernel
14 * Discuss how kernel development differs from userland development
17 * What subsystems do we provide
20 * Where are various files
23 * How to debug a kernel
26 * Overview, exercises and examples
38 ### Debugging threads in a kernel
42 #### Notes from a thread which should be converted
50 :Richard Nyberg wrote:
52 :> I often use gdb's proc command to switch between different processes
54 :> when debugging kernel cores. Now I want to debug a kernel thread
56 :> and it doesn't seem to work. Does anyone know how to switch to a
58 :> kernel thread? Maybe proc could be tweaked to work for threads too.
62 :Replying to myself...
66 :I RTFS and it looked like proc should work with kernel threads.
68 :The problem seems to be that the threads td_pcb is invalid.
80 Theoretically you can give the 'proc' command a thread address (not a
82 proc address, a thread address) and it should switch to it.
86 But Joerg's recent upgrades of gdb seem to have broken some things
88 that had been working before.
92 Pure kernel threads do not have PCBs in the conventional sense. The
94 thread state is pushed onto the stack for the switch/restore instead.
96 Most of the pcb structure will be unused for a kernel thread.