FreeCalypso > hg > freecalypso-reveng
diff ticoff/symtab.c @ 77:590396e27e96
tiobjd: basics dump streamlined
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 25 Mar 2014 22:47:51 +0000 |
parents | |
children | c2445afce514 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ticoff/symtab.c Tue Mar 25 22:47:51 2014 +0000 @@ -0,0 +1,34 @@ +/* + * Code for working with the symbol table + */ + +#include <sys/types.h> +#include <stdio.h> +#include "filestruct.h" +#include "intstruct.h" +#include "globals.h" + +dump_symtab() +{ + unsigned n; + struct internal_syment *sym; + char *sec, secstr[8]; + + printf("%-5s %-24s %-4s %-5s %-12s %-8s\n", + "Num", "Name", "Type", "Class", "Section", "Value"); + for (n = 0; n < nsymtab; n++) { + sym = symtab[n]; + if (!sym) + continue; + if (sym->scnum >= 1 && (unsigned)sym->scnum <= nsections) + sec = sections[sym->scnum - 1].name; + else { + sprintf(secstr, "%d", sym->scnum); + sec = secstr; + } + printf("%-5u %-24s %04X %-5d %-12s %08X%s\n", + n, sym->name, sym->type, sym->class, + sec, sym->value, sym->aux ? " Aux" : ""); + } + return(0); +}