|
|
1.1 ! root 1: /* $Header: sym.h,v 1.1 86/03/24 16:17:05 rcs Exp $ */ ! 2: ! 3: /* (C) Copyright 1984 by Third Eye Software, Inc. ! 4: * ! 5: * Third Eye Software, Inc. grants reproduction and use rights to ! 6: * all parties, PROVIDED that this comment is maintained in the copy. ! 7: * ! 8: * Third Eye makes no claims about the applicability of this ! 9: * symbol table to a particular use. ! 10: */ ! 11: ! 12: /* ! 13: * This file contains the definition of the Third Eye Symbol Table. ! 14: * ! 15: * Symbols are assumed to be in 'encounter order' - i.e. the order that ! 16: * the things they represent were encountered by the compiler/assembler/loader. ! 17: * EXCEPT for globals! These are assumed to be bunched together, ! 18: * probably right after the last 'normal' symbol. Globals ARE sorted ! 19: * in ascending order. ! 20: * ! 21: * ----------------------------------------------------------------- ! 22: * A brief word about Third Eye naming/use conventions: ! 23: * ! 24: * All arrays and index's are 0 based. ! 25: * All "ifooMax" values are the highest legal value PLUS ONE. This makes ! 26: * them good for allocating arrays, etc. All checks are "ifoo < ifooMax". ! 27: * ! 28: * "isym" Index into the SYMbol table. ! 29: * "ipd" Index into the Procedure Descriptor array. ! 30: * "ifd" Index into the File Descriptor array. ! 31: * "iss" Index into String Space. ! 32: * "cb" Count of Bytes. ! 33: * "rgPd" array whose domain is "0..ipdMax-1" and RanGe is PDR. ! 34: * "rgFd" array whose domain is "0..ifdMax-1" and RanGe is FDR. ! 35: */ ! 36: ! 37: #ifndef int1 ! 38: #define int1 char ! 39: #define uint1 unsigned char ! 40: #define int2 short ! 41: #define uint2 unsigned short ! 42: #define int4 long ! 43: #define uint4 unsigned long ! 44: #define bits unsigned int ! 45: #endif ! 46: ! 47: /* ! 48: * HDR structure. ! 49: * As long as all the pointers are set correctly, ! 50: * we don't care WHAT order the various sections come out in! ! 51: * ! 52: * A file produced solely for the use of CDB will probably NOT have ! 53: * any instructions or data areas in it, as these are available ! 54: * in the original. ! 55: */ ! 56: ! 57: typedef struct HDS { ! 58: int2 magic; /* magic numer as defined below */ ! 59: int2 vstamp; /* version stamp */ ! 60: uint4 cbText; /* text size in bytes, padded to FW boundary */ ! 61: uint4 cbData; /* initialized data " " */ ! 62: uint4 cbBss; /* uninitialized data " " */ ! 63: uint4 entrypoint; ! 64: ! 65: int4 ipdMax; /* number of procedures */ ! 66: uint4 cbPdOffset; /* offset to procedure array */ ! 67: int4 ifdMax; /* number of files */ ! 68: uint4 cbFdOffset; /* offset to file array */ ! 69: int4 ilineMax; /* number of line numbers (0 if none) */ ! 70: uint4 cbLineOffset; /* offset to start of LINE's*/ ! 71: int4 issMax; /* max index into string space */ ! 72: uint4 cbSsOffset; /* offset to start of string space */ ! 73: int4 isymMax; /* number of symbols */ ! 74: uint4 cbSymOffset; /* offset to start of symbols*/ ! 75: int4 isymGl; /* lowest isym of a global */ ! 76: int4 isymGlMax; /* highest isym of a global + 1 */ ! 77: int4 iauxMax; /* number of auxillary symbols */ ! 78: uint4 cbAuxOffset; /* offset to start of auxillary symbols*/ ! 79: int4 ijokeDay; /* index to joke of the day - ! 80: * if (ijokeDay == ijokeNil) then ! 81: * ****'em if they can't take a joke. ! 82: */ ! 83: } HDRR, *pHDRR; ! 84: #define cbHDRR sizeof(HDRR) ! 85: #define hdrNil ((pHDRR)0) ! 86: #define ijokeNil -1 ! 87: ! 88: /* magic number definitions */ ! 89: #define magicNil -1 ! 90: #define magicLpd 0401 /* lpd (UNIX/RT) */ ! 91: #define magicOverlay 0405 /* overlay */ ! 92: #define magicImpure 0407 /* impure format */ ! 93: #define magicReadOnly 0410 /* read-only text */ ! 94: #define magicSplit 0411 /* separated I&D */ ! 95: #define magicDemand 0413 /* demand load format */ ! 96: #define magicSDemand 0415 /* short format,demand load(MegaTest) */ ! 97: ! 98: /* ! 99: * The FDR and PDR structures speed mapping of address <-> name. ! 100: * They are sorted in ascending memory order and are kept in ! 101: * memory by CDB at runtime. ! 102: */ ! 103: ! 104: /* ! 105: * File Descriptor ! 106: * ! 107: * There is one of these for EVERY FILE, whether compiled with ! 108: * full debugging symbols or not. The name of a file should be ! 109: * the path name given to the compiler. This allows the user ! 110: * to simply specify the names of the directories where the COMPILES ! 111: * were done, and we will be able to find their files. ! 112: * A field whose comment starts with "R - " indicates that it is a ! 113: * runtime field and shoould be set to 0. ! 114: */ ! 115: ! 116: typedef struct FDS { ! 117: ADRT adr; /* memory address of beginning of file */ ! 118: int4 iss; /* file name (of source, if known) */ ! 119: int4 isym; /* beginning of symbols */ ! 120: int4 iline; /* file's line symbols */ ! 121: int2 ipd; /* start of procedures for this file */ ! 122: int2 ilnMac; /* R - number of text lines in file */ ! 123: uint4 *rgLn; /* R - the line pointer array (if any) */ ! 124: bits fWarned : 1; /* R - they were warned about age problems */ ! 125: bits fEdited : 1; /* R - edited during debug session */ ! 126: bits fNoSource : 1; /* R - we couldn't find the source file */ ! 127: bits reserved : 12; /* reserved for future TES use */ ! 128: } FDR, *pFDR; ! 129: #define cbFDR sizeof(FDR) ! 130: #define fdNil ((pFDR)0) ! 131: ! 132: #define ifdNil -1 ! 133: #define ifdTemp 0 /* element 0 of rgFd is ALWAYS reserved for runtime */ ! 134: #define ilnNil -1 ! 135: ! 136: ! 137: /* ! 138: * Procedure Descriptor ! 139: * ! 140: * There is one of these for EVERY TEXT LABEL. ! 141: * If a procedure is in a file with full symbols, then isym ! 142: * will point to the PROC symbols, else it will point to the ! 143: * global symbol for the label. ! 144: */ ! 145: ! 146: typedef struct PDS { ! 147: ADRT adr; /* memory address of beginning of proc */ ! 148: int4 isym; /* beginning of symbols */ ! 149: int4 iline; /* proc's line symbols */ ! 150: } PDR, *pPDR; ! 151: #define cbPDR sizeof(PDR) ! 152: #define ipdNil -1 ! 153: ! 154: ! 155: /* ! 156: * Line Numbers ! 157: * ! 158: * Line Numbers are segregated from the normal symbols because they ! 159: * are [1] smaller (4 bytes vs 12) , [2] are of no interest to your ! 160: * average loader, and [3] are never needed in the middle of normal ! 161: * scanning and therefore slow things down. ! 162: * ! 163: * By definition, the first LINER for any given procedure will have ! 164: * a delta address (dadr) of 0. This conveniently allows deduction ! 165: * of start-of-proc when building the PDR array. ! 166: */ ! 167: ! 168: typedef struct LINES { ! 169: uint2 iln; /* line number, file relative, starting at 1 */ ! 170: uint2 dadr; /* delta address from start of procedure */ ! 171: } LINER, *pLINER; ! 172: #define lineNil ((pLINER)0) ! 173: #define cbLINER sizeof(LINER) ! 174: #define ilineNil -1L ! 175: ! 176: ! 177: /* The following are value definitions for the fields in the SYMR */ ! 178: ! 179: /* ! 180: * Storage Classes ! 181: */ ! 182: ! 183: #define scNil 0 ! 184: #define scText 1 /* text symbol */ ! 185: #define scData 2 /* initialized data symbol */ ! 186: #define scBss 3 /* un-initialized data symbol */ ! 187: #define scRegister 4 /* value of symbol is register number */ ! 188: #define scAbs 5 /* value of symbol is absolute */ ! 189: #define scUndefined 6 /* who knows? */ ! 190: #define scCdbLocal 7 /* variable's value is IN se->va.?? */ ! 191: #define scBits 8 /* this is a bit field */ ! 192: #define scCdbSystem 9 /* variable's value is IN CDB's address space */ ! 193: #define scRegImage 10 /* register value saved on stack */ ! 194: #define scInfo 11 /* symbol contains debugger information */ ! 195: #define scUserStruct 12 /* address in struct user for current process */ ! 196: #define scMax 16 ! 197: ! 198: ! 199: /* ! 200: * Symbol Types ! 201: */ ! 202: ! 203: #define stNil 0 /* Nuthin' special */ ! 204: #define stGlobal 1 /* external symbol */ ! 205: #define stStatic 2 /* static */ ! 206: #define stParam 3 /* procedure argument */ ! 207: #define stLocal 4 /* local variable */ ! 208: #define stLabel 5 /* label */ ! 209: #define stProc 6 /* " " Procedure */ ! 210: #define stBlock 7 /* beginnning of block */ ! 211: #define stEnd 8 /* end (of anything) */ ! 212: #define stMember 9 /* member (of anything - struct/union/enum */ ! 213: #define stTypedef 10 /* type definition */ ! 214: #define stFile 11 /* file name */ ! 215: #define stRegReloc 12 /* register relocation */ ! 216: #define stForward 13 /* forwarding address */ ! 217: /* Psuedo-symbols - internal to debugger */ ! 218: #define stStr 60 /* string */ ! 219: #define stNumber 61 /* pure number (ie. 4 NOR 2+2) */ ! 220: #define stExpr 62 /* 2+2 vs. 4 */ ! 221: #define stType 63 /* post-coersion SER */ ! 222: #define stMax 64 ! 223: ! 224: ! 225: /* ! 226: * The Symbol Structure (GFW, to those who Know!) ! 227: */ ! 228: ! 229: typedef struct SYMS { ! 230: int4 iss; /* index into String Space of name */ ! 231: int4 value; /* value of symbol */ ! 232: bits st : 6; /* symbol type */ ! 233: bits sc : 5; /* storage class - text, data, etc */ ! 234: bits ext : 1; /* information is globally available */ ! 235: #ifdef INT_16 ! 236: bits unused : 4; ! 237: bits index : 16; /* index into sym/aux table */ ! 238: #else ! 239: bits index : 20; /* index into sym/aux table */ ! 240: #endif INT_16 ! 241: } SYMR, *pSYMR; ! 242: #define symNil ((pSYMR)0) ! 243: #define cbSYMR sizeof(SYMR) ! 244: #define isymNil 0 ! 245: #define issNil 0 ! 246: ! 247: ! 248: /* A U X I L L A R Y T Y P E I N F O R M A T I O N */ ! 249: ! 250: /* definitions for fields in TIR */ ! 251: ! 252: /* type qualifiers for ti.tq0 -> ti.(itqMax-1) */ ! 253: #define tqNil 0 /* bt is what you see */ ! 254: #define tqPtr 1 /* pointer */ ! 255: #define tqProc 2 /* procedure */ ! 256: #define tqArray 3 /* duh */ ! 257: #define tqFar 4 /* longer addressing - 8086/8 land */ ! 258: #define tqMax 8 ! 259: ! 260: /* basic types as seen in ti.bt */ ! 261: #define btNil 0 /* undefined */ ! 262: #define btAdr 1 /* address - integer same size as pointer */ ! 263: #define btChar 2 /* character */ ! 264: #define btUChar 3 /* unsigned character */ ! 265: #define btShort 4 /* short */ ! 266: #define btUShort 5 /* unsigned short */ ! 267: #define btInt 6 /* int */ ! 268: #define btUInt 7 /* unsigned int */ ! 269: #define btLong 8 /* long */ ! 270: #define btULong 9 /* unsigned long */ ! 271: #define btFloat 10 /* float (real) */ ! 272: #define btDouble 11 /* Double (real) */ ! 273: #define btStruct 12 /* Structure (Record) */ ! 274: #define btUnion 13 /* Union (variant) */ ! 275: #define btEnum 14 /* Enumerated */ ! 276: #define btTypedef 15 /* defined via a typedef, isymRef points */ ! 277: #define btLongLong 16 /* E.g. ELXSI 64 bit integers */ ! 278: #define btULongLong 17 /* E.g. ELXSI 64 bit integers */ ! 279: #define btSet 18 /* pascal type set */ ! 280: #define btRange 19 /* pascal type range */ ! 281: #define btMax 64 ! 282: ! 283: /* ! 284: * Type Information Record ! 285: */ ! 286: ! 287: typedef struct { ! 288: bits reserved : 6; /* reserved by Third Eye for future use */ ! 289: bits continued : 1; /* indicates additional info in next AUX */ ! 290: bits bt : 6; /* basic type */ ! 291: bits tq5 : 3; ! 292: /* ---- 16 bit boundary ---- */ ! 293: bits fConstant : 1; /* value IS value, not address */ ! 294: bits tq0 : 3; ! 295: bits tq1 : 3; /* 5 type qualifiers - tqPtr, etc. */ ! 296: bits tq2 : 3; ! 297: bits tq3 : 3; ! 298: bits tq4 : 3; ! 299: } TIR, *pTIR; ! 300: #define cbTIR sizeof(TIR) ! 301: #define tiNil ((pTIR)0) ! 302: #define itqMax 6 ! 303: ! 304: ! 305: typedef struct { /* Dimension bounds */ ! 306: int2 dnLow; /* lowest index value */ ! 307: int2 dnMac; /* highest value PLUS ONE! (dnMac-dnLow==cElement) */ ! 308: } DIMR, *pDIMR; ! 309: #define cbDIMR sizeof(DIMR) ! 310: #define dimNil ((pDIMR)0) ! 311: #define idimMax 4 /* maximum number of dimesions */ ! 312: ! 313: /* ! 314: * Auxillary information occurs only if needed. ! 315: * It ALWAYS occurs in this order when present. ! 316: ! 317: isymMac used by stProc only ! 318: TIR type info ! 319: TIR additional TQ info (if first TIR was not enough) ! 320: isymRef if (bt == btStruct/etc.) OR (bt == btTypedef) ! 321: idim0 as many as there are "tqArray"s in TIR ! 322: ... ! 323: idimMax-1 ! 324: width in bits if (bit field), width in bits. ! 325: */ ! 326: #define cAuxMax (4 + idimMax) ! 327: ! 328: /* a union of all possible info in the AUX universe */ ! 329: typedef union { ! 330: TIR ti; ! 331: DIMR dim; ! 332: int4 isym; ! 333: int4 iss; ! 334: int4 width; ! 335: } AUXU, *pAUXU; ! 336: #define cbAUXU sizeof(AUXU) ! 337: #define auxNil ((pAUXU)0) ! 338: #define iauxNil 0L ! 339: ! 340: /* ! 341: * The following table defines the meaning of each SYM field as ! 342: * a function of the "st". (scD/B == scData OR scBss) ! 343: * ! 344: * Note: the value "isymMac" is used by symbols that have the concept ! 345: * of enclosing a block of related information. This value is the ! 346: * isym of the first symbol AFTER the End associated with the primary ! 347: * symbol. For example if a procedure was at isym==90 and had an ! 348: * isymMac==155, the associated end would be at isym==154, and the ! 349: * symbol at 155 would probably (although not necessarily) be the ! 350: * symbol for the next procedure or file. This allows rapid skipping over ! 351: * internal information of various sorts. "stEnd"s ALWAYS have the ! 352: * isym of the primary symbol that started the block. ! 353: * ! 354: ! 355: ST SC VALUE INDEX ! 356: -------- ------ -------- ------ ! 357: stFile scText address isymMac ! 358: stLabel scText address --- ! 359: stGlobal scD/B address iaux ! 360: stStatic scD/B address iaux ! 361: stParam scAbs offset iaux ! 362: stLocal scAbs offset iaux ! 363: stProc scText address iaux (isymMac is first AUX) ! 364: ! 365: stMember scNil ordinal --- (if member of enum) ! 366: stMember scNil byte offset iaux (if member of struct/union) ! 367: stMember scBits bit offset iaux (bit field spec) ! 368: ! 369: stBlock scText address isymMac (text block) ! 370: stBlock scNil cb isymMac (struct/union member define) ! 371: stBlock scNil cMembers isymMac (enum member define) ! 372: ! 373: stEnd scText address isymStart ! 374: stEnd scNil ------- isymStart (struct/union/enum) ! 375: ! 376: stTypedef scNil ------- iaux ! 377: stRegReloc sc??? value old register number ! 378: stForward sc??? new address isym to original symbol ! 379: ! 380: * ! 381: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.