GDB: how to remove a variable from automatic display

I came across a gdb auto-display feature, which is quite powerful and convenient. After the call

(gdb) display/i $pc (gdb) display $rax 

scanned values ​​are displayed automatically after each step:

 (gdb) si 0x0804805e in print_loop_start () 2: $rax = 0 1: x/i $pc => 0x804805e <print_loop_start+6>: mov 0x4(%ebp,%eax,4),%ecx 

But how can I "print" a value in $ rax if it is no longer interested?

+6
source share
1 answer

Gdb help for display says:

"Use undisplay to cancel previously made display requests.

So, if you do display a , then display b and display c gdb will give the numbers for these requests (which you can see by issuing the replay without arguments). Then you can use these numbers with undisplay .

Example:

 (gdb) display a 1: a = 32767 (gdb) display b 2: b = 0 (gdb) display c 3: c = 0 (gdb) undisplay 2 (gdb) step 6 b = 2; 1: a = 1 3: c = 0 

See the gdb documentation for details.

+10
source

All Articles