00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "config.h"
00025 #include "system.h"
00026 #include "coretypes.h"
00027 #include "tm.h"
00028 #include "version.h"
00029 #ifdef index
00030 #undef index
00031 #endif
00032 #ifndef CROSS_COMPILE
00033 #include <a.out.h>
00034 #else
00035 #include "mips/a.out.h"
00036 #endif
00037
00038
00039 #include "getopt.h"
00040
00041 #ifndef MIPS_IS_STAB
00042
00043
00044
00045
00046
00047
00048
00049 #define CODE_MASK 0x8F300
00050 #define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
00051 #define MIPS_MARK_STAB(code) ((code)+CODE_MASK)
00052 #define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
00053 #endif
00054
00055 #define uchar unsigned char
00056 #define ushort unsigned short
00057 #define uint unsigned int
00058 #define ulong unsigned long
00059
00060
00061
00062
00063
00064 #ifndef stStaParam
00065 #define stStaParam 16
00066 #endif
00067
00068 #ifndef btVoid
00069 #define btVoid 26
00070 #endif
00071
00072 typedef enum sc {
00073 sc_Nil = scNil,
00074 sc_Text = scText,
00075 sc_Data = scData,
00076 sc_Bss = scBss,
00077 sc_Register = scRegister,
00078 sc_Abs = scAbs,
00079 sc_Undefined = scUndefined,
00080 sc_CdbLocal = scCdbLocal,
00081 sc_Bits = scBits,
00082 sc_CdbSystem = scCdbSystem,
00083 sc_RegImage = scRegImage,
00084 sc_Info = scInfo,
00085 sc_UserStruct = scUserStruct,
00086 sc_SData = scSData,
00087 sc_SBss = scSBss,
00088 sc_RData = scRData,
00089 sc_Var = scVar,
00090 sc_Common = scCommon,
00091 sc_SCommon = scSCommon,
00092 sc_VarRegister = scVarRegister,
00093 sc_Variant = scVariant,
00094 sc_SUndefined = scSUndefined,
00095 sc_Init = scInit,
00096 sc_Max = scMax
00097 } sc_t;
00098
00099
00100
00101 typedef enum st {
00102 st_Nil = stNil,
00103 st_Global = stGlobal,
00104 st_Static = stStatic,
00105 st_Param = stParam,
00106 st_Local = stLocal,
00107 st_Label = stLabel,
00108 st_Proc = stProc,
00109 st_Block = stBlock,
00110 st_End = stEnd,
00111 st_Member = stMember,
00112 st_Typedef = stTypedef,
00113 st_File = stFile,
00114 st_RegReloc = stRegReloc,
00115 st_Forward = stForward,
00116 st_StaticProc = stStaticProc,
00117 st_StaParam = stStaParam,
00118 st_Constant = stConstant,
00119 #ifdef stStruct
00120 st_Struct = stStruct,
00121 st_Union = stUnion,
00122 st_Enum = stEnum,
00123 #endif
00124 st_Str = stStr,
00125 st_Number = stNumber,
00126 st_Expr = stExpr,
00127 st_Type = stType,
00128 st_Max = stMax
00129 } st_t;
00130
00131
00132
00133 typedef enum tq {
00134 tq_Nil = tqNil,
00135 tq_Ptr = tqPtr,
00136 tq_Proc = tqProc,
00137 tq_Array = tqArray,
00138 tq_Far = tqFar,
00139 tq_Vol = tqVol,
00140 tq_Max = tqMax
00141 } tq_t;
00142
00143
00144
00145 typedef enum bt {
00146 bt_Nil = btNil,
00147 bt_Adr = btAdr,
00148 bt_Char = btChar,
00149 bt_UChar = btUChar,
00150 bt_Short = btShort,
00151 bt_UShort = btUShort,
00152 bt_Int = btInt,
00153 bt_UInt = btUInt,
00154 bt_Long = btLong,
00155 bt_ULong = btULong,
00156 bt_Float = btFloat,
00157 bt_Double = btDouble,
00158 bt_Struct = btStruct,
00159 bt_Union = btUnion,
00160 bt_Enum = btEnum,
00161 bt_Typedef = btTypedef,
00162 bt_Range = btRange,
00163 bt_Set = btSet,
00164 bt_Complex = btComplex,
00165 bt_DComplex = btDComplex,
00166 bt_Indirect = btIndirect,
00167 bt_FixedDec = btFixedDec,
00168 bt_FloatDec = btFloatDec,
00169 bt_String = btString,
00170 bt_Bit = btBit,
00171 bt_Picture = btPicture,
00172 bt_Void = btVoid,
00173 bt_Max = btMax
00174 } bt_t;
00175
00176
00177
00178 typedef enum lang {
00179 lang_C = langC,
00180 lang_Pascal = langPascal,
00181 lang_Fortran = langFortran,
00182 lang_Assembler = langAssembler,
00183 lang_Machine = langMachine,
00184 lang_Nil = langNil,
00185 lang_Ada = langAda,
00186 lang_Pl1 = langPl1,
00187 lang_Cobol = langCobol
00188 } lang_t;
00189
00190
00191
00192 typedef enum glevel {
00193 glevel_0 = GLEVEL_0,
00194 glevel_1 = GLEVEL_1,
00195 glevel_2 = GLEVEL_2,
00196 glevel_3 = GLEVEL_3
00197 } glevel_t;
00198
00199
00200
00201 typedef struct scope {
00202 struct scope *prev;
00203 ulong open_sym;
00204 sc_t sc;
00205 st_t st;
00206 } scope_t;
00207
00208 struct filehdr global_hdr;
00209
00210 int errors = 0;
00211 int want_aux = 0;
00212 int want_line = 0;
00213 int want_rfd = 0;
00214 int want_scope = 0;
00215 int tfile = 0;
00216 int version = 0;
00217 int verbose = 0;
00218 int tfile_fd;
00219 off_t tfile_offset;
00220 scope_t *cur_scope = 0;
00221 scope_t *free_scope = 0;
00222 HDRR sym_hdr;
00223 char *l_strings;
00224 char *e_strings;
00225 SYMR *l_symbols;
00226 EXTR *e_symbols;
00227 LINER *lines;
00228 DNR *dense_nums;
00229 OPTR *opt_symbols;
00230 AUXU *aux_symbols;
00231 char *aux_used;
00232 FDR *file_desc;
00233 ulong *rfile_desc;
00234 PDR *proc_desc;
00235
00236
00237 static void *read_seek (void *, size_t, off_t, const char *);
00238 static void read_tfile (void);
00239 static void print_global_hdr (struct filehdr *);
00240 static void print_sym_hdr (HDRR *);
00241 static void print_file_desc (FDR *, int);
00242 static void print_symbol (SYMR *, int, const char *, AUXU *, int, FDR *);
00243 static void print_aux (AUXU, int, int);
00244 static void emit_aggregate (char *, AUXU, AUXU, const char *, FDR *);
00245 static const char *st_to_string (st_t);
00246 static const char *sc_to_string (sc_t);
00247 static const char *glevel_to_string (glevel_t);
00248 static const char *lang_to_string (lang_t);
00249 static const char *type_to_string (AUXU *, int, FDR *);
00250
00251 extern char *optarg;
00252 extern int optind;
00253 extern int opterr;
00254
00255
00256
00257 #define __define_stab(NAME, CODE, STRING) {(int)CODE, STRING},
00258 const struct {const short code; const char string[10];} stab_names[] = {
00259 #include "stab.def"
00260 #undef __define_stab
00261 };
00262
00263
00264
00265 static const struct option options[] =
00266 {
00267 { "version", 0, 0, 'V' },
00268 { "verbose", 0, 0, 'v' },
00269 { 0, 0, 0, 0 }
00270 };
00271
00272
00273
00274
00275
00276
00277 static void *
00278 read_seek (void *ptr, size_t size, off_t offset, const char *context)
00279 {
00280 long read_size = 0;
00281
00282 if (size == 0)
00283 return ptr;
00284
00285 if (!ptr)
00286 ptr = xmalloc (size);
00287
00288 if ((tfile_offset != offset && lseek (tfile_fd, offset, 0) == -1)
00289 || (read_size = read (tfile_fd, ptr, size)) < 0)
00290 {
00291 perror (context);
00292 exit (1);
00293 }
00294
00295 if (read_size != (long) size)
00296 {
00297 fprintf (stderr, "%s: read %ld bytes, expected %ld bytes\n",
00298 context, read_size, (long) size);
00299 exit (1);
00300 }
00301
00302 tfile_offset = offset + size;
00303 return ptr;
00304 }
00305
00306
00307
00308
00309 static const char *
00310 lang_to_string (lang_t lang)
00311 {
00312 switch (lang)
00313 {
00314 case langC: return "C";
00315 case langPascal: return "Pascal";
00316 case langFortran: return "Fortran";
00317 case langAssembler: return "Assembler";
00318 case langMachine: return "Machine";
00319 case langNil: return "Nil";
00320 case langAda: return "Ada";
00321 case langPl1: return "Pl1";
00322 case langCobol: return "Cobol";
00323 }
00324
00325 return "Unknown language";
00326 }
00327
00328
00329
00330
00331 static const char *
00332 sc_to_string (sc_t storage_class)
00333 {
00334 switch(storage_class)
00335 {
00336 case sc_Nil: return "Nil";
00337 case sc_Text: return "Text";
00338 case sc_Data: return "Data";
00339 case sc_Bss: return "Bss";
00340 case sc_Register: return "Register";
00341 case sc_Abs: return "Abs";
00342 case sc_Undefined: return "Undefined";
00343 case sc_CdbLocal: return "CdbLocal";
00344 case sc_Bits: return "Bits";
00345 case sc_CdbSystem: return "CdbSystem";
00346 case sc_RegImage: return "RegImage";
00347 case sc_Info: return "Info";
00348 case sc_UserStruct: return "UserStruct";
00349 case sc_SData: return "SData";
00350 case sc_SBss: return "SBss";
00351 case sc_RData: return "RData";
00352 case sc_Var: return "Var";
00353 case sc_Common: return "Common";
00354 case sc_SCommon: return "SCommon";
00355 case sc_VarRegister: return "VarRegister";
00356 case sc_Variant: return "Variant";
00357 case sc_SUndefined: return "SUndefined";
00358 case sc_Init: return "Init";
00359 case sc_Max: return "Max";
00360 }
00361
00362 return "???";
00363 }
00364
00365
00366
00367
00368 static const char *
00369 st_to_string (st_t symbol_type)
00370 {
00371 switch(symbol_type)
00372 {
00373 case st_Nil: return "Nil";
00374 case st_Global: return "Global";
00375 case st_Static: return "Static";
00376 case st_Param: return "Param";
00377 case st_Local: return "Local";
00378 case st_Label: return "Label";
00379 case st_Proc: return "Proc";
00380 case st_Block: return "Block";
00381 case st_End: return "End";
00382 case st_Member: return "Member";
00383 case st_Typedef: return "Typedef";
00384 case st_File: return "File";
00385 case st_RegReloc: return "RegReloc";
00386 case st_Forward: return "Forward";
00387 case st_StaticProc: return "StaticProc";
00388 case st_Constant: return "Constant";
00389 case st_StaParam: return "StaticParam";
00390 #ifdef stStruct
00391 case st_Struct: return "Struct";
00392 case st_Union: return "Union";
00393 case st_Enum: return "Enum";
00394 #endif
00395 case st_Str: return "String";
00396 case st_Number: return "Number";
00397 case st_Expr: return "Expr";
00398 case st_Type: return "Type";
00399 case st_Max: return "Max";
00400 }
00401
00402 return "???";
00403 }
00404
00405
00406
00407
00408 static const char *
00409 glevel_to_string (glevel_t g_level)
00410 {
00411 switch(g_level)
00412 {
00413 case GLEVEL_0: return "G0";
00414 case GLEVEL_1: return "G1";
00415 case GLEVEL_2: return "G2";
00416 case GLEVEL_3: return "G3";
00417 }
00418
00419 return "??";
00420 }
00421
00422
00423
00424
00425 static const char *
00426 type_to_string (AUXU *aux_ptr, int index, FDR *fdp)
00427 {
00428 AUXU u;
00429 struct qual {
00430 tq_t type;
00431 int low_bound;
00432 int high_bound;
00433 int stride;
00434 } qualifiers[7];
00435
00436 bt_t basic_type;
00437 int i;
00438 static char buffer1[1024];
00439 static char buffer2[1024];
00440 char *p1 = buffer1;
00441 char *p2 = buffer2;
00442 char *used_ptr = aux_used + (aux_ptr - aux_symbols);
00443
00444 for (i = 0; i < 7; i++)
00445 {
00446 qualifiers[i].low_bound = 0;
00447 qualifiers[i].high_bound = 0;
00448 qualifiers[i].stride = 0;
00449 }
00450
00451 used_ptr[index] = 1;
00452 u = aux_ptr[index++];
00453 if (u.isym == -1)
00454 return "-1 (no type)";
00455
00456 basic_type = (bt_t) u.ti.bt;
00457 qualifiers[0].type = (tq_t) u.ti.tq0;
00458 qualifiers[1].type = (tq_t) u.ti.tq1;
00459 qualifiers[2].type = (tq_t) u.ti.tq2;
00460 qualifiers[3].type = (tq_t) u.ti.tq3;
00461 qualifiers[4].type = (tq_t) u.ti.tq4;
00462 qualifiers[5].type = (tq_t) u.ti.tq5;
00463 qualifiers[6].type = tq_Nil;
00464
00465
00466
00467
00468 switch (basic_type)
00469 {
00470 case bt_Nil:
00471 strcpy (p1, "nil");
00472 break;
00473
00474 case bt_Adr:
00475 strcpy (p1, "address");
00476 break;
00477
00478 case bt_Char:
00479 strcpy (p1, "char");
00480 break;
00481
00482 case bt_UChar:
00483 strcpy (p1, "unsigned char");
00484 break;
00485
00486 case bt_Short:
00487 strcpy (p1, "short");
00488 break;
00489
00490 case bt_UShort:
00491 strcpy (p1, "unsigned short");
00492 break;
00493
00494 case bt_Int:
00495 strcpy (p1, "int");
00496 break;
00497
00498 case bt_UInt:
00499 strcpy (p1, "unsigned int");
00500 break;
00501
00502 case bt_Long:
00503 strcpy (p1, "long");
00504 break;
00505
00506 case bt_ULong:
00507 strcpy (p1, "unsigned long");
00508 break;
00509
00510 case bt_Float:
00511 strcpy (p1, "float");
00512 break;
00513
00514 case bt_Double:
00515 strcpy (p1, "double");
00516 break;
00517
00518
00519
00520
00521
00522 case bt_Struct:
00523 emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "struct", fdp);
00524 used_ptr[index] = 1;
00525 if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
00526 used_ptr[++index] = 1;
00527
00528 index++;
00529 break;
00530
00531
00532
00533
00534
00535 case bt_Union:
00536 emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "union", fdp);
00537 used_ptr[index] = 1;
00538 if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
00539 used_ptr[++index] = 1;
00540
00541 index++;
00542 break;
00543
00544
00545
00546
00547
00548 case bt_Enum:
00549 emit_aggregate (p1, aux_ptr[index], aux_ptr[index+1], "enum", fdp);
00550 used_ptr[index] = 1;
00551 if (aux_ptr[index].rndx.rfd == ST_RFDESCAPE)
00552 used_ptr[++index] = 1;
00553
00554 index++;
00555 break;
00556
00557 case bt_Typedef:
00558 strcpy (p1, "typedef");
00559 break;
00560
00561 case bt_Range:
00562 strcpy (p1, "subrange");
00563 break;
00564
00565 case bt_Set:
00566 strcpy (p1, "set");
00567 break;
00568
00569 case bt_Complex:
00570 strcpy (p1, "complex");
00571 break;
00572
00573 case bt_DComplex:
00574 strcpy (p1, "double complex");
00575 break;
00576
00577 case bt_Indirect:
00578 strcpy (p1, "forward/unnamed typedef");
00579 break;
00580
00581 case bt_FixedDec:
00582 strcpy (p1, "fixed decimal");
00583 break;
00584
00585 case bt_FloatDec:
00586 strcpy (p1, "float decimal");
00587 break;
00588
00589 case bt_String:
00590 strcpy (p1, "string");
00591 break;
00592
00593 case bt_Bit:
00594 strcpy (p1, "bit");
00595 break;
00596
00597 case bt_Picture:
00598 strcpy (p1, "picture");
00599 break;
00600
00601 case bt_Void:
00602 strcpy (p1, "void");
00603 break;
00604
00605 default:
00606 sprintf (p1, "Unknown basic type %d", (int) basic_type);
00607 break;
00608 }
00609
00610 p1 += strlen (buffer1);
00611
00612
00613
00614
00615 if (u.ti.fBitfield)
00616 {
00617 int bitsize;
00618
00619 used_ptr[index] = 1;
00620 bitsize = aux_ptr[index++].width;
00621 sprintf (p1, " : %d", bitsize);
00622 p1 += strlen (buffer1);
00623 }
00624
00625
00626
00627
00628
00629 if (qualifiers[0].type != tq_Nil)
00630 {
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640 for (i = 0; i < 7; i++)
00641 {
00642 if (qualifiers[i].type == tq_Array)
00643 {
00644 qualifiers[i].low_bound = aux_ptr[index+2].dnLow;
00645 qualifiers[i].high_bound = aux_ptr[index+3].dnHigh;
00646 qualifiers[i].stride = aux_ptr[index+4].width;
00647 used_ptr[index] = 1;
00648 used_ptr[index+1] = 1;
00649 used_ptr[index+2] = 1;
00650 used_ptr[index+3] = 1;
00651 used_ptr[index+4] = 1;
00652 index += 5;
00653 }
00654 }
00655
00656
00657
00658
00659 for (i = 0; i < 6; i++)
00660 {
00661 switch (qualifiers[i].type)
00662 {
00663 case tq_Nil:
00664 case tq_Max:
00665 break;
00666
00667 case tq_Ptr:
00668 strcpy (p2, "ptr to ");
00669 p2 += sizeof ("ptr to ")-1;
00670 break;
00671
00672 case tq_Vol:
00673 strcpy (p2, "volatile ");
00674 p2 += sizeof ("volatile ")-1;
00675 break;
00676
00677 case tq_Far:
00678 strcpy (p2, "far ");
00679 p2 += sizeof ("far ")-1;
00680 break;
00681
00682 case tq_Proc:
00683 strcpy (p2, "func. ret. ");
00684 p2 += sizeof ("func. ret. ");
00685 break;
00686
00687 case tq_Array:
00688 {
00689 int first_array = i;
00690 int j;
00691
00692
00693
00694
00695 while (i < 5 && qualifiers[i+1].type == tq_Array)
00696 i++;
00697
00698 for (j = i; j >= first_array; j--)
00699 {
00700 strcpy (p2, "array [");
00701 p2 += sizeof ("array [")-1;
00702 if (qualifiers[j].low_bound != 0)
00703 sprintf (p2,
00704 "%ld:%ld {%ld bits}",
00705 (long) qualifiers[j].low_bound,
00706 (long) qualifiers[j].high_bound,
00707 (long) qualifiers[j].stride);
00708
00709 else if (qualifiers[j].high_bound != -1)
00710 sprintf (p2,
00711 "%ld {%ld bits}",
00712 (long) (qualifiers[j].high_bound + 1),
00713 (long) (qualifiers[j].stride));
00714
00715 else
00716 sprintf (p2, " {%ld bits}", (long) (qualifiers[j].stride));
00717
00718 p2 += strlen (p2);
00719 strcpy (p2, "] of ");
00720 p2 += sizeof ("] of ")-1;
00721 }
00722 }
00723 break;
00724 }
00725 }
00726 }
00727
00728 strcpy (p2, buffer1);
00729 return buffer2;
00730 }
00731
00732
00733
00734
00735 static void
00736 print_global_hdr (struct filehdr *ptr)
00737 {
00738 char *time = ctime ((time_t *)&ptr->f_timdat);
00739 ushort flags = ptr->f_flags;
00740
00741 printf("Global file header:\n");
00742 printf(" %-*s 0x%x\n", 24, "magic number", (ushort) ptr->f_magic);
00743 printf(" %-*s %d\n", 24, "# sections", (int) ptr->f_nscns);
00744 printf(" %-*s %ld, %s", 24, "timestamp", (long) ptr->f_timdat, time);
00745 printf(" %-*s %ld\n", 24, "symbolic header offset", (long) ptr->f_symptr);
00746 printf(" %-*s %ld\n", 24, "symbolic header size", (long) ptr->f_nsyms);
00747 printf(" %-*s %ld\n", 24, "optional header", (long) ptr->f_opthdr);
00748 printf(" %-*s 0x%x", 24, "flags", (ushort) flags);
00749
00750 if ((flags & F_RELFLG) != 0)
00751 printf (", F_RELFLG");
00752
00753 if ((flags & F_EXEC) != 0)
00754 printf (", F_EXEC");
00755
00756 if ((flags & F_LNNO) != 0)
00757 printf (", F_LNNO");
00758
00759 if ((flags & F_LSYMS) != 0)
00760 printf (", F_LSYMS");
00761
00762 if ((flags & F_MINMAL) != 0)
00763 printf (", F_MINMAL");
00764
00765 if ((flags & F_UPDATE) != 0)
00766 printf (", F_UPDATE");
00767
00768 if ((flags & F_SWABD) != 0)
00769 printf (", F_SWABD");
00770
00771 if ((flags & F_AR16WR) != 0)
00772 printf (", F_AR16WR");
00773
00774 if ((flags & F_AR32WR) != 0)
00775 printf (", F_AR32WR");
00776
00777 if ((flags & F_AR32W) != 0)
00778 printf (", F_AR32W");
00779
00780 if ((flags & F_PATCH) != 0)
00781 printf (", F_PATCH/F_NODF");
00782
00783 printf ("\n\n");
00784 }
00785
00786
00787
00788
00789 static void
00790 print_sym_hdr (HDRR *sym_ptr)
00791 {
00792 int width = 20;
00793
00794 printf("Symbolic header, magic number = 0x%04x, vstamp = %d.%d:\n\n",
00795 sym_ptr->magic & 0xffff,
00796 (sym_ptr->vstamp & 0xffff) >> 8,
00797 sym_ptr->vstamp & 0xff);
00798
00799 printf(" %-*s %11s %11s %11s\n", width, "Info", "Offset", "Number", "Bytes");
00800 printf(" %-*s %11s %11s %11s\n", width, "====", "======", "======", "=====\n");
00801
00802 printf(" %-*s %11ld %11ld %11ld [%d]\n", width, "Line numbers",
00803 (long) sym_ptr->cbLineOffset,
00804 (long) sym_ptr->cbLine,
00805 (long) sym_ptr->cbLine,
00806 (int) sym_ptr->ilineMax);
00807
00808 printf(" %-*s %11ld %11ld %11ld\n", width, "Dense numbers",
00809 (long) sym_ptr->cbDnOffset,
00810 (long) sym_ptr->idnMax,
00811 (long) (sym_ptr->idnMax * sizeof (DNR)));
00812
00813 printf(" %-*s %11ld %11ld %11ld\n", width, "Procedures Tables",
00814 (long) sym_ptr->cbPdOffset,
00815 (long) sym_ptr->ipdMax,
00816 (long) (sym_ptr->ipdMax * sizeof (PDR)));
00817
00818 printf(" %-*s %11ld %11ld %11ld\n", width, "Local Symbols",
00819 (long) sym_ptr->cbSymOffset,
00820 (long) sym_ptr->isymMax,
00821 (long) (sym_ptr->isymMax * sizeof (SYMR)));
00822
00823 printf(" %-*s %11ld %11ld %11ld\n", width, "Optimization Symbols",
00824 (long) sym_ptr->cbOptOffset,
00825 (long) sym_ptr->ioptMax,
00826 (long) (sym_ptr->ioptMax * sizeof (OPTR)));
00827
00828 printf(" %-*s %11ld %11ld %11ld\n", width, "Auxiliary Symbols",
00829 (long) sym_ptr->cbAuxOffset,
00830 (long) sym_ptr->iauxMax,
00831 (long) (sym_ptr->iauxMax * sizeof (AUXU)));
00832
00833 printf(" %-*s %11ld %11ld %11ld\n", width, "Local Strings",
00834 (long) sym_ptr->cbSsOffset,
00835 (long) sym_ptr->issMax,
00836 (long) sym_ptr->issMax);
00837
00838 printf(" %-*s %11ld %11ld %11ld\n", width, "External Strings",
00839 (long) sym_ptr->cbSsExtOffset,
00840 (long) sym_ptr->issExtMax,
00841 (long) sym_ptr->issExtMax);
00842
00843 printf(" %-*s %11ld %11ld %11ld\n", width, "File Tables",
00844 (long) sym_ptr->cbFdOffset,
00845 (long) sym_ptr->ifdMax,
00846 (long) (sym_ptr->ifdMax * sizeof (FDR)));
00847
00848 printf(" %-*s %11ld %11ld %11ld\n", width, "Relative Files",
00849 (long) sym_ptr->cbRfdOffset,
00850 (long) sym_ptr->crfd,
00851 (long) (sym_ptr->crfd * sizeof (ulong)));
00852
00853 printf(" %-*s %11ld %11ld %11ld\n", width, "External Symbols",
00854 (long) sym_ptr->cbExtOffset,
00855 (long) sym_ptr->iextMax,
00856 (long) (sym_ptr->iextMax * sizeof (EXTR)));
00857 }
00858
00859
00860
00861
00862 static void
00863 print_symbol (SYMR *sym_ptr, int number, const char *strbase, AUXU *aux_base,
00864 int ifd, FDR *fdp)
00865 {
00866 sc_t storage_class = (sc_t) sym_ptr->sc;
00867 st_t symbol_type = (st_t) sym_ptr->st;
00868 ulong index = sym_ptr->index;
00869 char *used_ptr = aux_used + (aux_base - aux_symbols);
00870 scope_t *scope_ptr;
00871
00872 printf ("\n Symbol# %d: \"%s\"\n", number, sym_ptr->iss + strbase);
00873
00874 if (aux_base != (AUXU *) 0 && index != indexNil)
00875 switch (symbol_type)
00876 {
00877 case st_Nil:
00878 case st_Label:
00879 break;
00880
00881 case st_File:
00882 case st_Block:
00883 printf (" End+1 symbol: %ld\n", index);
00884 if (want_scope)
00885 {
00886 if (free_scope == (scope_t *) 0)
00887 scope_ptr = xmalloc (sizeof (scope_t));
00888 else
00889 {
00890 scope_ptr = free_scope;
00891 free_scope = scope_ptr->prev;
00892 }
00893 scope_ptr->open_sym = number;
00894 scope_ptr->st = symbol_type;
00895 scope_ptr->sc = storage_class;
00896 scope_ptr->prev = cur_scope;
00897 cur_scope = scope_ptr;
00898 }
00899 break;
00900
00901 case st_End:
00902 if (storage_class == sc_Text || storage_class == sc_Info)
00903 printf (" First symbol: %ld\n", index);
00904 else
00905 {
00906 used_ptr[index] = 1;
00907 printf (" First symbol: %ld\n", (long) aux_base[index].isym);
00908 }
00909
00910 if (want_scope)
00911 {
00912 if (cur_scope == (scope_t *) 0)
00913 printf (" Can't pop end scope\n");
00914 else
00915 {
00916 scope_ptr = cur_scope;
00917 cur_scope = scope_ptr->prev;
00918 scope_ptr->prev = free_scope;
00919 free_scope = scope_ptr;
00920 }
00921 }
00922 break;
00923
00924 case st_Proc:
00925 case st_StaticProc:
00926 if (MIPS_IS_STAB(sym_ptr))
00927 ;
00928 else if (ifd == -1)
00929 {
00930 used_ptr[index] = used_ptr[index+1] = 1;
00931 printf (" End+1 symbol: %-7ld Type: %s\n",
00932 (long) aux_base[index].isym,
00933 type_to_string (aux_base, index+1, fdp));
00934 }
00935 else
00936 printf (" Local symbol: %ld\n", index);
00937
00938 if (want_scope)
00939 {
00940 if (free_scope == (scope_t *) 0)
00941 scope_ptr = xmalloc (sizeof (scope_t));
00942 else
00943 {
00944 scope_ptr = free_scope;
00945 free_scope = scope_ptr->prev;
00946 }
00947 scope_ptr->open_sym = number;
00948 scope_ptr->st = symbol_type;
00949 scope_ptr->sc = storage_class;
00950 scope_ptr->prev = cur_scope;
00951 cur_scope = scope_ptr;
00952 }
00953 break;
00954
00955 #ifdef stStruct
00956 case st_Struct:
00957 case st_Union:
00958 case st_Enum:
00959 printf (" End+1 symbol: %lu\n", index);
00960 break;
00961 #endif
00962
00963 default:
00964 if (!MIPS_IS_STAB (sym_ptr))
00965 {
00966 used_ptr[index] = 1;
00967 printf (" Type: %s\n",
00968 type_to_string (aux_base, index, fdp));
00969 }
00970 break;
00971 }
00972
00973 if (want_scope)
00974 {
00975 printf (" Scopes: ");
00976 if (cur_scope == (scope_t *) 0)
00977 printf (" none\n");
00978 else
00979 {
00980 for (scope_ptr = cur_scope;
00981 scope_ptr != (scope_t *) 0;
00982 scope_ptr = scope_ptr->prev)
00983 {
00984 const char *class;
00985 if (scope_ptr->st == st_Proc || scope_ptr->st == st_StaticProc)
00986 class = "func.";
00987 else if (scope_ptr->st == st_File)
00988 class = "file";
00989 else if (scope_ptr->st == st_Block && scope_ptr->sc == sc_Text)
00990 class = "block";
00991 else if (scope_ptr->st == st_Block && scope_ptr->sc == sc_Info)
00992 class = "type";
00993 else
00994 class = "???";
00995
00996 printf (" %ld [%s]", scope_ptr->open_sym, class);
00997 }
00998 printf ("\n");
00999 }
01000 }
01001
01002 printf (" Value: %-13ld ",
01003 (long)sym_ptr->value);
01004 if (ifd == -1)
01005 printf ("String index: %ld\n", (long)sym_ptr->iss);
01006 else
01007 printf ("String index: %-11ld Ifd: %d\n",
01008 (long)sym_ptr->iss, ifd);
01009
01010 printf (" Symbol type: %-11sStorage class: %-11s",
01011 st_to_string (symbol_type), sc_to_string (storage_class));
01012
01013 if (MIPS_IS_STAB(sym_ptr))
01014 {
01015 int i = ARRAY_SIZE (stab_names);
01016 const char *stab_name = "stab";
01017 short code = MIPS_UNMARK_STAB(sym_ptr->index);
01018
01019 while (--i >= 0)
01020 if (stab_names[i].code == code)
01021 {
01022 stab_name = stab_names[i].string;
01023 break;
01024 }
01025 printf ("Index: 0x%lx (%s)\n", (long)sym_ptr->index, stab_name);
01026 }
01027 else if (sym_ptr->st == stLabel && sym_ptr->index != indexNil)
01028 printf ("Index: %ld (line#)\n", (long)sym_ptr->index);
01029 else
01030 printf ("Index: %ld\n", (long)sym_ptr->index);
01031
01032 }
01033
01034
01035
01036
01037 static void
01038 print_aux (AUXU u, int auxi, int used)
01039 {
01040 printf ("\t%s#%-5d %11ld, [%4ld/%7ld], [%2d %1d:%1d %1x:%1x:%1x:%1x:%1x:%1x]\n",
01041 (used) ? " " : "* ",
01042 auxi,
01043 (long) u.isym,
01044 (long) u.rndx.rfd,
01045 (long) u.rndx.index,
01046 u.ti.bt,
01047 u.ti.fBitfield,
01048 u.ti.continued,
01049 u.ti.tq0,
01050 u.ti.tq1,
01051 u.ti.tq2,
01052 u.ti.tq3,
01053 u.ti.tq4,
01054 u.ti.tq5);
01055 }
01056
01057
01058
01059
01060 static void
01061 emit_aggregate (char *string, AUXU u, AUXU u2, const char *which, FDR *fdp)
01062 {
01063 unsigned int ifd = u.rndx.rfd;
01064 unsigned int index = u.rndx.index;
01065 const char *name;
01066
01067 if (ifd == ST_RFDESCAPE)
01068 ifd = u2.isym;
01069
01070
01071
01072 if (ifd == 0xffffffff
01073 || (u.rndx.rfd == ST_RFDESCAPE && index == 0))
01074 name = "<undefined>";
01075 else if (index == indexNil)
01076 name = "<no name>";
01077 else
01078 {
01079 if (fdp == 0 || sym_hdr.crfd == 0)
01080 fdp = &file_desc[ifd];
01081 else
01082 fdp = &file_desc[rfile_desc[fdp->rfdBase + ifd]];
01083 name = &l_strings[fdp->issBase + l_symbols[index + fdp->isymBase].iss];
01084 }
01085
01086 sprintf (string,
01087 "%s %s { ifd = %u, index = %u }",
01088 which, name, ifd, index);
01089 }
01090
01091
01092
01093
01094
01095 static void
01096 print_file_desc (FDR *fdp, int number)
01097 {
01098 char *str_base;
01099 AUXU *aux_base;
01100 int symi, pdi;
01101 int width = 20;
01102 char *used_base;
01103
01104 str_base = l_strings + fdp->issBase;
01105 aux_base = aux_symbols + fdp->iauxBase;
01106 used_base = aux_used + (aux_base - aux_symbols);
01107
01108 printf ("\nFile #%d, \"%s\"\n\n",
01109 number,
01110 fdp->rss != issNil ? str_base + fdp->rss : "<unknown>");
01111
01112 printf (" Name index = %-10ld Readin = %s\n",
01113 (long) fdp->rss, (fdp->fReadin) ? "Yes" : "No");
01114
01115 printf (" Merge = %-10s Endian = %s\n",
01116 (fdp->fMerge) ? "Yes" : "No",
01117 (fdp->fBigendian) ? "BIG" : "LITTLE");
01118
01119 printf (" Debug level = %-10s Language = %s\n",
01120 glevel_to_string (fdp->glevel),
01121 lang_to_string((lang_t) fdp->lang));
01122
01123 printf (" Adr = 0x%08lx\n\n", (long) fdp->adr);
01124
01125 printf(" %-*s %11s %11s %11s %11s\n", width, "Info", "Start", "Number", "Size", "Offset");
01126 printf(" %-*s %11s %11s %11s %11s\n", width, "====", "=====", "======", "====", "======");
01127
01128 printf(" %-*s %11lu %11lu %11lu %11lu\n",
01129 width, "Local strings",
01130 (ulong) fdp->issBase,
01131 (ulong) fdp->cbSs,
01132 (ulong) fdp->cbSs,
01133 (ulong) (fdp->issBase + sym_hdr.cbSsOffset));
01134
01135 printf(" %-*s %11lu %11lu %11lu %11lu\n",
01136 width, "Local symbols",
01137 (ulong) fdp->isymBase,
01138 (ulong) fdp->csym,
01139 (ulong) (fdp->csym * sizeof (SYMR)),
01140 (ulong) (fdp->isymBase * sizeof (SYMR) + sym_hdr.cbSymOffset));
01141
01142 printf(" %-*s %11lu %11lu %11lu %11lu\n",
01143 width, "Line numbers",
01144 (ulong) fdp->cbLineOffset,
01145 (ulong) fdp->cline,
01146 (ulong) fdp->cbLine,
01147 (ulong) (fdp->cbLineOffset + sym_hdr.cbLineOffset));
01148
01149 printf(" %-*s %11lu %11lu %11lu %11lu\n",
01150 width, "Optimization symbols",
01151 (ulong) fdp->ioptBase,
01152 (ulong) fdp->copt,
01153 (ulong) (fdp->copt * sizeof (OPTR)),
01154 (ulong) (fdp->ioptBase * sizeof (OPTR) + sym_hdr.cbOptOffset));
01155
01156 printf(" %-*s %11lu %11lu %11lu %11lu\n",
01157 width, "Procedures",
01158 (ulong) fdp->ipdFirst,
01159 (ulong) fdp->cpd,
01160 (ulong) (fdp->cpd * sizeof (PDR)),
01161 (ulong) (fdp->ipdFirst * sizeof (PDR) + sym_hdr.cbPdOffset));
01162
01163 printf(" %-*s %11lu %11lu %11lu %11lu\n",
01164 width, "Auxiliary symbols",
01165 (ulong) fdp->iauxBase,
01166 (ulong) fdp->caux,
01167 (ulong) (fdp->caux * sizeof (AUXU)),
01168 (ulong) (fdp->iauxBase * sizeof(AUXU) + sym_hdr.cbAuxOffset));
01169
01170 printf(" %-*s %11lu %11lu %11lu %11lu\n",
01171 width, "Relative Files",
01172 (ulong) fdp->rfdBase,
01173 (ulong) fdp->crfd,
01174 (ulong) (fdp->crfd * sizeof (ulong)),
01175 (ulong) (fdp->rfdBase * sizeof(ulong) + sym_hdr.cbRfdOffset));
01176
01177
01178 if (want_scope && cur_scope != (scope_t *) 0)
01179 printf ("\n Warning scope does not start at 0!\n");
01180
01181
01182
01183
01184 printf ("\n There are %lu local symbols, starting at %lu\n",
01185 (ulong) fdp->csym,
01186 (ulong) (fdp->isymBase + sym_hdr.cbSymOffset));
01187
01188 for(symi = fdp->isymBase; symi < (fdp->csym + fdp->isymBase); symi++)
01189 print_symbol (&l_symbols[symi],
01190 symi - fdp->isymBase,
01191 str_base,
01192 aux_base,
01193 -1,
01194 fdp);
01195
01196 if (want_scope && cur_scope != (scope_t *) 0)
01197 printf ("\n Warning scope does not end at 0!\n");
01198
01199
01200
01201
01202
01203 if (want_aux && fdp->caux != 0)
01204 {
01205 int auxi;
01206
01207 printf ("\n There are %lu auxiliary table entries, starting at %lu.\n\n",
01208 (ulong) fdp->caux,
01209 (ulong) (fdp->iauxBase + sym_hdr.cbAuxOffset));
01210
01211 for (auxi = fdp->iauxBase; auxi < (fdp->caux + fdp->iauxBase); auxi++)
01212 print_aux (aux_base[auxi], auxi, used_base[auxi]);
01213 }
01214
01215
01216
01217
01218 if (want_rfd && fdp->crfd != 0)
01219 {
01220 ulong *rfd_ptr, i;
01221
01222 printf ("\n There are %lu relative file descriptors, starting at %lu.\n",
01223 (ulong) fdp->crfd,
01224 (ulong) fdp->rfdBase);
01225
01226 rfd_ptr = rfile_desc + fdp->rfdBase;
01227 for (i = 0; i < (ulong) fdp->crfd; i++)
01228 {
01229 printf ("\t#%-5ld %11ld, 0x%08lx\n", i, *rfd_ptr, *rfd_ptr);
01230 rfd_ptr++;
01231 }
01232 }
01233
01234
01235
01236
01237 printf ("\n There are %lu procedure descriptor entries, ", (ulong) fdp->cpd);
01238 printf ("starting at %lu.\n", (ulong) fdp->ipdFirst);
01239
01240 for (pdi = fdp->ipdFirst; pdi < (fdp->cpd + fdp->ipdFirst); pdi++)
01241 {
01242 PDR *proc_ptr = &proc_desc[pdi];
01243 printf ("\n\tProcedure descriptor %d:\n", (pdi - fdp->ipdFirst));
01244
01245 if (l_symbols != 0)
01246 printf ("\t Name index = %-11ld Name = \"%s\"\n",
01247 (long) l_symbols[proc_ptr->isym + fdp->isymBase].iss,
01248 l_symbols[proc_ptr->isym + fdp->isymBase].iss + str_base);
01249
01250 printf ("\t .mask 0x%08lx,%-9ld .fmask 0x%08lx,%ld\n",
01251 (long) proc_ptr->regmask,
01252 (long) proc_ptr->regoffset,
01253 (long) proc_ptr->fregmask,
01254 (long) proc_ptr->fregoffset);
01255
01256 printf ("\t .frame $%d,%ld,$%d\n",
01257 (int) proc_ptr->framereg,
01258 (long) proc_ptr->frameoffset,
01259 (int) proc_ptr->pcreg);
01260
01261 printf ("\t Opt. start = %-11ld Symbols start = %ld\n",
01262 (long) proc_ptr->iopt,
01263 (long) proc_ptr->isym);
01264
01265 printf ("\t First line # = %-11ld Last line # = %ld\n",
01266 (long) proc_ptr->lnLow,
01267 (long) proc_ptr->lnHigh);
01268
01269 printf ("\t Line Offset = %-11ld Address = 0x%08lx\n",
01270 (long) proc_ptr->cbLineOffset,
01271 (long) proc_ptr->adr);
01272
01273
01274
01275
01276
01277 if (want_line && fdp->cline != 0)
01278 {
01279 int delta, count;
01280 long cur_line = proc_ptr->lnLow;
01281 uchar *line_ptr = (((uchar *)lines) + proc_ptr->cbLineOffset
01282 + fdp->cbLineOffset);
01283 uchar *line_end;
01284
01285 if (pdi == fdp->cpd + fdp->ipdFirst - 1)
01286 line_end = ((uchar *)lines) + fdp->cbLine + fdp->cbLineOffset;
01287 else
01288 line_end = (((uchar *)lines) + proc_desc[pdi+1].cbLineOffset
01289 + fdp->cbLineOffset);
01290
01291 printf ("\n\tThere are %lu bytes holding line numbers, starting at %lu.\n",
01292 (ulong) (line_end - line_ptr),
01293 (ulong) (fdp->ilineBase + sym_hdr.cbLineOffset));
01294
01295 while (line_ptr < line_end)
01296 {
01297 delta = ((*line_ptr >> 4) ^ 0x8) - 0x8;
01298 count = (*line_ptr & 0xf) + 1;
01299 if (delta != -8)
01300 line_ptr++;
01301 else
01302 {
01303 delta = (((line_ptr[1]) & 0xff) << 8) + ((line_ptr[2]) & 0xff);
01304 delta = (delta ^ 0x8000) - 0x8000;
01305 line_ptr += 3;
01306 }
01307
01308 cur_line += delta;
01309 printf ("\t Line %11ld, delta %5d, count %2d\n",
01310 cur_line,
01311 delta,
01312 count);
01313 }
01314 }
01315 }
01316 }
01317
01318
01319
01320
01321 static void
01322 read_tfile (void)
01323 {
01324 short magic;
01325 off_t sym_hdr_offset = 0;
01326
01327 read_seek (&magic, sizeof (magic), 0, "Magic number");
01328 if (!tfile)
01329 {
01330
01331
01332 read_seek (&global_hdr, sizeof (global_hdr), 0, "Global file header");
01333
01334 print_global_hdr (&global_hdr);
01335
01336 if (global_hdr.f_symptr == 0)
01337 {
01338 printf ("No symbolic header, Goodbye!\n");
01339 exit (1);
01340 }
01341
01342 sym_hdr_offset = global_hdr.f_symptr;
01343 }
01344
01345 read_seek (&sym_hdr, sizeof (sym_hdr), sym_hdr_offset, "Symbolic header");
01346
01347 print_sym_hdr (&sym_hdr);
01348
01349 lines = read_seek (NULL, sym_hdr.cbLine, sym_hdr.cbLineOffset,
01350 "Line numbers");
01351
01352 dense_nums = read_seek (NULL, sym_hdr.idnMax * sizeof (DNR),
01353 sym_hdr.cbDnOffset, "Dense numbers");
01354
01355 proc_desc = read_seek (NULL, sym_hdr.ipdMax * sizeof (PDR),
01356 sym_hdr.cbPdOffset, "Procedure tables");
01357
01358 l_symbols = read_seek (NULL, sym_hdr.isymMax * sizeof (SYMR),
01359 sym_hdr.cbSymOffset, "Local symbols");
01360
01361 opt_symbols = read_seek (NULL, sym_hdr.ioptMax * sizeof (OPTR),
01362 sym_hdr.cbOptOffset, "Optimization symbols");
01363
01364 aux_symbols = read_seek (NULL, sym_hdr.iauxMax * sizeof (AUXU),
01365 sym_hdr.cbAuxOffset, "Auxiliary symbols");
01366
01367 if (sym_hdr.iauxMax > 0)
01368 aux_used = xcalloc (sym_hdr.iauxMax, 1);
01369
01370 l_strings = read_seek (NULL, sym_hdr.issMax,
01371 sym_hdr.cbSsOffset, "Local string table");
01372
01373 e_strings = read_seek (NULL, sym_hdr.issExtMax,
01374 sym_hdr.cbSsExtOffset, "External string table");
01375
01376 file_desc = read_seek (NULL, sym_hdr.ifdMax * sizeof (FDR),
01377 sym_hdr.cbFdOffset, "File tables");
01378
01379 rfile_desc = read_seek (NULL, sym_hdr.crfd * sizeof (ulong),
01380 sym_hdr.cbRfdOffset, "Relative file tables");
01381
01382 e_symbols = read_seek (NULL, sym_hdr.iextMax * sizeof (EXTR),
01383 sym_hdr.cbExtOffset, "External symbols");
01384 }
01385
01386
01387
01388 extern int main (int, char **);
01389
01390 int
01391 main (int argc, char **argv)
01392 {
01393 int i, opt;
01394
01395
01396
01397
01398 while ((opt = getopt_long (argc, argv, "alrsvt", options, NULL)) != -1)
01399 switch (opt)
01400 {
01401 default: errors++; break;
01402 case 'a': want_aux++; break;
01403 case 'l': want_line++; break;
01404 case 'r': want_rfd++; break;
01405 case 's': want_scope++; break;
01406 case 'v': verbose++; break;
01407 case 'V': version++; break;
01408 case 't': tfile++; break;
01409
01410 }
01411
01412 if (version)
01413 {
01414 printf ("mips-tdump (GCC) %s\n", version_string);
01415 fputs ("Copyright (C) 2003 Free Software Foundation, Inc.\n", stdout);
01416 fputs ("This is free software; see the source for copying conditions. There is NO\n\
01417 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n",
01418 stdout);
01419 exit (0);
01420 }
01421
01422 if (optind != argc - 1)
01423 errors++;
01424
01425 if (verbose || errors)
01426 {
01427 fprintf (stderr, "mips-tdump (GCC) %s", version_string);
01428 #ifdef TARGET_VERSION
01429 TARGET_VERSION;
01430 #endif
01431 fputc ('\n', stderr);
01432 }
01433
01434 if (errors)
01435 {
01436 fprintf (stderr, "Calling Sequence:\n");
01437 fprintf (stderr, "\t%s [-alrst] <object-or-T-file>\n", argv[0]);
01438 fprintf (stderr, "\n");
01439 fprintf (stderr, "switches:\n");
01440 fprintf (stderr, "\t-a Print out auxiliary table.\n");
01441 fprintf (stderr, "\t-l Print out line numbers.\n");
01442 fprintf (stderr, "\t-r Print out relative file descriptors.\n");
01443 fprintf (stderr, "\t-s Print out the current scopes for an item.\n");
01444 fprintf (stderr, "\t-t Assume there is no global header (ie, a T-file).\n");
01445 fprintf (stderr, "\t-v Print program version.\n");
01446 return 1;
01447 }
01448
01449
01450
01451
01452 tfile_fd = open (argv[optind], O_RDONLY);
01453 if (tfile_fd < 0)
01454 {
01455 perror (argv[optind]);
01456 return 1;
01457 }
01458
01459 read_tfile ();
01460
01461
01462
01463
01464 if (want_aux)
01465 {
01466 long last_aux_in_use;
01467
01468 if (sym_hdr.ifdMax != 0 && file_desc[0].iauxBase != 0)
01469 {
01470 printf ("\nGlobal auxiliary entries before first file:\n");
01471 for (i = 0; i < file_desc[0].iauxBase; i++)
01472 print_aux (aux_symbols[i], 0, aux_used[i]);
01473 }
01474
01475 if (sym_hdr.ifdMax == 0)
01476 last_aux_in_use = 0;
01477 else
01478 last_aux_in_use
01479 = (file_desc[sym_hdr.ifdMax-1].iauxBase
01480 + file_desc[sym_hdr.ifdMax-1].caux - 1);
01481
01482 if (last_aux_in_use < sym_hdr.iauxMax-1)
01483 {
01484 printf ("\nGlobal auxiliary entries after last file:\n");
01485 for (i = last_aux_in_use; i < sym_hdr.iauxMax; i++)
01486 print_aux (aux_symbols[i], i - last_aux_in_use, aux_used[i]);
01487 }
01488 }
01489
01490
01491
01492
01493 for (i = 0; i < sym_hdr.ifdMax; i++)
01494 print_file_desc (&file_desc[i], i);
01495
01496
01497
01498
01499 want_scope = 0;
01500 printf ("\nThere are %lu external symbols, starting at %lu\n",
01501 (ulong) sym_hdr.iextMax,
01502 (ulong) sym_hdr.cbExtOffset);
01503
01504 for(i = 0; i < sym_hdr.iextMax; i++)
01505 print_symbol (&e_symbols[i].asym, i, e_strings,
01506 aux_symbols + file_desc[e_symbols[i].ifd].iauxBase,
01507 e_symbols[i].ifd,
01508 &file_desc[e_symbols[i].ifd]);
01509
01510
01511
01512
01513
01514 if (want_aux)
01515 {
01516 int first_time = 1;
01517
01518 for (i = 0; i < sym_hdr.iauxMax; i++)
01519 {
01520 if (! aux_used[i])
01521 {
01522 if (first_time)
01523 {
01524 printf ("\nThe following auxiliary table entries were unused:\n\n");
01525 first_time = 0;
01526 }
01527
01528 printf (" #%-5d %11ld 0x%08lx %s\n",
01529 i,
01530 (long) aux_symbols[i].isym,
01531 (long) aux_symbols[i].isym,
01532 type_to_string (aux_symbols, i, (FDR *) 0));
01533 }
01534 }
01535 }
01536
01537 return 0;
01538 }