github.com/icexin/eggos@v0.4.2-0.20220216025428-78b167e4f349/.gdbinit (about)

     1  #set architecture i386:x86-64:intel
     2  #set architecture i386
     3  #file mutiboot.elf
     4  #set architecture i386:x86-64
     5  #target remote :1234
     6  display/i $pc
     7  
     8  define xbt
     9      set $tid=$arg0
    10      set $save_pc = $pc
    11      set $save_sp = $sp
    12      select-frame 0
    13      set $pc = 'github.com/icexin/eggos/kernel.threads'[$tid].tf.IP
    14      set $sp = 'github.com/icexin/eggos/kernel.threads'[$tid].tf.SP
    15      bt
    16  
    17      set $pc = $save_pc
    18      set $sp = $save_sp
    19  end
    20  
    21  define xps
    22      set $i = 0
    23      while $i < 20
    24          set $t = 'github.com/icexin/eggos/kernel.threads'[$i]
    25          set $addr = 0
    26          if $t.tf != 0
    27              set $addr = $t.tf.IP
    28          end
    29          printf "thread[%d]={state=%d, counter=%d, pc=0x%x lock=0x%x}", $i, $t.state, $t.counter, $addr, $t.sleepKey
    30          if $t.sleepKey != 0
    31              x $t.sleepKey
    32          end
    33          set $i = $i+1
    34      end
    35  end