GDB:如何从自动显示中删除变量 [英] GDB: How to remove a variable from the auto display
问题描述
我偶然发现了gdb的自动显示功能,它非常强大和方便。在调用
I stumbled upon the auto-display functionality of gdb, which is pretty powerful and convenient. After calling
(gdb) display/i $pc
(gdb) display $rax
每一步之后会自动显示观看值:
the watched values are displayed automatically after every 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
但是如何解决$ rax中的值,如果不再感兴趣?
But how can I "unwatch" the value in $rax, if it is no longer of interest?
推荐答案
Gdb帮助显示器显示:
Gdb help for display says:
使用
不显示
取消先前显示的请求。
"Use
undisplay
to cancel display requests previously made."
因此,如果您执行显示
,则显示b
和 display c
gdb会给这个请求提供数字(你可以通过发出没有参数的重播来看到)。然后你可以用不显示
这个数字。
So if you do display a
, then display b
, and display c
gdb will give numbers to this requests (which you can see by issuing replay with no arguments). Then you can use this 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
a href =https://sourceware.org/gdb/onlinedocs/gdb/Auto-Display.html =noreferrer> gdb文档。
Details in gdb documentation.
这篇关于GDB:如何从自动显示中删除变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!