2

For example I have following c++ source file

// define global variables here int Label = 1234; char Hash[] = "0x11231abc"; 

compile this to *.o file, and may be later linked to an executable binary. Is it possible to get the value from ELF file by using some existing tools, like readelf, objdump?

1
  • I think using pythoin ELF tool can achieve this goal Commented Jul 1, 2022 at 1:02

1 Answer 1

3

Is it possible to get the value from ELF file by using some existing tools, like readelf, objdump?

Whether this is possible at all depends on how exactly these variables are used, whether they are local or global, whether they have their address taken, which compiler is used and what optimizations are in effect.

If the variables are global and the code is not optimized, sure some combination of readelf and objdump commands could possibly get you the answer.

In general, GDB would be a better tool to use here.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.