=============================================================================== /* This is a snapshot of the 32-bit SOM debug info format * as of May 21 1997 * (/CLO/Components/CLO_COMMON/Src/PA_debug/symtab.h@@/main/33), * but with records related to debugging-of-optimized code deleted. * This should therefore be a complete record of the debug info * generated by HP compilers, as long as optimization is turned off. * Code compiled -g +O2 may contain additional records not described * in this file. * Rich Title May 21 1997 */ #ifndef _SYMTAB_INCLUDED /* allow multiple inclusions */ #define _SYMTAB_INCLUDED /* * * SYMBOLIC DEBUG FORMAT ACD * $Revision: 1.2 $ * * * * ---- 1. INTRODUCTION * * * This document describes the current format for data tables which * appear in HP-UX / HPE object files (a.out files). These tables * will be generated by the compilers, fixed up by the linker, and * used by various programs (primarily the symbolic debugger(s)) to * reconstruct information about the program. The form of this * document is a C include file annotated with comments. * * On SPECTRUM, a major goal was that the linker need not know * anything about the format. To this end, it was decided that the * debug information be composed of several unloadable subspaces * within an unloadable space (named $DEBUG$), and that link time * updates to the debug information be made through the standard * mechanism of a list of fixups. The linker will perform the * required fixups for the debug spaces, and subspaces from * separate compilation units will be concatenated. However, at * exec time, the loader would know that the debug space is not to * be loaded. * * Similarly, on the series 300, several debug tables are present * in the a.out format which are not loaded at exec time. Debug * tables are simply concatenated into larger tables at link time * and all fixups are then performed by pxdb. */ /* * ---- 2. SUMMARY OF STRUCTURES * * * The debug information consists of up to ten tables (though not * all need be present in any one exectutable file): a header table * and ten special tables. The header table will contain one * header record for each compilation unit. Each header record * identifies the size (in bytes) of the tables generated by * that compilation unit. Two of the tables are very similar. The * GNTT and LNTT both contain name and type information (NTT for * Name and Type Table). The GNTT contains information about * globals, and is thus limited to variables, types, and constants. * The LNTT is for information about locals. The LNTT must * therefore contain scoping information such as procedure nesting, * begin-end blocks, etc. The GNTT and LNTT are both DNTTs (Debug * Name and Type Tables), so the prefix DNTT is attached to objects * (like a DNTTPOINTER) that are relevant to both the GNTT and * LNTT. The SLT contains information relating source (or listing) * lines to code addresses. The SLT and LNTT contain pointers * between the two tables, so that the scoping information * contained in the LNTT can also be used with the SLT. The VT * contains ascii strings (such as variable names) and the values * of named constants. Additional tables have been added for cross * reference information and debug of optimized code. The tables * are summarized below: * * * Table Abbr Contains Points into * ============= ==== ========================= =============== * Global symbols GNTT global name-and-type info GNTT, VT, * Local symbols LNTT local name-and-type info GNTT,LNTT,SLT,VT * source line SLT source/listing line info LNTT,SLT * value VT names and constants - * xref XT File offsets and Attributes XT,VT * [debug of optimized code tables omitted from this version of symtab.h] * * The XT table was once used by softbench for static analysis info * but is now obsolete. * * The LT_OFFSETS table is obsolete * * The pointers needed within the debug tables are in fact indexes * into the tables. The GNTT, LNTT, and SLT each consist of a series * of equal-sized entries. Some DNTT entries begin a data structure * and some are extension entries. Some SLT entries are "special" * (point back to the LNTT), others are "assist" (point forward in * the SLT), but most are "normal" (point to code). * * There can be pointers from the LNTT to the GNTT, as it is common * to have local variables of a global type. However, there are * never pointers from the GNTT to the LNTT, as global variables * are never of a local type. * * The tables are defined to be as machine-independent as possible, * but the debugger may need to "know" some facts about the system * and language it is dealing with. * * The GNTT, LNTT and LINES are the only tables that require fixups * to be generated by the compiler and acted upon by the linker. * There are other fixups to be done, but these are all done by the * preprocessor. * */ /* * ---- 3. LOW-LEVEL TYPE DECLARATIONS */ /* * Code or data address: * * For the series 300: * * A virtual Address * * For Spectrum: * * A Spectrum short pointer. * */ #if __cplusplus #define public global #endif typedef long ADDRESS; typedef unsigned long ADRT, *pADRT; /* * Language types: * * Sizeof (LANGTYPE) = 4 bits, for a maximum of 16 possible * language types. */ typedef unsigned int LANGTYPE; #define LANG_UNKNOWN 0 #define LANG_C 1 #define LANG_HPF77 2 #define LANG_HPPASCAL 3 #define LANG_HPMODCAL 4 #define LANG_HPCOBOL 5 #define LANG_HPBASIC 6 #define LANG_HPADA 7 #ifdef CPLUSPLUS #define LANG_CPLUSPLUS 8 #endif #define LANG_DMPASCAL 9 /* * Location types: * * 32-bit, machine-dependent and context-dependent specifiers of * variable storage location. */ typedef unsigned long STATTYPE; /* static-type location */ typedef long DYNTYPE; /* dynamic-type location */ typedef unsigned long REGTYPE; /* register-type location */ typedef long CONSTVALUE; /* hold a constant value */ typedef unsigned long BITLENGTH; /* store the bitsize */ typedef unsigned long BITOFFSET; /* store an offset in bits */ #define STATNIL (-1) /* no location for STATTYPE */ /* * Loc type Series 300 Spectrum * ======== ================ =============== * * STATTYPE Absolute address A Spectrum * into process short pointer. * space (could be * code or data). * * * DYNTYPE A6-register- SP-register * relative byte relative byte * offset (+/-). offset (+/-) * * REGTYPE Register number Register number * (see below). (see below). * * All location types are always byte (not word) pointers when they * address memory, and they always point to the first byte * containing the object, skipping any padding bytes. For example, * if in Pascal a CHAR is allocated in the last byte of a whole * word, the pointer is to that byte. (In C, four different CHAR * variables might be packed into one word.) */ /* * Meaning of STATTYPE for CONST entries: * * Sizeof (LOCDESCTYPE) = 3 bits, for a maximum of 8 possible * desctypes. */ typedef unsigned int LOCDESCTYPE; #define LOC_IMMED 0 /* immediate constant */ #define LOC_PTR 1 /* standard STATTYPE */ #define LOC_VT 2 /* value table byte offset */ #define LOC_EXPR 3 /* index into $EXPR$ table */ #define LOC_RANGE 4 /* index into $RANGE$ table */ /* * Register numbers for REGTYPE (Series 700 & 800): */ /* General Registers */ #define REG_GR0 0 #define REG_GR1 1 #define REG_GR2 2 #define REG_GR3 3 #define REG_GR4 4 #define REG_GR5 5 #define REG_GR6 6 #define REG_GR7 7 #define REG_GR8 8 #define REG_GR9 9 #define REG_GR10 10 #define REG_GR11 11 #define REG_GR12 12 #define REG_GR13 13 #define REG_GR14 14 #define REG_GR15 15 #define REG_GR16 16 #define REG_GR17 17 #define REG_GR18 18 #define REG_GR19 19 #define REG_GR20 20 #define REG_GR21 21 #define REG_GR22 22 #define REG_GR23 23 #define REG_GR24 24 #define REG_GR25 25 #define REG_GR26 26 #define REG_GR27 27 #define REG_GR28 28 #define REG_GR29 29 #define REG_GR30 30 #define REG_GR31 31 /* Floating Point Registers */ #define REG_FR0 32 #define REG_FR0L 33 #define REG_FR0R 34 #define REG_FR1 35 #define REG_FR1L 36 #define REG_FR1R 37 #define REG_FR2 38 #define REG_FR2L 39 #define REG_FR2R 40 #define REG_FR3 41 #define REG_FR3L 42 #define REG_FR3R 43 #define REG_FR4 44 #define REG_FR4L 45 #define REG_FR4R 46 #define REG_FR5 47 #define REG_FR5L 48 #define REG_FR5R 49 #define REG_FR6 50 #define REG_FR6L 51 #define REG_FR6R 52 #define REG_FR7 53 #define REG_FR7L 54 #define REG_FR7R 55 #define REG_FR8 56 #define REG_FR8L 57 #define REG_FR8R 58 #define REG_FR9 59 #define REG_FR9L 60 #define REG_FR9R 61 #define REG_FR10 62 #define REG_FR10L 63 #define REG_FR10R 64 #define REG_FR11 65 #define REG_FR11L 66 #define REG_FR11R 67 #define REG_FR12 68 #define REG_FR12L 69 #define REG_FR12R 70 #define REG_FR13 71 #define REG_FR13L 72 #define REG_FR13R 73 #define REG_FR14 74 #define REG_FR14L 75 #define REG_FR14R 76 #define REG_FR15 77 #define REG_FR15L 78 #define REG_FR15R 79 #define REG_FR16 80 #define REG_FR16L 81 #define REG_FR16R 82 #define REG_FR17 83 #define REG_FR17L 84 #define REG_FR17R 85 #define REG_FR18 86 #define REG_FR18L 87 #define REG_FR18R 88 #define REG_FR19 89 #define REG_FR19L 90 #define REG_FR19R 91 #define REG_FR20 92 #define REG_FR20L 93 #define REG_FR20R 94 #define REG_FR21 95 #define REG_FR21L 96 #define REG_FR21R 97 #define REG_FR22 98 #define REG_FR22L 99 #define REG_FR22R 100 #define REG_FR23 101 #define REG_FR23L 102 #define REG_FR23R 103 #define REG_FR24 104 #define REG_FR24L 105 #define REG_FR24R 106 #define REG_FR25 107 #define REG_FR25L 108 #define REG_FR25R 109 #define REG_FR26 110 #define REG_FR26L 111 #define REG_FR26R 112 #define REG_FR27 113 #define REG_FR27L 114 #define REG_FR27R 115 #define REG_FR28 116 #define REG_FR28L 117 #define REG_FR28R 118 #define REG_FR29 119 #define REG_FR29L 120 #define REG_FR29R 121 #define REG_FR30 122 #define REG_FR30L 123 #define REG_FR30R 124 #define REG_FR31 125 #define REG_FR31L 126 #define REG_FR31R 127 /* * Register numbers for REGTYPE (Series 300 only): */ #define REG_D0 0 #define REG_D1 1 #define REG_D2 2 #define REG_D3 3 #define REG_D4 4 #define REG_D5 5 #define REG_D6 6 #define REG_D7 7 #define REG_A0 8 #define REG_A1 9 #define REG_A2 10 #define REG_A3 11 #define REG_A4 12 #define REG_A5 13 #define REG_A6 14 #define REG_A7 15 #define REG_FP0 16 #define REG_FP1 17 #define REG_FP2 18 #define REG_FP3 19 #define REG_FP4 20 #define REG_FP5 21 #define REG_FP6 22 #define REG_FP7 23 #define REG_FPA0 24 #define REG_FPA1 25 #define REG_FPA2 26 #define REG_FPA3 27 #define REG_FPA4 28 #define REG_FPA5 29 #define REG_FPA6 30 #define REG_FPA7 31 #define REG_FPA8 32 #define REG_FPA9 33 #define REG_FPA10 34 #define REG_FPA11 35 #define REG_FPA12 36 #define REG_FPA13 37 #define REG_FPA14 38 #define REG_FPA15 39 /* * generic floating point registers; * actual register determined at runtime */ #define REG_FGEN0 40 #define REG_FGEN1 41 #define REG_FGEN2 42 #define REG_FGEN3 43 #define REG_FGEN4 44 #define REG_FGEN5 45 #define REG_FGEN6 46 #define REG_FGEN7 47 #define REG_FGEN8 48 #define REG_FGEN9 49 #define REG_FGEN10 50 #define REG_FGEN11 51 #define REG_FGEN12 52 #define REG_FGEN13 53 #define REG_FGEN14 54 #define REG_FGEN15 55 /* * Basetypes: * * Sizeof (BASETYPE) = 5 bits, for a maximum of 32 possible * basetypes. */ typedef unsigned int BASETYPE; #define T_UNDEFINED 0 /* unheard of */ #define T_BOOLEAN 1 /* true/false or LOGICAL */ #define T_CHAR 2 /* ASCII, signed if used as int */ #define T_INT 3 /* signed integer */ #define T_UNS_INT 4 /* unsigned integer */ #define T_REAL 5 /* binary or decimal real */ #define T_COMPLEX 6 /* pair of reals */ #define T_STRING200 7 /* Series 300 string type */ #define T_LONGSTRING200 8 /* Series 300 long string type */ #define T_TEXT 9 /* for Pascal TEXT file */ #define T_FLABEL 10 /* for any program labels */ #define T_FTN_STRING_SPEC 11 /* Spectrum FORTRAN string type */ #define T_MOD_STRING_SPEC 12 /* Spectrum Modcal/Pascal string */ #define T_PACKED_DECIMAL 13 /* packed decimal */ #define T_REAL_3000 14 /* HP3000 format real */ #define T_MOD_STRING_3000 15 /* HP3000 Modcal/Pascal string */ #define T_ANYPTR 16 /* Pascal any-pointer */ #define T_GLOBAL_ANYPTR 17 /* Pascal global any-pointer */ #define T_LOCAL_ANYPTR 18 /* Pascal local any-pointer */ #define T_COMPLEXS3000 19 /* HP3000 format complex */ #define T_FTN_STRING_S300_COMPAT 20 /* 9000/s300 compatible fortran string */ #define T_FTN_STRING_VAX_COMPAT 21 /* VAX compatible fortran string */ #define T_BOOLEAN_S300_COMPAT 22 /* 9000/s300 compatible fortran logical */ #define T_BOOLEAN_VAX_COMPAT 23 /* VAX compatible fortran logical */ #define T_WIDE_CHAR 24 /* ANSI/C wchar_t pseudo-type */ #define T_LONG 25 /* signed long */ #define T_UNS_LONG 26 /* unsigned long */ #define T_DOUBLE 27 /* binary or decimal double */ #define T_TEMPLATE_ARG 28 /* template argument immediate type */ #define T_VOID 29 /* ANSI/C/C++ void type */ /* THE HIGHEST BASE_TYPE ALLOWABLE is 31 (see DNTTP_IMMEDIATE) */ /* * The string types are reserved for cases where the language has * an explicit string type separate from "array of char". * * The ANSI/C wchar_t typedef defines a special base-type to * the debugger. The interpretation of wide-characters during * input or display (i.e. their mapping to/from "external" * characters) is defined by the ANSI/C functions mbtowc() and * wctomb(), the "multi-byte" translation functions. * * T_FLABEL is used for CONSTs which are actually FORTRAN labels. * The T_FLABEL is needed for the following: in FORTRAN there is * the ASSIGN statement (ASSIGN