我可以在gdb中取消特定的声明吗?

时间:2011-06-08 03:41:08

标签: gdb

(gdb) n
253     conf.log = log;

如上所述,下一个陈述是conf.log = log;,我怎么才能消除它?

我只是尝试了disas,但是gdb会反汇编所有当前的函数(我不需要那么多)......

(gdb) disas
Dump of assembler code for function ngx_init_cycle:
0x0000000000417c7c <ngx_init_cycle+0>:  push   %rbp
0x0000000000417c7d <ngx_init_cycle+1>:  mov    %rsp,%rbp
0x0000000000417c80 <ngx_init_cycle+4>:  push   %rbx
0x0000000000417c81 <ngx_init_cycle+5>:  sub    $0x258,%rsp
0x0000000000417c88 <ngx_init_cycle+12>: mov    %rdi,-0x228(%rbp)
0x0000000000417c8f <ngx_init_cycle+19>: callq  0x42b2fc <ngx_timezone_update>
0x0000000000417c94 <ngx_init_cycle+24>: mov    0x2b00e5(%rip),%rax        # 0x6c7d80 <ngx_cached_time>
0x0000000000417c9b <ngx_init_cycle+31>: mov    %rax,-0x88(%rbp)
0x0000000000417ca2 <ngx_init_cycle+38>: mov    -0x88(%rbp),%rax
0x0000000000417ca9 <ngx_init_cycle+45>: movq   $0x0,(%rax)
0x0000000000417cb0 <ngx_init_cycle+52>: callq  0x4149e7 <ngx_time_update>
0x0000000000417cb5 <ngx_init_cycle+57>: mov    -0x228(%rbp),%rax
0x0000000000417cbc <ngx_init_cycle+64>: mov    0x10(%rax),%rax
0x0000000000417cc0 <ngx_init_cycle+68>: mov    %rax,-0x90(%rbp)
0x0000000000417cc7 <ngx_init_cycle+75>: mov    -0x90(%rbp),%rsi
0x0000000000417cce <ngx_init_cycle+82>: mov    $0x4000,%edi
0x0000000000417cd3 <ngx_init_cycle+87>: callq  0x405c6c <ngx_create_pool>
0x0000000000417cd8 <ngx_init_cycle+92>: mov    %rax,-0x80(%rbp)
0x0000000000417cdc <ngx_init_cycle+96>: cmpq   $0x0,-0x80(%rbp)
---Type <return> to continue, or q <return> to quit---q

更新

(gdb) info line 98
Line 98 of "src/os/unix/ngx_process_cycle.c" starts at address 0x42f6f3 <ngx_master_process_cycle+31>
   and ends at 0x42f704 <ngx_master_process_cycle+48>.
(gdb) disas 0x42f6f3,0x42f704
Dump of assembler code for function ngx_master_process_cycle:
0x000000000042f6d4 <ngx_master_process_cycle+0>:    push   %rbp
0x000000000042f6d5 <ngx_master_process_cycle+1>:    mov    %rsp,%rbp
0x000000000042f6d8 <ngx_master_process_cycle+4>:    push   %rbx
0x000000000042f6d9 <ngx_master_process_cycle+5>:    sub    $0x128,%rsp
0x000000000042f6e0 <ngx_master_process_cycle+12>:   mov    %rdi,-0x108(%rbp)
0x000000000042f6e7 <ngx_master_process_cycle+19>:   lea    -0xe0(%rbp),%rdi
0x000000000042f6ee <ngx_master_process_cycle+26>:   callq  0x402988 <sigemptyset@plt>
0x000000000042f6f3 <ngx_master_process_cycle+31>:   lea    -0xe0(%rbp),%rdi
0x000000000042f6fa <ngx_master_process_cycle+38>:   mov    $0x11,%esi
0x000000000042f6ff <ngx_master_process_cycle+43>:   callq  0x402878 <sigaddset@plt>
0x000000000042f704 <ngx_master_process_cycle+48>:   lea    -0xe0(%rbp),%rdi
0x000000000042f70b <ngx_master_process_cycle+55>:   mov    $0xe,%esi
0x000000000042f710 <ngx_master_process_cycle+60>:   callq  0x402878 <sigaddset@plt>
0x000000000042f715 <ngx_master_process_cycle+65>:   lea    -0xe0(%rbp),%rdi
0x000000000042f71c <ngx_master_process_cycle+72>:   mov    $0x1d,%esi
0x000000000042f721 <ngx_master_process_cycle+77>:   callq  0x402878 <sigaddset@plt>
0x000000000042f726 <ngx_master_process_cycle+82>:   lea    -0xe0(%rbp),%rdi
0x000000000042f72d <ngx_master_process_cycle+89>:   mov    $0x2,%esi
0x000000000042f732 <ngx_master_process_cycle+94>:   callq  0x402878 <sigaddset@plt>
---Type <return> to continue, or q <return> to quit---

1 个答案:

答案 0 :(得分:0)

尝试以下效果:

(gdb) info line 12
Line 12 of "test.c" starts at address 0x4004f4 <main+24>
   and ends at 0x4004fe <main+34>.

(gdb) disas 0x4004f4,0x4004fe
Dump of assembler code from 0x4004f4 to 0x4004fe:
   0x00000000004004f4 <main+24>:    mov    $0x0,%eax
   0x00000000004004f9 <main+29>:    callq  0x4004d0 <bp3>
End of assembler dump.

(gdb) disas main+24,main+34
Dump of assembler code from 0x4004f4 to 0x4004fe:
   0x00000000004004f4 <main+24>:    mov    $0x0,%eax
   0x00000000004004f9 <main+29>:    callq  0x4004d0 <bp3>
End of assembler dump.

不确定是否有更自动的方式。