I have to debug a code segment where I have a lot of values and I need to know the value of each right before I step to the next line. Of course I can do this with step print Value but with more than 3 values this gets exhausting, so is there an automatic version?
Asked
Active
Viewed 1,153 times
0
-
Are you looking to just print the current state of the variables at that point? http://stackoverflow.com/questions/6261392/printing-all-global-variables-local-variables. Or do you really need to know how each is behaving changing line by line? – Tuffwer Mar 02 '16 at 20:52
-
Is it possible to throw an IDE at the problem? You should be able to run your program under test through gdbserver from a full-featured desktop. – user4581301 Mar 02 '16 at 21:30
-
Thank you Guys and Tuffwer - the link to the question answered my question sufficiently. – Klaus Valse Mar 08 '16 at 20:27
1 Answers
1
You can tell gdb to re-evaluate an expression after each step using the display
command. So for example you could:
(gdb) display var1
(gdb) display var2
(gdb) display var3

Tom Tromey
- 21,507
- 2
- 45
- 63