3

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.

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.