void load_strtab(Elf_Ehdr * pehdr, char *pexe) { Elf_Shdr *pshdr; char *shname; int i; strtab = NULL; for (i = 0; i < pehdr->e_shnum; i++) { pshdr = (Elf_Shdr *) (pexe + pehdr->e_shoff + (i * pehdr->e_shentsize)); shname = get_shstr(pshdr->sh_name); if (strcmp(".strtab", shname) == 0) break; } #ifdef DEBUG fprint_shstr(stdout, pshdr->sh_name); printf("\n"); #endif strtab = (char *) (pexe + pshdr->sh_offset); strtabsize = pshdr->sh_size; #ifdef DEBUG dump_strtab(); #endif }
int show_strtab( char **argv ) { if( *argv ) error_ret("bad args",-1); dump_strtab( get_elf() ); return( COMMAND_SUCCESS ); }