Objdump

From Devpit
Jump to: navigation, search

Gathering the Section information with sed

objdump -x /usr/lib/libcrypt.so | \
sed -n '/Sections:/,/SYMBOL TABLE:/p' | \
sed -n '/Sections:\|SYMBOL TABLE:\|Idx/!p' |\
sed 's/^[ \t]*//' | \
sed '$!N;s/\n/ /'
  • objdump -x dumps the header information
  • sed #1 grabs all data between Sections: and SYMBOL TABLE:
  • sed #2 strips the Sections:, SYMBOL TABLE and Idx*** lines because they aren't relevant
  • sed #3 strips leading whitespace
  • sed #4 joins two adjoining lines into one

Below is an example invocation:

«user@host»:~§ objdump -x /usr/lib/libcrypt.so | \
sed -n '/Sections:/,/SYMBOL TABLE:/p' | \
sed -n '/Sections:\|SYMBOL TABLE:\|Idx/!p' | \
sed 's/^[ \t]*//' | \
sed '$!N;s/\n/ /'
0 .note.ABI-tag 00000020  00000134  00000134  00000134  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .hash         00000134  00000154  00000154  00000154  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .dynsym       00000240  00000288  00000288  00000288  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .dynstr       00000119  000004c8  000004c8  000004c8  2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .gnu.version  00000048  000005e2  000005e2  000005e2  2**1 CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .gnu.version_d 00000038  0000062c  0000062c  0000062c  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .gnu.version_r 00000030  00000664  00000664  00000664  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .rel.dyn      00000040  00000694  00000694  00000694  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .rel.plt      00000078  000006d4  000006d4  000006d4  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
9 .init         00000017  0000074c  0000074c  0000074c  2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE
10 .plt          00000100  00000764  00000764  00000764  2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .text         00002a24  00000870  00000870  00000870  2**4 CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .fini         0000001a  00003294  00003294  00003294  2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE
13 .rodata       00000f63  000032c0  000032c0  000032c0  2**5 CONTENTS, ALLOC, LOAD, READONLY, DATA
14 .interp       00000013  00004223  00004223  00004223  2**0 CONTENTS, ALLOC, LOAD, READONLY, DATA
15 .eh_frame     00000004  00004238  00004238  00004238  2**2 CONTENTS, ALLOC, LOAD, READONLY, DATA
16 .ctors        00000008  00005ef0  00005ef0  00004ef0  2**2 CONTENTS, ALLOC, LOAD, DATA
17 .dtors        00000008  00005ef8  00005ef8  00004ef8  2**2 CONTENTS, ALLOC, LOAD, DATA
18 .jcr          00000004  00005f00  00005f00  00004f00  2**2 CONTENTS, ALLOC, LOAD, DATA
19 .dynamic      000000d8  00005f04  00005f04  00004f04  2**2 CONTENTS, ALLOC, LOAD, DATA
20 .got          00000018  00005fdc  00005fdc  00004fdc  2**2 CONTENTS, ALLOC, LOAD, DATA
21 .got.plt      00000048  00005ff4  00005ff4  00004ff4  2**2 CONTENTS, ALLOC, LOAD, DATA
22 .data         00000008  0000603c  0000603c  0000503c  2**2 CONTENTS, ALLOC, LOAD, DATA
23 .bss          000270dc  00006060  00006060  00005044  2**5 ALLOC
24 .gnu_debuglink 00000018  00000000  00000000  00005044  2**0 CONTENTS, READONLY

Credits

  • The original content of this tutorial was provided by Ryan S. Arnold, aka RandomTask, from his engineering journal.