Reputation: 4617
is there a way to check the value of lvalue variables without using the print
command when debugging the code step by step, what I'm looking to do is the following:
If I have the following code:
> x = 5;
y = 6;
when I'm debugging the code and I use next
, I want gdb to display the value of x
, that is the variable that changed in that instruction, I know I can watch the variable, but what I'm looking for is to be able to check variables on the fly without using print
is this possible?
Upvotes: 0
Views: 259
Reputation: 2445
You can use the display command:
(gdb) help display
Print value of expression EXP each time the program stops.
For instance if you display both you will get:
(gdb) next
4 y=6;
2: y = 0
1: x = 5
(gdb)
5 return 0;
2: y = 6
1: x = 5
Upvotes: 1