| 1 | /* Definitions and structures for reading debug symbols from the
|
|---|
| 2 | native HP C compiler.
|
|---|
| 3 |
|
|---|
| 4 | Written by the Center for Software Science at the University of Utah
|
|---|
| 5 | and by Cygnus Support.
|
|---|
| 6 |
|
|---|
| 7 | Copyright 1994, 1995, 1998, 1999 Free Software Foundation, Inc.
|
|---|
| 8 |
|
|---|
| 9 | This program is free software; you can redistribute it and/or modify
|
|---|
| 10 | it under the terms of the GNU General Public License as published by
|
|---|
| 11 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 12 | (at your option) any later version.
|
|---|
| 13 |
|
|---|
| 14 | This program is distributed in the hope that it will be useful,
|
|---|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 17 | GNU General Public License for more details.
|
|---|
| 18 |
|
|---|
| 19 | You should have received a copy of the GNU General Public License
|
|---|
| 20 | along with this program; if not, write to the Free Software
|
|---|
| 21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|---|
| 22 |
|
|---|
| 23 | #ifndef HP_SYMTAB_INCLUDED
|
|---|
| 24 | #define HP_SYMTAB_INCLUDED
|
|---|
| 25 |
|
|---|
| 26 | /* General information:
|
|---|
| 27 |
|
|---|
| 28 | This header file defines and describes only the data structures
|
|---|
| 29 | necessary to read debug symbols produced by the HP C compiler,
|
|---|
| 30 | HP ANSI C++ compiler, and HP FORTRAN 90 compiler using the
|
|---|
| 31 | SOM object file format.
|
|---|
| 32 | (For a full description of the debug format, ftp hpux-symtab.h from
|
|---|
| 33 | jaguar.cs.utah.edu:/dist).
|
|---|
| 34 |
|
|---|
| 35 | Additional notes (Rich Title)
|
|---|
| 36 | This file is a reverse-engineered version of a file called
|
|---|
| 37 | "symtab.h" which exists internal to HP's Computer Languages Organization
|
|---|
| 38 | in /CLO/Components/DDE/obj/som/symtab.h. Because HP's version of
|
|---|
| 39 | the file is copyrighted and not distributed, it is necessary for
|
|---|
| 40 | GDB to use the reverse-engineered version that follows.
|
|---|
| 41 | Work was done by Cygnus to reverse-engineer the C subset of symtab.h.
|
|---|
| 42 | The WDB project has extended this to also contain the C++
|
|---|
| 43 | symbol definitions, the F90 symbol definitions,
|
|---|
| 44 | and the DOC (debugging-optimized-code) symbol definitions.
|
|---|
| 45 | In some cases (the C++ symbol definitions)
|
|---|
| 46 | I have added internal documentation here that
|
|---|
| 47 | goes beyond what is supplied in HP's symtab.h. If we someday
|
|---|
| 48 | unify these files again, the extra comments should be merged back
|
|---|
| 49 | into HP's symtab.h.
|
|---|
| 50 |
|
|---|
| 51 | -------------------------------------------------------------------
|
|---|
| 52 |
|
|---|
| 53 | Debug symbols are contained entirely within an unloadable space called
|
|---|
| 54 | $DEBUG$. $DEBUG$ contains several subspaces which group related
|
|---|
| 55 | debug symbols.
|
|---|
| 56 |
|
|---|
| 57 | $GNTT$ contains information for global variables, types and contants.
|
|---|
| 58 |
|
|---|
| 59 | $LNTT$ contains information for procedures (including nesting), scoping
|
|---|
| 60 | information, local variables, types, and constants.
|
|---|
| 61 |
|
|---|
| 62 | $SLT$ contains source line information so that code addresses may be
|
|---|
| 63 | mapped to source lines.
|
|---|
| 64 |
|
|---|
| 65 | $VT$ contains various strings and constants for named objects (variables,
|
|---|
| 66 | typedefs, functions, etc). Strings are stored as null-terminated character
|
|---|
| 67 | lists. Constants always begin on word boundaries. The first byte of
|
|---|
| 68 | the VT must be zero (a null string).
|
|---|
| 69 |
|
|---|
| 70 | $XT$ is not currently used by GDB.
|
|---|
| 71 |
|
|---|
| 72 | Many structures within the subspaces point to other structures within
|
|---|
| 73 | the same subspace, or to structures within a different subspace. These
|
|---|
| 74 | pointers are represented as a structure index from the beginning of
|
|---|
| 75 | the appropriate subspace. */
|
|---|
| 76 |
|
|---|
| 77 | /* Used to describe where a constant is stored. */
|
|---|
| 78 | enum location_type
|
|---|
| 79 | {
|
|---|
| 80 | LOCATION_IMMEDIATE,
|
|---|
| 81 | LOCATION_PTR,
|
|---|
| 82 | LOCATION_VT,
|
|---|
| 83 | };
|
|---|
| 84 |
|
|---|
| 85 | /* Languages supported by this debug format. Within the data structures
|
|---|
| 86 | this type is limited to 4 bits for a maximum of 16 languages. */
|
|---|
| 87 | enum hp_language
|
|---|
| 88 | {
|
|---|
| 89 | HP_LANGUAGE_UNKNOWN,
|
|---|
| 90 | HP_LANGUAGE_C,
|
|---|
| 91 | HP_LANGUAGE_FORTRAN,
|
|---|
| 92 | HP_LANGUAGE_F77 = HP_LANGUAGE_FORTRAN,
|
|---|
| 93 | HP_LANGUAGE_PASCAL,
|
|---|
| 94 | HP_LANGUAGE_MODCAL,
|
|---|
| 95 | HP_LANGUAGE_COBOL,
|
|---|
| 96 | HP_LANGUAGE_BASIC,
|
|---|
| 97 | HP_LANGUAGE_ADA,
|
|---|
| 98 | HP_LANGUAGE_CPLUSPLUS,
|
|---|
| 99 | HP_LANGUAGE_DMPASCAL
|
|---|
| 100 | };
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 | /* Basic data types available in this debug format. Within the data
|
|---|
| 104 | structures this type is limited to 5 bits for a maximum of 32 basic
|
|---|
| 105 | data types. */
|
|---|
| 106 | enum hp_type
|
|---|
| 107 | {
|
|---|
| 108 | HP_TYPE_UNDEFINED, /* 0 */
|
|---|
| 109 | HP_TYPE_BOOLEAN, /* 1 */
|
|---|
| 110 | HP_TYPE_CHAR, /* 2 */
|
|---|
| 111 | HP_TYPE_INT, /* 3 */
|
|---|
| 112 | HP_TYPE_UNSIGNED_INT, /* 4 */
|
|---|
| 113 | HP_TYPE_REAL, /* 5 */
|
|---|
| 114 | HP_TYPE_COMPLEX, /* 6 */
|
|---|
| 115 | HP_TYPE_STRING200, /* 7 */
|
|---|
| 116 | HP_TYPE_LONGSTRING200, /* 8 */
|
|---|
| 117 | HP_TYPE_TEXT, /* 9 */
|
|---|
| 118 | HP_TYPE_FLABEL, /* 10 */
|
|---|
| 119 | HP_TYPE_FTN_STRING_SPEC, /* 11 */
|
|---|
| 120 | HP_TYPE_MOD_STRING_SPEC, /* 12 */
|
|---|
| 121 | HP_TYPE_PACKED_DECIMAL, /* 13 */
|
|---|
| 122 | HP_TYPE_REAL_3000, /* 14 */
|
|---|
| 123 | HP_TYPE_MOD_STRING_3000, /* 15 */
|
|---|
| 124 | HP_TYPE_ANYPOINTER, /* 16 */
|
|---|
| 125 | HP_TYPE_GLOBAL_ANYPOINTER, /* 17 */
|
|---|
| 126 | HP_TYPE_LOCAL_ANYPOINTER, /* 18 */
|
|---|
| 127 | HP_TYPE_COMPLEXS3000, /* 19 */
|
|---|
| 128 | HP_TYPE_FTN_STRING_S300_COMPAT, /* 20 */
|
|---|
| 129 | HP_TYPE_FTN_STRING_VAX_COMPAT, /* 21 */
|
|---|
| 130 | HP_TYPE_BOOLEAN_S300_COMPAT, /* 22 */
|
|---|
| 131 | HP_TYPE_BOOLEAN_VAX_COMPAT, /* 23 */
|
|---|
| 132 | HP_TYPE_WIDE_CHAR, /* 24 */
|
|---|
| 133 | HP_TYPE_LONG, /* 25 */
|
|---|
| 134 | HP_TYPE_UNSIGNED_LONG, /* 26 */
|
|---|
| 135 | HP_TYPE_DOUBLE, /* 27 */
|
|---|
| 136 | HP_TYPE_TEMPLATE_ARG, /* 28 */
|
|---|
| 137 | HP_TYPE_VOID /* 29 */
|
|---|
| 138 | };
|
|---|
| 139 |
|
|---|
| 140 | /* An immediate name and type table entry.
|
|---|
| 141 |
|
|---|
| 142 | extension and immediate will always be one.
|
|---|
| 143 | global will always be zero.
|
|---|
| 144 | hp_type is the basic type this entry describes.
|
|---|
| 145 | bitlength is the length in bits for the basic type. */
|
|---|
| 146 | struct dnttp_immediate
|
|---|
| 147 | {
|
|---|
| 148 | unsigned int extension: 1;
|
|---|
| 149 | unsigned int immediate: 1;
|
|---|
| 150 | unsigned int global: 1;
|
|---|
| 151 | unsigned int type: 5;
|
|---|
| 152 | unsigned int bitlength: 24;
|
|---|
| 153 | };
|
|---|
| 154 |
|
|---|
| 155 | /* A nonimmediate name and type table entry.
|
|---|
| 156 |
|
|---|
| 157 | extension will always be one.
|
|---|
| 158 | immediate will always be zero.
|
|---|
| 159 | if global is zero, this entry points into the LNTT
|
|---|
| 160 | if global is one, this entry points into the GNTT
|
|---|
| 161 | index is the index within the GNTT or LNTT for this entry. */
|
|---|
| 162 | struct dnttp_nonimmediate
|
|---|
| 163 | {
|
|---|
| 164 | unsigned int extension: 1;
|
|---|
| 165 | unsigned int immediate: 1;
|
|---|
| 166 | unsigned int global: 1;
|
|---|
| 167 | unsigned int index: 29;
|
|---|
| 168 | };
|
|---|
| 169 |
|
|---|
| 170 | /* A pointer to an entry in the GNTT and LNTT tables. It has two
|
|---|
| 171 | forms depending on the type being described.
|
|---|
| 172 |
|
|---|
| 173 | The immediate form is used for simple entries and is one
|
|---|
| 174 | word.
|
|---|
| 175 |
|
|---|
| 176 | The nonimmediate form is used for complex entries and contains
|
|---|
| 177 | an index into the LNTT or GNTT which describes the entire type.
|
|---|
| 178 |
|
|---|
| 179 | If a dnttpointer is -1, then it is a NIL entry. */
|
|---|
| 180 |
|
|---|
| 181 | #define DNTTNIL (-1)
|
|---|
| 182 | typedef union dnttpointer
|
|---|
| 183 | {
|
|---|
| 184 | struct dnttp_immediate dntti;
|
|---|
| 185 | struct dnttp_nonimmediate dnttp;
|
|---|
| 186 | int word;
|
|---|
| 187 | } dnttpointer;
|
|---|
| 188 |
|
|---|
| 189 | /* An index into the source line table. As with dnttpointers, a sltpointer
|
|---|
| 190 | of -1 indicates a NIL entry. */
|
|---|
| 191 | #define SLTNIL (-1)
|
|---|
| 192 | typedef int sltpointer;
|
|---|
| 193 |
|
|---|
| 194 | /* Index into DOC (= "Debugging Optimized Code") line table */
|
|---|
| 195 | #define LTNIL (-1)
|
|---|
| 196 | typedef int ltpointer;
|
|---|
| 197 |
|
|---|
| 198 | /* Index into context table */
|
|---|
| 199 | #define CTXTNIL (-1)
|
|---|
| 200 | typedef int ctxtpointer;
|
|---|
| 201 |
|
|---|
| 202 | /* Unsigned byte offset into the VT. */
|
|---|
| 203 | typedef unsigned int vtpointer;
|
|---|
| 204 |
|
|---|
| 205 | /* A DNTT entry (used within the GNTT and LNTT).
|
|---|
| 206 |
|
|---|
| 207 | DNTT entries are variable sized objects, but are always a multiple
|
|---|
| 208 | of 3 words (we call each group of 3 words a "block").
|
|---|
| 209 |
|
|---|
| 210 | The first bit in each block is an extension bit. This bit is zero
|
|---|
| 211 | for the first block of a DNTT entry. If the entry requires more
|
|---|
| 212 | than one block, then this bit is set to one in all blocks after
|
|---|
| 213 | the first one. */
|
|---|
| 214 |
|
|---|
| 215 | /* Each DNTT entry describes a particular debug symbol (beginning of
|
|---|
| 216 | a source file, a function, variables, structures, etc.
|
|---|
| 217 |
|
|---|
| 218 | The type of the DNTT entry is stored in the "kind" field within the
|
|---|
| 219 | DNTT entry itself. */
|
|---|
| 220 |
|
|---|
| 221 | enum dntt_entry_type
|
|---|
| 222 | {
|
|---|
| 223 | DNTT_TYPE_NIL = -1,
|
|---|
| 224 | DNTT_TYPE_SRCFILE,
|
|---|
| 225 | DNTT_TYPE_MODULE,
|
|---|
| 226 | DNTT_TYPE_FUNCTION,
|
|---|
| 227 | DNTT_TYPE_ENTRY,
|
|---|
| 228 | DNTT_TYPE_BEGIN,
|
|---|
| 229 | DNTT_TYPE_END,
|
|---|
| 230 | DNTT_TYPE_IMPORT,
|
|---|
| 231 | DNTT_TYPE_LABEL,
|
|---|
| 232 | DNTT_TYPE_FPARAM,
|
|---|
| 233 | DNTT_TYPE_SVAR,
|
|---|
| 234 | DNTT_TYPE_DVAR,
|
|---|
| 235 | DNTT_TYPE_HOLE1,
|
|---|
| 236 | DNTT_TYPE_CONST,
|
|---|
| 237 | DNTT_TYPE_TYPEDEF,
|
|---|
| 238 | DNTT_TYPE_TAGDEF,
|
|---|
| 239 | DNTT_TYPE_POINTER,
|
|---|
| 240 | DNTT_TYPE_ENUM,
|
|---|
| 241 | DNTT_TYPE_MEMENUM,
|
|---|
| 242 | DNTT_TYPE_SET,
|
|---|
| 243 | DNTT_TYPE_SUBRANGE,
|
|---|
| 244 | DNTT_TYPE_ARRAY,
|
|---|
| 245 | DNTT_TYPE_STRUCT,
|
|---|
| 246 | DNTT_TYPE_UNION,
|
|---|
| 247 | DNTT_TYPE_FIELD,
|
|---|
| 248 | DNTT_TYPE_VARIANT,
|
|---|
| 249 | DNTT_TYPE_FILE,
|
|---|
| 250 | DNTT_TYPE_FUNCTYPE,
|
|---|
| 251 | DNTT_TYPE_WITH,
|
|---|
| 252 | DNTT_TYPE_COMMON,
|
|---|
| 253 | DNTT_TYPE_COBSTRUCT,
|
|---|
| 254 | DNTT_TYPE_XREF,
|
|---|
| 255 | DNTT_TYPE_SA,
|
|---|
| 256 | DNTT_TYPE_MACRO,
|
|---|
| 257 | DNTT_TYPE_BLOCKDATA,
|
|---|
| 258 | DNTT_TYPE_CLASS_SCOPE,
|
|---|
| 259 | DNTT_TYPE_REFERENCE,
|
|---|
| 260 | DNTT_TYPE_PTRMEM,
|
|---|
| 261 | DNTT_TYPE_PTRMEMFUNC,
|
|---|
| 262 | DNTT_TYPE_CLASS,
|
|---|
| 263 | DNTT_TYPE_GENFIELD,
|
|---|
| 264 | DNTT_TYPE_VFUNC,
|
|---|
| 265 | DNTT_TYPE_MEMACCESS,
|
|---|
| 266 | DNTT_TYPE_INHERITANCE,
|
|---|
| 267 | DNTT_TYPE_FRIEND_CLASS,
|
|---|
| 268 | DNTT_TYPE_FRIEND_FUNC,
|
|---|
| 269 | DNTT_TYPE_MODIFIER,
|
|---|
| 270 | DNTT_TYPE_OBJECT_ID,
|
|---|
| 271 | DNTT_TYPE_MEMFUNC,
|
|---|
| 272 | DNTT_TYPE_TEMPLATE,
|
|---|
| 273 | DNTT_TYPE_TEMPLATE_ARG,
|
|---|
| 274 | DNTT_TYPE_FUNC_TEMPLATE,
|
|---|
| 275 | DNTT_TYPE_LINK,
|
|---|
| 276 | DNTT_TYPE_DYN_ARRAY_DESC,
|
|---|
| 277 | DNTT_TYPE_DESC_SUBRANGE,
|
|---|
| 278 | DNTT_TYPE_BEGIN_EXT,
|
|---|
| 279 | DNTT_TYPE_INLN,
|
|---|
| 280 | DNTT_TYPE_INLN_LIST,
|
|---|
| 281 | DNTT_TYPE_ALIAS,
|
|---|
| 282 | DNTT_TYPE_DOC_FUNCTION,
|
|---|
| 283 | DNTT_TYPE_DOC_MEMFUNC,
|
|---|
| 284 | DNTT_TYPE_MAX
|
|---|
| 285 | };
|
|---|
| 286 |
|
|---|
| 287 | /* DNTT_TYPE_SRCFILE:
|
|---|
|
|---|