gdb display/20i 反汇编

方法1. display 查看当前执行及后20行汇编指令  (gdb) display /20i $pc

 

 

 

 

 

# trampoline
```
kvmmap(TRAMPOLINE, (uint64)trampoline, PGSIZE, PTE_R | PTE_X);
```
```
(gdb) disas $pc, $pc+20
Dump of assembler code from 0x8000268a to 0x8000269e:
=> 0x000000008000268a <usertrapret+118>:        ld      a1,80(a0)
   0x000000008000268c <usertrapret+120>:        srli    a1,a1,0xc
   0x000000008000268e <usertrapret+122>:        auipc   a4,0x5
   0x0000000080002692 <usertrapret+126>:        addi    a4,a4,-1534 # 0x80007090 <userret>
   0x0000000080002696 <usertrapret+130>:        sub     a4,a4,a2
   0x0000000080002698 <usertrapret+132>:        add     a5,a5,a4
   0x000000008000269a <usertrapret+134>:        li      a4,-1
   0x000000008000269c <usertrapret+136>:        slli    a4,a4,0x3f
End of assembler dump.
(gdb) display/10i $pc
1: x/10i $pc
=> 0x8000268a <usertrapret+118>:        ld      a1,80(a0)
   0x8000268c <usertrapret+120>:        srli    a1,a1,0xc
   0x8000268e <usertrapret+122>:        auipc   a4,0x5
   0x80002692 <usertrapret+126>:        addi    a4,a4,-1534
   0x80002696 <usertrapret+130>:        sub     a4,a4,a2
   0x80002698 <usertrapret+132>:        add     a5,a5,a4
   0x8000269a <usertrapret+134>:        li      a4,-1
   0x8000269c <usertrapret+136>:        slli    a4,a4,0x3f
   0x8000269e <usertrapret+138>:        or      a1,a1,a4
   0x800026a0 <usertrapret+140>:        lui     a0,0x2000
(gdb) si
0x000000008000268c      130       ((void (*)(uint64,uint64))fn)(TRAPFRAME, satp);
1: x/10i $pc
=> 0x8000268c <usertrapret+120>:        srli    a1,a1,0xc
   0x8000268e <usertrapret+122>:        auipc   a4,0x5
   0x80002692 <usertrapret+126>:        addi    a4,a4,-1534
   0x80002696 <usertrapret+130>:        sub     a4,a4,a2
   0x80002698 <usertrapret+132>:        add     a5,a5,a4
   0x8000269a <usertrapret+134>:        li      a4,-1
   0x8000269c <usertrapret+136>:        slli    a4,a4,0x3f
   0x8000269e <usertrapret+138>:        or      a1,a1,a4
   0x800026a0 <usertrapret+140>:        lui     a0,0x2000
   0x800026a4 <usertrapret+144>:        addi    a0,a0,-1
(gdb) display/10i $pc
2: x/10i $pc
=> 0x8000268c <usertrapret+120>:        srli    a1,a1,0xc
   0x8000268e <usertrapret+122>:        auipc   a4,0x5
   0x80002692 <usertrapret+126>:        addi    a4,a4,-1534
   0x80002696 <usertrapret+130>:        sub     a4,a4,a2
   0x80002698 <usertrapret+132>:        add     a5,a5,a4
   0x8000269a <usertrapret+134>:        li      a4,-1
   0x8000269c <usertrapret+136>:        slli    a4,a4,0x3f
   0x8000269e <usertrapret+138>:        or      a1,a1,a4
   0x800026a0 <usertrapret+140>:        lui     a0,0x2000
   0x800026a4 <usertrapret+144>:        addi    a0,a0,-1
(gdb) n
0x0000003ffffff090 in ?? ()
1: x/10i $pc
=> 0x3ffffff090:        csrw    satp,a1
   0x3ffffff094:        sfence.vma
   0x3ffffff098:        ld      t0,112(a0)
   0x3ffffff09c:        csrw    sscratch,t0
   0x3ffffff0a0:        ld      ra,40(a0)
   0x3ffffff0a4:        ld      sp,48(a0)
   0x3ffffff0a8:        ld      gp,56(a0)
   0x3ffffff0ac:        ld      tp,64(a0)
   0x3ffffff0b0:        ld      t0,72(a0)
   0x3ffffff0b4:        ld      t1,80(a0)
2: x/10i $pc
=> 0x3ffffff090:        csrw    satp,a1
   0x3ffffff094:        sfence.vma
   0x3ffffff098:        ld      t0,112(a0)
   0x3ffffff09c:        csrw    sscratch,t0
   0x3ffffff0a0:        ld      ra,40(a0)
   0x3ffffff0a4:        ld      sp,48(a0)
   0x3ffffff0a8:        ld      gp,56(a0)
   0x3ffffff0ac:        ld      tp,64(a0)
   0x3ffffff0b0:        ld      t0,72(a0)
   0x3ffffff0b4:        ld      t1,80(a0)
(gdb) display/20i $pc
3: x/20i $pc
=> 0x3ffffff090:        csrw    satp,a1
   0x3ffffff094:        sfence.vma
   0x3ffffff098:        ld      t0,112(a0)
   0x3ffffff09c:        csrw    sscratch,t0
   0x3ffffff0a0:        ld      ra,40(a0)
   0x3ffffff0a4:        ld      sp,48(a0)
   0x3ffffff0a8:        ld      gp,56(a0)
   0x3ffffff0ac:        ld      tp,64(a0)
   0x3ffffff0b0:        ld      t0,72(a0)
   0x3ffffff0b4:        ld      t1,80(a0)
   0x3ffffff0b8:        ld      t2,88(a0)
   0x3ffffff0bc:        ld      s0,96(a0)
   0x3ffffff0be:        ld      s1,104(a0)
   0x3ffffff0c0:        ld      a1,120(a0)
   0x3ffffff0c2:        ld      a2,128(a0)
   0x3ffffff0c4:        ld      a3,136(a0)
   0x3ffffff0c6:        ld      a4,144(a0)
   0x3ffffff0c8:        ld      a5,152(a0)
   0x3ffffff0ca:        ld      a6,160(a0)
   0x3ffffff0ce:        ld      a7,168(a0)
(gdb) disas $pc, $pc+20
Dump of assembler code from 0x3ffffff090 to 0x3ffffff0a4:
=> 0x0000003ffffff090:  csrw    satp,a1
   0x0000003ffffff094:  sfence.vma
   0x0000003ffffff098:  ld      t0,112(a0)
   0x0000003ffffff09c:  csrw    sscratch,t0
   0x0000003ffffff0a0:  ld      ra,40(a0)
End of assembler dump.
(gdb) 
Dump of assembler code from 0x3ffffff090 to 0x3ffffff0a4:
=> 0x0000003ffffff090:  csrw    satp,a1
   0x0000003ffffff094:  sfence.vma
   0x0000003ffffff098:  ld      t0,112(a0)
   0x0000003ffffff09c:  csrw    sscratch,t0
   0x0000003ffffff0a0:  ld      ra,40(a0)
End of assembler dump.
(gdb) 

 

xv6 trampoline调试

posted on 2022-01-12 20:16  tycoon3  阅读(259)  评论(0编辑  收藏  举报

导航