DragonFly BSD
DragonFly kernel List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: debugging kernel threads


From: Richard Nyberg <rnyberg@xxxxxxxx>
Date: Wed, 26 Jan 2005 18:43:44 +0100

At Wed, 26 Jan 2005 10:52:45 +0100,
Richard Nyberg wrote:
> 
> I often use gdb's proc command to switch between different processes
> when debugging kernel cores. Now I want to debug a kernel thread
> and it doesn't seem to work. Does anyone know how to switch to a
> kernel thread? Maybe proc could be tweaked to work for threads too.
>
Replying to myself...
 
I RTFS and it looked like proc should work with kernel threads.
The problem seems to be that the threads td_pcb is invalid.

Example:

(kgdb) psx
. ..
  0    -1 c121d600 00000e00 vnlru      c121d600 vlruwt
. ..

(kgdb) p  *((struct thread*)0xc121d600)->td_pcb
$11 = {pcb_cr3 = 0, pcb_edi = 0, pcb_esi = -1071893984, pcb_ebp = 0, 
  pcb_esp = 0, pcb_ebx = 0, pcb_eip = 0, pcb_dr0 = 0, pcb_dr1 = 0, 
  pcb_dr2 = 0, pcb_dr3 = 0, pcb_dr6 = 0, pcb_dr7 = 0, pcb_ldt = 0x0, 
  pcb_save = {sv_87 = {sv_env = {en_cw = 0, en_sw = 0, en_tw = 0, en_fip = 0, 
        en_fcs = 0, en_opcode = 0, en_foo = 0, en_fos = 0}, sv_ac = {{
          fp_bytes = "\000\000\000\000\000\000\000\000\000"}, {
          fp_bytes = "\000\000\000\000\000\000\000\000\000"}, {
          fp_bytes = "\000\000\000\000\000\000\000\000\000"}, {
          fp_bytes = "\000\000\000\000\000\000\000\000\000"}, {
          fp_bytes = "\000\000\000\000\000\000\000\000\000"}, {
          fp_bytes = "\000\000\000\000\000\000\000\000\000"}, {
          fp_bytes = "\000\000\000\000\000\000\000\000\000"}, {
          fp_bytes = "\000\000\000\000\000\000\000\000\000"}}, sv_ex_sw = 0, 
      sv_pad = '\0' <repeats 63 times>}, sv_xmm = {sv_env = {en_cw = 0, 
        en_sw = 0, en_tw = 0, en_opcode = 0, en_fip = 0, en_fcs = 0, 
        en_pad0 = 0, en_foo = 0, en_fos = 0, en_pad1 = 0, en_mxcsr = 0, 
        en_pad2 = 0}, sv_fp = {{fp_acc = {
            fp_bytes = "\000\000\000\000\000\000\000\000\000"}, 
          fp_pad = "\000\000\000\000\000"}, {fp_acc = {
            fp_bytes = "\000\000\000\000\000\000\000\000\000"}, 
          fp_pad = "\000\000\000\000\000"}, {fp_acc = {
            fp_bytes = "\000\000\000\000\000\000\000\000\000"}, 
          fp_pad = "\000\000\000\000\000"}, {fp_acc = {
            fp_bytes = "\000\000\000\000\000\000\000\000\000"}, 
          fp_pad = "\000\000\000\000\000"}}, sv_xmm = {{
          xmm_bytes = '\0' <repeats 15 times>}, {
          xmm_bytes = '\0' <repeats 15 times>}, {
          xmm_bytes = '\0' <repeats 15 times>}, {
          xmm_bytes = '\0' <repeats 15 times>}, {
          xmm_bytes = '\0' <repeats 15 times>}, {
          xmm_bytes = '\0' <repeats 15 times>}, {
          xmm_bytes = '\0' <repeats 15 times>}, {
          xmm_bytes = '\0' <repeats 15 times>}}, sv_ex_sw = 0, 
      sv_pad = '\0' <repeats 219 times>}}, pcb_flags = 0 '\0', 
  pcb_onfault = 0x0, pcb_gs = 0, pcb_ext = 0x0, __pcb_spare = {0, 0, 0}}

A random selection of other threads shows similarly broken pcb's.

        -Richard




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]