3 years, 1 month ago
How do you have a variable's value printed each time you step in gdb?
I remember when I would debug a C++ program with gdb that I could set it so that a particular variable's value would be displayed each time I stepped to the next line of code. I've tried the "watch" command, but it seems to show the variable only when it is changed. I've searched the help files, and I can't find it. Any ideas?
Separate topics with commas, or by pressing return. Use the delete or backspace key to edit or remove existing topics.
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$1 Answer
I think you need to use awatch to achieve this:
http://www.unknownroad.com/rtfm/gdbtut/gdbwatch.html#RDWR
http://www.unknownroad.com/rtfm/gdbtut/gdbwatch.html#RDWR
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$
awatch doesn't seem to print it every time I step.
I remembered it! It's "display ". I was helping a student with his code, and it hit me.