I'm trying to see the names and values of all global and static variables in a C program. I've tried using gdb's info variables command based on this question, but that only prints the names and types, not the values.
I'm currently using gdb, but I'd be open to a different tool as well.
Add a comment
|
1 Answer
At any time in gdb you may print out the value of a variable with a call to print. On another note, I find eclipse to be a great debugging tool, allowing you to view static and global variables with the "expressions" and "variables" tabs.
1 Comment
Jeremy Sigrist
I've used gdb's print and netbeans (not eclipse with this project though), but with both of them I'd have to manually enter every variable in my program, which I was trying to avoid (Netbeans seems to only list locals by default). If eclipse shows globals and statics as well I might get it set up.