comparison ticoff/disasm.c @ 125:b8ac21536779

tiobjd disasm: bss handling
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 04 Apr 2014 18:56:23 +0000
parents 700d77d5cf00
children 03f8a618689e
comparison
equal deleted inserted replaced
124:700d77d5cf00 125:b8ac21536779
10 #include "intstruct.h" 10 #include "intstruct.h"
11 #include "coffconst.h" 11 #include "coffconst.h"
12 #include "globals.h" 12 #include "globals.h"
13 13
14 extern unsigned get_u16(), get_u32(); 14 extern unsigned get_u16(), get_u32();
15 extern char *storage_class_to_string();
15 16
16 static void 17 static void
17 find_better_symbol(sec, symp, addp) 18 find_better_symbol(sec, symp, addp)
18 struct internal_scnhdr *sec; 19 struct internal_scnhdr *sec;
19 struct internal_syment **symp; 20 struct internal_syment **symp;
331 if (symnum < sec->nsymbols) 332 if (symnum < sec->nsymbols)
332 disasm_end_of_section(sec, symnum); 333 disasm_end_of_section(sec, symnum);
333 } 334 }
334 335
335 void 336 void
337 disasm_bss(sec)
338 struct internal_scnhdr *sec;
339 {
340 unsigned m;
341 struct internal_syment *sym;
342 char classbuf[8];
343
344 putchar('\n');
345 for (m = 0; m < sec->nsymbols; m++) {
346 sym = sec->sorted_symbols[m];
347 printf("%08X %-7s %s\n", sym->value,
348 storage_class_to_string(sym->class, classbuf),
349 sym->name);
350 }
351 printf("%08X <end of section>\n", sec->size);
352 }
353
354 void
336 disasm_sectype_by_name(sec) 355 disasm_sectype_by_name(sec)
337 struct internal_scnhdr *sec; 356 struct internal_scnhdr *sec;
338 { 357 {
339 if (!strncmp(sec->name, ".text", 5)) 358 if (!strncmp(sec->name, ".text", 5))
340 disasm_text_section(sec); 359 disasm_text_section(sec);
342 disasm_data_section(sec); 361 disasm_data_section(sec);
343 else if (!strcmp(sec->name, ".cinit")) 362 else if (!strcmp(sec->name, ".cinit"))
344 disasm_data_section(sec); 363 disasm_data_section(sec);
345 else if (!strcmp(sec->name, ".data")) 364 else if (!strcmp(sec->name, ".data"))
346 disasm_data_section(sec); 365 disasm_data_section(sec);
347 /* other section types to be added */ 366 else if (!strcmp(sec->name, ".bss"))
367 disasm_bss(sec);
348 else 368 else
349 printf("Unrecognized section type, skipped\n"); 369 printf("Unrecognized section type, skipped\n");
350 } 370 }
351 371
352 cmd_disasm() 372 cmd_disasm()