Home » Development and Build » Development, Debugging and Performance Tools » GDB » How to check sections and its memory map of Binary / ELF using GDB ?

How to check sections and its memory map of Binary / ELF using GDB ?

In this post, we hope you already have GDB debugging setup already done for your development or you can also simulate GDB debugging for ARM by following “Debugging ARM binary on Ubuntu Host using qemu ARM and GDB”

Once you are in GDB console, we can check the details of sections of ELF running on target using below command,

(gdb) maintenance info sections

This command Lists all the sections of the exec and core files and its memory mappings, as we can see in below output for our helloworld program from above post,

(gdb) maintenance info sections
Exec file:
    `/home/devlab/assembly/helloworld', file type elf32-littlearm.
 [0]      0x10114->0x10138 at 0x00000114: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS
 [1]      0x10138->0x10158 at 0x00000138: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS
 [2]      0x10158->0x10168 at 0x00000158: .rel.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS
 [3]      0x10168->0x10174 at 0x00000168: .init ALLOC LOAD READONLY CODE HAS_CONTENTS
 [4]      0x10174->0x10194 at 0x00000174: .iplt ALLOC LOAD READONLY CODE HAS_CONTENTS
 [5]      0x101c0->0x495f0 at 0x000001c0: .text ALLOC LOAD READONLY CODE HAS_CONTENTS
 [6]      0x495f0->0x49d7c at 0x000395f0: __libc_freeres_fn ALLOC LOAD READONLY CODE HAS_CONTENTS
 [7]      0x49d7c->0x49d84 at 0x00039d7c: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS
 [8]      0x49d84->0x60b74 at 0x00039d84: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS
 [9]      0x60b74->0x60b98 at 0x00050b74: __libc_subfreeres ALLOC LOAD READONLY DATA HAS_CONTENTS
 [10]     0x60b98->0x60e8c at 0x00050b98: __libc_IO_vtables ALLOC LOAD READONLY DATA HAS_CONTENTS
 [11]     0x60e8c->0x60e90 at 0x00050e8c: __libc_atexit ALLOC LOAD READONLY DATA HAS_CONTENTS
 [12]     0x60e90->0x61000 at 0x00050e90: .ARM.extab ALLOC LOAD READONLY DATA HAS_CONTENTS
 [13]     0x61000->0x61558 at 0x00051000: .ARM.exidx ALLOC LOAD READONLY DATA HAS_CONTENTS
 [14]     0x61558->0x6155c at 0x00051558: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS
 [15]     0x71b04->0x71b14 at 0x00051b04: .tdata ALLOC LOAD DATA HAS_CONTENTS
 [16]     0x71b14->0x71b34 at 0x00051b14: .tbss ALLOC
 [17]     0x71b14->0x71b18 at 0x00051b14: .init_array ALLOC LOAD DATA HAS_CONTENTS
 [18]     0x71b18->0x71b20 at 0x00051b18: .fini_array ALLOC LOAD DATA HAS_CONTENTS
 [19]     0x71b20->0x72000 at 0x00051b20: .data.rel.ro ALLOC LOAD DATA HAS_CONTENTS
 [20]     0x72000->0x72084 at 0x00052000: .got ALLOC LOAD DATA HAS_CONTENTS
 [21]     0x72088->0x72e74 at 0x00052088: .data ALLOC LOAD DATA HAS_CONTENTS
 [22]     0x72e78->0x73918 at 0x00052e74: .bss ALLOC
 [23]     0x73918->0x7392c at 0x00052e74: __libc_freeres_ptrs ALLOC
 [24]     0x0000->0x002a at 0x00052e74: .comment READONLY HAS_CONTENTS
 [25]     0x0000->0x0035 at 0x00052e9e: .ARM.attributes READONLY HAS_CONTENTS
 [26]     0x0000->0x0020 at 0x00052ed3: .debug_aranges READONLY HAS_CONTENTS
 [27]     0x0000->0x0343 at 0x00052ef3: .debug_info READONLY HAS_CONTENTS
 [28]     0x0000->0x00f2 at 0x00053236: .debug_abbrev READONLY HAS_CONTENTS
 [29]     0x0000->0x013b at 0x00053328: .debug_line READONLY HAS_CONTENTS
 [30]     0x0000->0x0034 at 0x00053464: .debug_frame READONLY HAS_CONTENTS
 [31]     0x0000->0x02af at 0x00053498: .debug_str READONLY HAS_CONTENTS

1 thought on “How to check sections and its memory map of Binary / ELF using GDB ?”

Leave a Comment