comparison leo-obj/tool/richsym.c @ 155:15743b40e03a

tiobjd ctypes: print more useful hex byte offsets for struct fields
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 02 May 2014 23:41:44 +0000
parents 6fe08feee018
children f7943bdbb3ea
comparison
equal deleted inserted replaced
154:1cd11badf287 155:15743b40e03a
321 char **argv; 321 char **argv;
322 { 322 {
323 int c; 323 int c;
324 unsigned n; 324 unsigned n;
325 struct internal_syment *sym; 325 struct internal_syment *sym;
326 326 int print_offsets = 0;
327 while ((c = getopt(argc, argv, "b")) != EOF) 327
328 while ((c = getopt(argc, argv, "bo")) != EOF)
328 switch (c) { 329 switch (c) {
329 case 'b': 330 case 'b':
330 richsym_print_bitsize++; 331 richsym_print_bitsize++;
332 continue;
333 case 'o':
334 print_offsets++;
331 continue; 335 continue;
332 default: 336 default:
333 /* error msg already printed */ 337 /* error msg already printed */
334 exit(1); 338 exit(1);
335 } 339 }
384 switch (sym->class) { 388 switch (sym->class) {
385 case C_MOS: 389 case C_MOS:
386 case C_MOU: 390 case C_MOU:
387 if (sym->scnum != -1) 391 if (sym->scnum != -1)
388 printf("\t/* MOS/MOU section != ABS! */\n"); 392 printf("\t/* MOS/MOU section != ABS! */\n");
389 else if (richsym_print_bitsize >= 2) 393 else if (print_offsets && !(sym->value & 7))
394 printf("\t/* offset: 0x%x */\n",
395 sym->value >> 3);
396 else if (print_offsets || richsym_print_bitsize >= 2)
390 printf("\t/* offset: %u bits */\n", sym->value); 397 printf("\t/* offset: %u bits */\n", sym->value);
391 richsym_print_in_c("\t", sym, 0); 398 richsym_print_in_c("\t", sym, 0);
392 continue; 399 continue;
393 case C_MOE: 400 case C_MOE:
394 if (sym->scnum != -1) { 401 if (sym->scnum != -1) {