views:

87

answers:

1

I am trying to read the value of a static variable in C like:

int variable = value;

The thing is that I only have the binary, and the code with a fake value (it is for a lecture, where we study security aspects of software development).

I have been trying to read the value using the GDB, and

(gdb)info variables

which just gives me a list of the variables (including the one I'm looking for) and what seems to be an address, so I would like to know if there is a way to read the value using GDB?

+8  A: 

In GDB, use the 'print' command:

print variable

Voila!

Will