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.

Community
  • 1
  • 1
Jeremy Sigrist
  • 325
  • 2
  • 11

1 Answers1

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.

gab64
  • 23
  • 4
  • 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. – Jeremy Sigrist Aug 25 '15 at 21:16