Skip to content

Commit

Permalink
print symbol table
Browse files Browse the repository at this point in the history
  • Loading branch information
skaech committed Dec 12, 2012
1 parent 739774e commit 3c99b02
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions sandbox/bfd/bfd_package_patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ void printInfo(bfd *abfd, asection *sect, void *obj)
printf("section name %s\n", sect->name);
}

void printSymbolTable(bfd *abfd) {
long size;
asymbol **symbol_table;
long symbols;
long i;

if((size=bfd_get_symtab_upper_bound(abfd))<=0) {
return 1;
}

symbol_table=xmalloc(size);
if((symbols=bfd_canonicalize_symtab(abfd, symbol_table))<0) {
return 1;
}

for(i=0; i<symbols; i++) {
printf("symbol: %s\n", symbol_table[i]->name);
}
}


int main(int argc, char* argv[])
{
bfd_init();
Expand Down Expand Up @@ -38,5 +59,9 @@ int main(int argc, char* argv[])
return 1;
}

printf("section read\n");

printSymbolTable(abfd);

return 0;
}

0 comments on commit 3c99b02

Please sign in to comment.