Home > Enterprise >  How to read objdump in C
How to read objdump in C

Time:01-24

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

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?

CodePudding user response:

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.

  •  Tags:  
  • Related