views:

59

answers:

1

How do I diassemble a an object program made on C(linux)? Can anyone please help me with the command line.

+5  A: 

Use objdump:

objdump -d -C file.o

Sample output:

     ...
0000015e <add_exclude>:
     15e:       55                      push   %ebp
     15f:       89 e5                   mov    %esp,%ebp
     161:       83 ec 08                sub    $0x8,%esp
     164:       a1 10 00 00 00          mov    0x10,%eax
     169:       3b 05 14 00 00 00       cmp    0x14,%eax
     16f:       7f 54                   jg     1c5 <add_exclude+0x67>
     171:       83 3d 10 00 00 00 00    cmpl   $0x0,0x10
     178:       75 1f                   jne    199 <add_exclude+0x3b>
     17a:       83 ec 0c                sub    $0xc,%esp
     17d:       c7 05 10 00 00 00 40    movl   $0x40,0x10
     184:       00 00 00
     187:       68 00 01 00 00          push   $0x100
     18c:       e8 fc ff ff ff          call   18d <add_exclude+0x2f>
     191:       83 c4 10                add    $0x10,%esp
     ...
vladr