comparison 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
comparison
equal deleted inserted replaced
76:7a0559016b68 77:590396e27e96
1 /*
2 * Code for working with the symbol table
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include "filestruct.h"
8 #include "intstruct.h"
9 #include "globals.h"
10
11 dump_symtab()
12 {
13 unsigned n;
14 struct internal_syment *sym;
15 char *sec, secstr[8];
16
17 printf("%-5s %-24s %-4s %-5s %-12s %-8s\n",
18 "Num", "Name", "Type", "Class", "Section", "Value");
19 for (n = 0; n < nsymtab; n++) {
20 sym = symtab[n];
21 if (!sym)
22 continue;
23 if (sym->scnum >= 1 && (unsigned)sym->scnum <= nsections)
24 sec = sections[sym->scnum - 1].name;
25 else {
26 sprintf(secstr, "%d", sym->scnum);
27 sec = secstr;
28 }
29 printf("%-5u %-24s %04X %-5d %-12s %08X%s\n",
30 n, sym->name, sym->type, sym->class,
31 sec, sym->value, sym->aux ? " Aux" : "");
32 }
33 return(0);
34 }