Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22122

how to dump the .dynsym section of an ELF file? [duplicate]

$
0
0

As far as I know the .dynsym section is a bunch of ElfN_Sym structs arranged sequentially, so I'm trying to dump the st_name of all symbols but apparently there's something wrong with the way I'm parsing the file.

First thing I did was to get the index of the .dynsym section by iterating the section headers and comparing the sh_name field through the string table. Then I got the address of .dynsym by taking the sh_addr field:

Elf64_Sym *symbol = (Elf64_Sym *) shdr[i].sh_addr;
printf("%s\n", symbol->st_name);  

This however is SEGFAULTing for some reason, what I am doing wrong and what's the right way to do this? Also, is there a difference between using shdr[i].sh_addr and &shdr[i]?


Viewing all articles
Browse latest Browse all 22122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>