diff options
Diffstat (limited to 'src/printing/sections.c')
-rw-r--r-- | src/printing/sections.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/printing/sections.c b/src/printing/sections.c deleted file mode 100644 index ec0ff43..0000000 --- a/src/printing/sections.c +++ /dev/null @@ -1,63 +0,0 @@ -#include <stdio.h> - -#include <libelf/libelf.h> -#include <libelf/gelf.h> - -#include <libelfu/libelfu.h> -#include "printing.h" - - -void printSegmentsWithSection(Elf *e, Elf_Scn *scn) -{ - GElf_Phdr phdr; - GElf_Shdr shdr; - int i; - size_t n; - - - if (gelf_getshdr(scn, &shdr) != &shdr) { - fprintf(stderr, "gelf_getshdr() failed: %s\n", elf_errmsg(-1)); - return; - } - - if (elf_getphdrnum(e, &n)) { - fprintf(stderr, "elf_getphdrnum() failed: %s\n", elf_errmsg(-1)); - return; - } - - for (i = 0; i < n; i++) { - if (gelf_getphdr(e, i, &phdr) != &phdr) { - fprintf(stderr, "getphdr() failed for #%d: %s\n", i, elf_errmsg(-1)); - continue; - } - - if (PHDR_CONTAINS_SCN_IN_MEMORY(&phdr, &shdr)) { - printf(" %d %s\n", i, segmentTypeStr(phdr.p_type)); - } - } -} - - -void printSection(Elf *e, Elf_Scn *scn) -{ - printf(" %jd: %s\n", - (uintmax_t) elf_ndxscn(scn), - elfu_eScnName(e, scn)); -} - - -void printSections(Elf *e) -{ - Elf_Scn *scn; - - printf("Sections:\n"); - - scn = elf_getscn(e, 0); - - while (scn) { - printSection(e, scn); - //printSegmentsWithSection(e, scn); - - scn = elf_nextscn(e, scn); - } -} |