0

I have compiled this program with gcc

#include <stdio.h>
const char* message = "Outside defined";
int a = 1337;
int b = 10;
int c = 9;
int d = 8;
int e = 7;
int main () {return 0;}

When I objdump -t, I am able to recover the global variable names:

0000000000004020 g     O .data  0000000000000004              e
0000000000004018 g     O .data  0000000000000004              c
0000000000004010 g     O .data  0000000000000004              a

My question is, is it possible to retrieve the values for the respective global variables too by the objdump? Is it possible without running/debugging the program at all?

1
  • 1
    I'm not sure if objdump can do that, but reverse engineering tools like IDA (and free ones like Ghidra) can do that without running the program. Just open the binary in Ghidra and look at the data values at those addresses. Jul 21, 2023 at 14:50

0

Your Answer

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

Browse other questions tagged or ask your own question.