Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to read objdump in C

Code

#define     TEXT_LEN    256
#define     NUM_NUMBERS (2*65536)

    int     numNumbers = NUM_NUMBERS;

PuTTY command for global variable numNumbers

objdump -s -j .data assign1-0

Output of command

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

602070 00000000 00000200

Hello,
Can someone help me understand this output or if I put the wrong command?
Im trying to find global variable numNumbers using objdump.
But im pretty sure the output should be 00020000 because numNumbers is 131072 (2*65536) but it’s coming out 00000200 which is 512 from hexadecimal to decimal.
Am I reading it wrong and the output is correct or is the command wrong to find a global variable?

>Solution :

You are probably on a little endian computer, and so the bytes that make up your int are not in the order in which you’re used reading digits or bits as a human. Familiarize yourself with the concept of endianness.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading