| 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 (C) 1994-2016 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 3 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., 51 Franklin Street - Fifth Floor, Boston, |
| 22 | MA 02110-1301, USA. */ |
| 23 | |
| 24 | #ifndef HP_SYMTAB_INCLUDED |
| 25 | #define HP_SYMTAB_INCLUDED |
| 26 | |
| 27 | /* General information: |
| 28 | |
| 29 | This header file defines and describes only the data structures |
| 30 | necessary to read debug symbols produced by the HP C compiler, |
| 31 | HP ANSI C++ compiler, and HP FORTRAN 90 compiler using the |
| 32 | SOM object file format. |
| 33 | (For a full description of the debug format, ftp hpux-symtab.h from |
| 34 | jaguar.cs.utah.edu:/dist). |
| 35 | |
| 36 | Additional notes (Rich Title) |
| 37 | This file is a reverse-engineered version of a file called |
| 38 | "symtab.h" which exists internal to HP's Computer Languages Organization |
| 39 | in /CLO/Components/DDE/obj/som/symtab.h. Because HP's version of |
| 40 | the file is copyrighted and not distributed, it is necessary for |
| 41 | GDB to use the reverse-engineered version that follows. |
| 42 | Work was done by Cygnus to reverse-engineer the C subset of symtab.h. |
| 43 | The WDB project has extended this to also contain the C++ |
| 44 | symbol definitions, the F90 symbol definitions, |
| 45 | and the DOC (debugging-optimized-code) symbol definitions. |
| 46 | In some cases (the C++ symbol definitions) |
| 47 | I have added internal documentation here that |
| 48 | goes beyond what is supplied in HP's symtab.h. If we someday |
| 49 | unify these files again, the extra comments should be merged back |
| 50 | into HP's symtab.h. |
| 51 | |
| 52 | ------------------------------------------------------------------- |
| 53 | |
| 54 | Debug symbols are contained entirely within an unloadable space called |
| 55 | $DEBUG$. $DEBUG$ contains several subspaces which group related |
| 56 | debug symbols. |
| 57 | |
| 58 | $GNTT$ contains information for global variables, types and contants. |
| 59 | |
| 60 | $LNTT$ contains information for procedures (including nesting), scoping |
| 61 | information, local variables, types, and constants. |
| 62 | |
| 63 | $SLT$ contains source line information so that code addresses may be |
| 64 | mapped to source lines. |
| 65 | |
| 66 | $VT$ contains various strings and constants for named objects (variables, |
| 67 | typedefs, functions, etc). Strings are stored as null-terminated character |
| 68 | lists. Constants always begin on word boundaries. The first byte of |
| 69 | the VT must be zero (a null string). |
| 70 | |
| 71 | $XT$ is not currently used by GDB. |
| 72 | |
| 73 | Many structures within the subspaces point to other structures within |
| 74 | the same subspace, or to structures within a different subspace. These |
| 75 | pointers are represented as a structure index from the beginning of |
| 76 | the appropriate subspace. */ |
| 77 | |
| 78 | /* Used to describe where a constant is stored. */ |
| 79 | enum location_type |
| 80 | { |
| 81 | LOCATION_IMMEDIATE, |
| 82 | LOCATION_PTR, |
| 83 | LOCATION_VT, |
| 84 | }; |
| 85 | |
| 86 | /* Languages supported by this debug format. Within the data structures |
| 87 | this type is limited to 4 bits for a maximum of 16 languages. */ |
| 88 | enum hp_language |
| 89 | { |
| 90 | HP_LANGUAGE_UNKNOWN, |
| 91 | HP_LANGUAGE_C, |
| 92 | HP_LANGUAGE_FORTRAN, |
| 93 | HP_LANGUAGE_F77 = HP_LANGUAGE_FORTRAN, |
| 94 | HP_LANGUAGE_PASCAL, |
| 95 | HP_LANGUAGE_MODCAL, |
| 96 | HP_LANGUAGE_COBOL, |
| 97 | HP_LANGUAGE_BASIC, |
| 98 | HP_LANGUAGE_ADA, |
| 99 | HP_LANGUAGE_CPLUSPLUS, |
| 100 | HP_LANGUAGE_DMPASCAL |
| 101 | }; |
| 102 | |
| 103 | |
| 104 | /* Basic data types available in this debug format. Within the data |
| 105 | structures this type is limited to 5 bits for a maximum of 32 basic |
| 106 | data types. */ |
| 107 | enum hp_type |
| 108 | { |
| 109 | HP_TYPE_UNDEFINED, /* 0 */ |
| 110 | HP_TYPE_BOOLEAN, /* 1 */ |
| 111 | HP_TYPE_CHAR, /* 2 */ |
| 112 | HP_TYPE_INT, /* 3 */ |
| 113 | HP_TYPE_UNSIGNED_INT, /* 4 */ |
| 114 | HP_TYPE_REAL, /* 5 */ |
| 115 | HP_TYPE_COMPLEX, /* 6 */ |
| 116 | HP_TYPE_STRING200, /* 7 */ |
| 117 | HP_TYPE_LONGSTRING200, /* 8 */ |
| 118 | HP_TYPE_TEXT, /* 9 */ |
| 119 | HP_TYPE_FLABEL, /* 10 */ |
| 120 | HP_TYPE_FTN_STRING_SPEC, /* 11 */ |
| 121 | HP_TYPE_MOD_STRING_SPEC, /* 12 */ |
| 122 | HP_TYPE_PACKED_DECIMAL, /* 13 */ |
| 123 | HP_TYPE_REAL_3000, /* 14 */ |
| 124 | HP_TYPE_MOD_STRING_3000, /* 15 */ |
| 125 | HP_TYPE_ANYPOINTER, /* 16 */ |
| 126 | HP_TYPE_GLOBAL_ANYPOINTER, /* 17 */ |
| 127 | HP_TYPE_LOCAL_ANYPOINTER, /* 18 */ |
| 128 | HP_TYPE_COMPLEXS3000, /* 19 */ |
| 129 | HP_TYPE_FTN_STRING_S300_COMPAT, /* 20 */ |
| 130 | HP_TYPE_FTN_STRING_VAX_COMPAT, /* 21 */ |
| 131 | HP_TYPE_BOOLEAN_S300_COMPAT, /* 22 */ |
| 132 | HP_TYPE_BOOLEAN_VAX_COMPAT, /* 23 */ |
| 133 | HP_TYPE_WIDE_CHAR, /* 24 */ |
| 134 | HP_TYPE_LONG, /* 25 */ |
| 135 | HP_TYPE_UNSIGNED_LONG, /* 26 */ |
| 136 | HP_TYPE_DOUBLE, /* 27 */ |
| 137 | HP_TYPE_TEMPLATE_ARG, /* 28 */ |
| 138 | HP_TYPE_VOID /* 29 */ |
| 139 | }; |
| 140 | |
| 141 | /* An immediate name and type table entry. |
| 142 | |
| 143 | extension and immediate will always be one. |
| 144 | global will always be zero. |
| 145 | hp_type is the basic type this entry describes. |
| 146 | bitlength is the length in bits for the basic type. */ |
| 147 | struct dnttp_immediate |
| 148 | { |
| 149 | unsigned int extension: 1; |
| 150 | unsigned int immediate: 1; |
| 151 | unsigned int global: 1; |
| 152 | unsigned int type: 5; |
| 153 | unsigned int bitlength: 24; |
| 154 | }; |
| 155 | |
| 156 | /* A nonimmediate name and type table entry. |
| 157 | |
| 158 | extension will always be one. |
| 159 | immediate will always be zero. |
| 160 | if global is zero, this entry points into the LNTT |
| 161 | if global is one, this entry points into the GNTT |
| 162 | index is the index within the GNTT or LNTT for this entry. */ |
| 163 | struct dnttp_nonimmediate |
| 164 | { |
| 165 | unsigned int extension: 1; |
| 166 | unsigned int immediate: 1; |
| 167 | unsigned int global: 1; |
| 168 | unsigned int index: 29; |
| 169 | }; |
| 170 | |
| 171 | /* A pointer to an entry in the GNTT and LNTT tables. It has two |
| 172 | forms depending on the type being described. |
| 173 | |
| 174 | The immediate form is used for simple entries and is one |
| 175 | word. |
| 176 | |
| 177 | The nonimmediate form is used for complex entries and contains |
| 178 | an index into the LNTT or GNTT which describes the entire type. |
| 179 | |
| 180 | If a dnttpointer is -1, then it is a NIL entry. */ |
| 181 | |
| 182 | #define DNTTNIL (-1) |
| 183 | typedef union dnttpointer |
| 184 | { |
| 185 | struct dnttp_immediate dntti; |
| 186 | struct dnttp_nonimmediate dnttp; |
| 187 | int word; |
| 188 | } dnttpointer; |
| 189 | |
| 190 | /* An index into the source line table. As with dnttpointers, a sltpointer |
| 191 | of -1 indicates a NIL entry. */ |
| 192 | #define SLTNIL (-1) |
| 193 | typedef int sltpointer; |
| 194 | |
| 195 | /* Index into DOC (= "Debugging Optimized Code") line table. */ |
| 196 | #define LTNIL (-1) |
| 197 | typedef int ltpointer; |
| 198 | |
| 199 | /* Index into context table. */ |
| 200 | #define CTXTNIL (-1) |
| 201 | typedef int ctxtpointer; |
| 202 | |
| 203 | /* Unsigned byte offset into the VT. */ |
| 204 | typedef unsigned int vtpointer; |
| 205 | |
| 206 | /* A DNTT entry (used within the GNTT and LNTT). |
| 207 | |
| 208 | DNTT entries are variable sized objects, but are always a multiple |
| 209 | of 3 words (we call each group of 3 words a "block"). |
| 210 | |
| 211 | The first bit in each block is an extension bit. This bit is zero |
| 212 | for the first block of a DNTT entry. If the entry requires more |
| 213 | than one block, then this bit is set to one in all blocks after |
| 214 | the first one. */ |
| 215 | |
| 216 | /* Each DNTT entry describes a particular debug symbol (beginning of |
| 217 | a source file, a function, variables, structures, etc. |
| 218 | |
| 219 | The type of the DNTT entry is stored in the "kind" field within the |
| 220 | DNTT entry itself. */ |
| 221 | |
| 222 | enum dntt_entry_type |
| 223 | { |
| 224 | DNTT_TYPE_NIL = -1, |
| 225 | DNTT_TYPE_SRCFILE, |
| 226 | DNTT_TYPE_MODULE, |
| 227 | DNTT_TYPE_FUNCTION, |
| 228 | DNTT_TYPE_ENTRY, |
| 229 | DNTT_TYPE_BEGIN, |
| 230 | DNTT_TYPE_END, |
| 231 | DNTT_TYPE_IMPORT, |
| 232 | DNTT_TYPE_LABEL, |
| 233 | DNTT_TYPE_FPARAM, |
| 234 | DNTT_TYPE_SVAR, |
| 235 | DNTT_TYPE_DVAR, |
| 236 | DNTT_TYPE_HOLE1, |
| 237 | DNTT_TYPE_CONST, |
| 238 | DNTT_TYPE_TYPEDEF, |
| 239 | DNTT_TYPE_TAGDEF, |
| 240 | DNTT_TYPE_POINTER, |
| 241 | DNTT_TYPE_ENUM, |
| 242 | DNTT_TYPE_MEMENUM, |
| 243 | DNTT_TYPE_SET, |
| 244 | DNTT_TYPE_SUBRANGE, |
| 245 | DNTT_TYPE_ARRAY, |
| 246 | DNTT_TYPE_STRUCT, |
| 247 | DNTT_TYPE_UNION, |
| 248 | DNTT_TYPE_FIELD, |
| 249 | DNTT_TYPE_VARIANT, |
| 250 | DNTT_TYPE_FILE, |
| 251 | DNTT_TYPE_FUNCTYPE, |
| 252 | DNTT_TYPE_WITH, |
| 253 | DNTT_TYPE_COMMON, |
| 254 | DNTT_TYPE_COBSTRUCT, |
| 255 | DNTT_TYPE_XREF, |
| 256 | DNTT_TYPE_SA, |
| 257 | DNTT_TYPE_MACRO, |
| 258 | DNTT_TYPE_BLOCKDATA, |
| 259 | DNTT_TYPE_CLASS_SCOPE, |
| 260 | DNTT_TYPE_REFERENCE, |
| 261 | DNTT_TYPE_PTRMEM, |
| 262 | DNTT_TYPE_PTRMEMFUNC, |
| 263 | DNTT_TYPE_CLASS, |
| 264 | DNTT_TYPE_GENFIELD, |
| 265 | DNTT_TYPE_VFUNC, |
| 266 | DNTT_TYPE_MEMACCESS, |
| 267 | DNTT_TYPE_INHERITANCE, |
| 268 | DNTT_TYPE_FRIEND_CLASS, |
| 269 | DNTT_TYPE_FRIEND_FUNC, |
| 270 | DNTT_TYPE_MODIFIER, |
| 271 | DNTT_TYPE_OBJECT_ID, |
| 272 | DNTT_TYPE_MEMFUNC, |
| 273 | DNTT_TYPE_TEMPLATE, |
| 274 | DNTT_TYPE_TEMPLATE_ARG, |
| 275 | DNTT_TYPE_FUNC_TEMPLATE, |
| 276 | DNTT_TYPE_LINK, |
| 277 | DNTT_TYPE_DYN_ARRAY_DESC, |
| 278 | DNTT_TYPE_DESC_SUBRANGE, |
| 279 | DNTT_TYPE_BEGIN_EXT, |
| 280 | DNTT_TYPE_INLN, |
| 281 | DNTT_TYPE_INLN_LIST, |
| 282 | DNTT_TYPE_ALIAS, |
| 283 | DNTT_TYPE_DOC_FUNCTION, |
| 284 | DNTT_TYPE_DOC_MEMFUNC, |
| 285 | DNTT_TYPE_MAX |
| 286 | }; |
| 287 | |
| 288 | /* DNTT_TYPE_SRCFILE: |
| 289 | |
| 290 | One DNTT_TYPE_SRCFILE symbol is output for the start of each source |
| 291 | file and at the begin and end of an included file. A DNTT_TYPE_SRCFILE |
| 292 | entry is also output before each DNTT_TYPE_FUNC symbol so that debuggers |
| 293 | can determine what file a function was defined in. |
| 294 | |
| 295 | LANGUAGE describes the source file's language. |
| 296 | |
| 297 | NAME points to an VT entry providing the source file's name. |
| 298 | |
| 299 | Note the name used for DNTT_TYPE_SRCFILE entries are exactly as seen |
| 300 | by the compiler (ie they may be relative or absolute). C include files |
| 301 | via <> inclusion must use absolute paths. |
| 302 | |
| 303 | ADDRESS points to an SLT entry from which line number and code locations |
| 304 | may be determined. */ |
| 305 | |
| 306 | struct dntt_type_srcfile |
| 307 | { |
| 308 | unsigned int extension: 1; |
| 309 | unsigned int kind: 10; /* DNTT_TYPE_SRCFILE */ |
| 310 | unsigned int language: 4; |
| 311 | unsigned int unused: 17; |
| 312 | vtpointer name; |
| 313 | sltpointer address; |
| 314 | }; |
| 315 | |
| 316 | /* DNTT_TYPE_MODULE: |
| 317 | |
| 318 | A DNTT_TYPE_MODULE symbol is emitted for the start of a pascal |
| 319 | module or C source file. A module indicates a compilation unit |
| 320 | for name-scoping purposes; in that regard there should be |
| 321 | a 1-1 correspondence between GDB "symtab"'s and MODULE symbol records. |
| 322 | |
| 323 | Each DNTT_TYPE_MODULE must have an associated DNTT_TYPE_END symbol. |
| 324 | |
| 325 | NAME points to a VT entry providing the module's name. Note C |
| 326 | source files are considered nameless modules. |
| 327 | |
| 328 | ALIAS point to a VT entry providing a secondary name. |
| 329 | |
| 330 | ADDRESS points to an SLT entry from which line number and code locations |
| 331 | may be determined. */ |
| 332 | |
| 333 | struct dntt_type_module |
| 334 | { |
| 335 | unsigned int extension: 1; |
| 336 | unsigned int kind: 10; /* DNTT_TYPE_MODULE */ |
| 337 | unsigned int unused: 21; |
| 338 | vtpointer name; |
| 339 | vtpointer alias; |
| 340 | dnttpointer unused2; |
| 341 | sltpointer address; |
| 342 | }; |
| 343 | |
| 344 | /* DNTT_TYPE_FUNCTION, |
| 345 | DNTT_TYPE_ENTRY, |
| 346 | DNTT_TYPE_BLOCKDATA, |
| 347 | DNTT_TYPE_MEMFUNC: |
| 348 | |
| 349 | A DNTT_TYPE_FUNCTION symbol is emitted for each function definition; |
| 350 | a DNTT_TYPE_ENTRY symbols is used for secondary entry points. Both |
| 351 | symbols used the dntt_type_function structure. |
| 352 | A DNTT_TYPE_BLOCKDATA symbol is emitted ...? |
| 353 | A DNTT_TYPE_MEMFUNC symbol is emitted for inlined member functions (C++). |
| 354 | |
| 355 | Each of DNTT_TYPE_FUNCTION must have a matching DNTT_TYPE_END. |
| 356 | |
| 357 | GLOBAL is nonzero if the function has global scope. |
| 358 | |
| 359 | LANGUAGE describes the function's source language. |
| 360 | |
| 361 | OPT_LEVEL describes the optimization level the function was compiled |
| 362 | with. |
| 363 | |
| 364 | VARARGS is nonzero if the function uses varargs. |
| 365 | |
| 366 | NAME points to a VT entry providing the function's name. |
| 367 | |
| 368 | ALIAS points to a VT entry providing a secondary name for the function. |
| 369 | |
| 370 | FIRSTPARAM points to a LNTT entry which describes the parameter list. |
| 371 | |
| 372 | ADDRESS points to an SLT entry from which line number and code locations |
| 373 | may be determined. |
| 374 | |
| 375 | ENTRYADDR is the memory address corresponding the function's entry point |
| 376 | |
| 377 | RETVAL points to a LNTT entry describing the function's return value. |
| 378 | |
| 379 | LOWADDR is the lowest memory address associated with this function. |
| 380 | |
| 381 | HIADDR is the highest memory address associated with this function. */ |
| 382 | |
| 383 | struct dntt_type_function |
| 384 | { |
| 385 | unsigned int extension: 1; |
| 386 | unsigned int kind: 10; /* DNTT_TYPE_FUNCTION, |
| 387 | DNTT_TYPE_ENTRY, |
| 388 | DNTT_TYPE_BLOCKDATA |
| 389 | or DNTT_TYPE_MEMFUNC */ |
| 390 | unsigned int global: 1; |
| 391 | unsigned int language: 4; |
| 392 | unsigned int nest_level: 5; |
| 393 | unsigned int opt_level: 2; |
| 394 | unsigned int varargs: 1; |
| 395 | unsigned int lang_info: 4; |
| 396 | unsigned int inlined: 1; |
| 397 | unsigned int localalloc: 1; |
| 398 | unsigned int expansion: 1; |
| 399 | unsigned int unused: 1; |
| 400 | vtpointer name; |
| 401 | vtpointer alias; |
| 402 | dnttpointer firstparam; |
| 403 | sltpointer address; |
| 404 | CORE_ADDR entryaddr; |
| 405 | dnttpointer retval; |
| 406 | CORE_ADDR lowaddr; |
| 407 | CORE_ADDR hiaddr; |
| 408 | }; |
| 409 | |
| 410 | /* DNTT_TYPE_BEGIN: |
| 411 | |
| 412 | A DNTT_TYPE_BEGIN symbol is emitted to begin a new nested scope. |
| 413 | Every DNTT_TYPE_BEGIN symbol must have a matching DNTT_TYPE_END symbol. |
| 414 | |
| 415 | CLASSFLAG is nonzero if this is the beginning of a c++ class definition. |
| 416 | |
| 417 | ADDRESS points to an SLT entry from which line number and code locations |
| 418 | may be determined. */ |
| 419 | |
| 420 | struct dntt_type_begin |
| 421 | { |
| 422 | unsigned int extension: 1; |
| 423 | unsigned int kind: 10; |
| 424 | unsigned int classflag: 1; |
| 425 | unsigned int unused: 20; |
| 426 | sltpointer address; |
| 427 | }; |
| 428 | |
| 429 | /* DNTT_TYPE_END: |
| 430 | |
| 431 | A DNTT_TYPE_END symbol is emitted when closing a scope started by |
| 432 | a DNTT_TYPE_MODULE, DNTT_TYPE_FUNCTION, DNTT_TYPE_WITH, |
| 433 | DNTT_TYPE_COMMON, DNTT_TYPE_BEGIN, and DNTT_TYPE_CLASS_SCOPE symbols. |
| 434 | |
| 435 | ENDKIND describes what type of scope the DNTT_TYPE_END is closing |
| 436 | (one of the above 6 kinds). |
| 437 | |
| 438 | CLASSFLAG is nonzero if this is the end of a c++ class definition. |
| 439 | |
| 440 | ADDRESS points to an SLT entry from which line number and code locations |
| 441 | may be determined. |
| 442 | |
| 443 | BEGINSCOPE points to the LNTT entry which opened the scope. */ |
| 444 | |
| 445 | struct dntt_type_end |
| 446 | { |
| 447 | unsigned int extension: 1; |
| 448 | unsigned int kind: 10; |
| 449 | unsigned int endkind: 10; |
| 450 | unsigned int classflag: 1; |
| 451 | unsigned int unused: 10; |
| 452 | sltpointer address; |
| 453 | dnttpointer beginscope; |
| 454 | }; |
| 455 | |
| 456 | /* DNTT_TYPE_IMPORT is unused by GDB. */ |
| 457 | /* DNTT_TYPE_LABEL is unused by GDB. */ |
| 458 | |
| 459 | /* DNTT_TYPE_FPARAM: |
| 460 | |
| 461 | A DNTT_TYPE_FPARAM symbol is emitted for a function argument. When |
| 462 | chained together the symbols represent an argument list for a function. |
| 463 | |
| 464 | REGPARAM is nonzero if this parameter was passed in a register. |
| 465 | |
| 466 | INDIRECT is nonzero if this parameter is a pointer to the parameter |
| 467 | (pass by reference or pass by value for large items). |
| 468 | |
| 469 | LONGADDR is nonzero if the parameter is a 64bit pointer. |
| 470 | |
| 471 | NAME is a pointer into the VT for the parameter's name. |
| 472 | |
| 473 | LOCATION describes where the parameter is stored. Depending on the |
| 474 | parameter type LOCATION could be a register number, or an offset |
| 475 | from the stack pointer. |
| 476 | |
| 477 | TYPE points to a NTT entry describing the type of this parameter. |
| 478 | |
| 479 | NEXTPARAM points to the LNTT entry describing the next parameter. */ |
| 480 | |
| 481 | struct dntt_type_fparam |
| 482 | { |
| 483 | unsigned int extension: 1; |
| 484 | unsigned int kind: 10; |
| 485 | unsigned int regparam: 1; |
| 486 | unsigned int indirect: 1; |
| 487 | unsigned int longaddr: 1; |
| 488 | unsigned int copyparam: 1; |
| 489 | unsigned int dflt: 1; |
| 490 | unsigned int doc_ranges: 1; |
| 491 | unsigned int misc_kind: 1; |
| 492 | unsigned int unused: 14; |
| 493 | vtpointer name; |
| 494 | CORE_ADDR location; |
| 495 | dnttpointer type; |
| 496 | dnttpointer nextparam; |
| 497 | int misc; |
| 498 | }; |
| 499 | |
| 500 | /* DNTT_TYPE_SVAR: |
| 501 | |
| 502 | A DNTT_TYPE_SVAR is emitted to describe a variable in static storage. |
| 503 | |
| 504 | GLOBAL is nonzero if the variable has global scope. |
| 505 | |
| 506 | INDIRECT is nonzero if the variable is a pointer to an object. |
| 507 | |
| 508 | LONGADDR is nonzero if the variable is in long pointer space. |
| 509 | |
| 510 | STATICMEM is nonzero if the variable is a member of a class. |
| 511 | |
| 512 | A_UNION is nonzero if the variable is an anonymous union member. |
| 513 | |
| 514 | NAME is a pointer into the VT for the variable's name. |
| 515 | |
| 516 | LOCATION provides the memory address for the variable. |
| 517 | |
| 518 | TYPE is a pointer into either the GNTT or LNTT which describes |
| 519 | the type of this variable. */ |
| 520 | |
| 521 | struct dntt_type_svar |
| 522 | { |
| 523 | unsigned int extension: 1; |
| 524 | unsigned int kind: 10; |
| 525 | unsigned int global: 1; |
| 526 | unsigned int indirect: 1; |
| 527 | unsigned int longaddr: 1; |
| 528 | unsigned int staticmem: 1; |
| 529 | unsigned int a_union: 1; |
| 530 | unsigned int unused1: 1; |
| 531 | unsigned int thread_specific: 1; |
| 532 | unsigned int unused2: 14; |
| 533 | vtpointer name; |
| 534 | CORE_ADDR location; |
| 535 | dnttpointer type; |
| 536 | unsigned int offset; |
| 537 | unsigned int displacement; |
| 538 | }; |
| 539 | |
| 540 | /* DNTT_TYPE_DVAR: |
| 541 | |
| 542 | A DNTT_TYPE_DVAR is emitted to describe automatic variables and variables |
| 543 | held in registers. |
| 544 | |
| 545 | GLOBAL is nonzero if the variable has global scope. |
| 546 | |
| 547 | INDIRECT is nonzero if the variable is a pointer to an object. |
| 548 | |
| 549 | REGVAR is nonzero if the variable is in a register. |
| 550 | |
| 551 | A_UNION is nonzero if the variable is an anonymous union member. |
| 552 | |
| 553 | NAME is a pointer into the VT for the variable's name. |
| 554 | |
| 555 | LOCATION provides the memory address or register number for the variable. |
| 556 | |
| 557 | TYPE is a pointer into either the GNTT or LNTT which describes |
| 558 | the type of this variable. */ |
| 559 | |
| 560 | struct dntt_type_dvar |
| 561 | { |
| 562 | unsigned int extension: 1; |
| 563 | unsigned int kind: 10; |
| 564 | unsigned int global: 1; |
| 565 | unsigned int indirect: 1; |
| 566 | unsigned int regvar: 1; |
| 567 | unsigned int a_union: 1; |
| 568 | unsigned int unused: 17; |
| 569 | vtpointer name; |
| 570 | int location; |
| 571 | dnttpointer type; |
| 572 | unsigned int offset; |
| 573 | }; |
| 574 | |
| 575 | /* DNTT_TYPE_CONST: |
| 576 | |
| 577 | A DNTT_TYPE_CONST symbol is emitted for program constants. |
| 578 | |
| 579 | GLOBAL is nonzero if the constant has global scope. |
| 580 | |
| 581 | INDIRECT is nonzero if the constant is a pointer to an object. |
| 582 | |
| 583 | LOCATION_TYPE describes where to find the constant's value |
| 584 | (in the VT, memory, or embedded in an instruction). |
| 585 | |
| 586 | CLASSMEM is nonzero if the constant is a member of a class. |
| 587 | |
| 588 | NAME is a pointer into the VT for the constant's name. |
| 589 | |
| 590 | LOCATION provides the memory address, register number or pointer |
| 591 | into the VT for the constant's value. |
| 592 | |
| 593 | TYPE is a pointer into either the GNTT or LNTT which describes |
| 594 | the type of this variable. */ |
| 595 | |
| 596 | struct dntt_type_const |
| 597 | { |
| 598 | unsigned int extension: 1; |
| 599 | unsigned int kind: 10; |
| 600 | unsigned int global: 1; |
| 601 | unsigned int indirect: 1; |
| 602 | unsigned int location_type: 3; |
| 603 | unsigned int classmem: 1; |
| 604 | unsigned int unused: 15; |
| 605 | vtpointer name; |
| 606 | CORE_ADDR location; |
| 607 | dnttpointer type; |
| 608 | unsigned int offset; |
| 609 | unsigned int displacement; |
| 610 | }; |
| 611 | |
| 612 | /* DNTT_TYPE_TYPEDEF and DNTT_TYPE_TAGDEF: |
| 613 | |
| 614 | The same structure is used to describe typedefs and tagdefs. |
| 615 | |
| 616 | DNTT_TYPE_TYPEDEFS are associated with C "typedefs". |
| 617 | |
| 618 | DNTT_TYPE_TAGDEFs are associated with C "struct", "union", and "enum" |
| 619 | tags, which may have the same name as a typedef in the same scope. |
| 620 | Also they are associated with C++ "class" tags, which implicitly have |
| 621 | the same name as the class type. |
| 622 | |
| 623 | GLOBAL is nonzero if the typedef/tagdef has global scope. |
| 624 | |
| 625 | TYPEINFO is used to determine if full type information is available |
| 626 | for a tag. (usually 1, but can be zero for opaque types in C). |
| 627 | |
| 628 | NAME is a pointer into the VT for the constant's name. |
| 629 | |
| 630 | TYPE points to the underlying type for the typedef/tagdef in the |
| 631 | GNTT or LNTT. */ |
| 632 | |
| 633 | struct dntt_type_type |
| 634 | { |
| 635 | unsigned int extension: 1; |
| 636 | unsigned int kind: 10; /* DNTT_TYPE_TYPEDEF or |
| 637 | DNTT_TYPE_TAGDEF. */ |
| 638 | unsigned int global: 1; |
| 639 | unsigned int typeinfo: 1; |
| 640 | unsigned int unused: 19; |
| 641 | vtpointer name; |
| 642 | dnttpointer type; /* Underlying type, which for TAGDEF's may be |
| 643 | DNTT_TYPE_STRUCT, DNTT_TYPE_UNION, |
| 644 | DNTT_TYPE_ENUM, or DNTT_TYPE_CLASS. |
| 645 | For TYPEDEF's other underlying types |
| 646 | are also possible. */ |
| 647 | }; |
| 648 | |
| 649 | /* DNTT_TYPE_POINTER: |
| 650 | |
| 651 | Used to describe a pointer to an underlying type. |
| 652 | |
| 653 | POINTSTO is a pointer into the GNTT or LNTT for the type which this |
| 654 | pointer points to. |
| 655 | |
| 656 | BITLENGTH is the length of the pointer (not the underlying type). */ |
| 657 | |
| 658 | struct dntt_type_pointer |
| 659 | { |
| 660 | unsigned int extension: 1; |
| 661 | unsigned int kind: 10; |
| 662 | unsigned int unused: 21; |
| 663 | dnttpointer pointsto; |
| 664 | unsigned int bitlength; |
| 665 | }; |
| 666 | |
| 667 | |
| 668 | /* DNTT_TYPE_ENUM: |
| 669 | |
| 670 | Used to describe enumerated types. |
| 671 | |
| 672 | FIRSTMEM is a pointer to a DNTT_TYPE_MEMENUM in the GNTT/LNTT which |
| 673 | describes the first member (and contains a pointer to the chain of |
| 674 | members). |
| 675 | |
| 676 | BITLENGTH is the number of bits used to hold the values of the enum's |
| 677 | members. */ |
| 678 | |
| 679 | struct dntt_type_enum |
| 680 | { |
| 681 | unsigned int extension: 1; |
| 682 | unsigned int kind: 10; |
| 683 | unsigned int unused: 21; |
| 684 | dnttpointer firstmem; |
| 685 | unsigned int bitlength; |
| 686 | }; |
| 687 | |
| 688 | /* DNTT_TYPE_MEMENUM |
| 689 | |
| 690 | Used to describe members of an enumerated type. |
| 691 | |
| 692 | CLASSMEM is nonzero if this member is part of a class. |
| 693 | |
| 694 | NAME points into the VT for the name of this member. |
| 695 | |
| 696 | VALUE is the value of this enumeration member. |
| 697 | |
| 698 | NEXTMEM points to the next DNTT_TYPE_MEMENUM in the chain. */ |
| 699 | |
| 700 | struct dntt_type_memenum |
| 701 | { |
| 702 | unsigned int extension: 1; |
| 703 | unsigned int kind: 10; |
| 704 | unsigned int classmem: 1; |
| 705 | unsigned int unused: 20; |
| 706 | vtpointer name; |
| 707 | unsigned int value; |
| 708 | dnttpointer nextmem; |
| 709 | }; |
| 710 | |
| 711 | /* DNTT_TYPE_SET |
| 712 | |
| 713 | Used to describe PASCAL "set" type. |
| 714 | |
| 715 | DECLARATION describes the bitpacking of the set. |
| 716 | |
| 717 | SUBTYPE points to a DNTT entry describing the type of the members. |
| 718 | |
| 719 | BITLENGTH is the size of the set. */ |
| 720 | |
| 721 | struct dntt_type_set |
| 722 | { |
| 723 | unsigned int extension: 1; |
| 724 | unsigned int kind: 10; |
| 725 | unsigned int declaration: 2; |
| 726 | unsigned int unused: 19; |
| 727 | dnttpointer subtype; |
| 728 | unsigned int bitlength; |
| 729 | }; |
| 730 | |
| 731 | /* DNTT_TYPE_SUBRANGE |
| 732 | |
| 733 | Used to describe subrange type. |
| 734 | |
| 735 | DYN_LOW describes the lower bound of the subrange: |
| 736 | |
| 737 | 00 for a constant lower bound (found in LOWBOUND). |
| 738 | |
| 739 | 01 for a dynamic lower bound with the lower bound found in the |
| 740 | memory address pointed to by LOWBOUND. |
| 741 | |
| 742 | 10 for a dynamic lower bound described by an variable found in the |
| 743 | DNTT/LNTT (LOWBOUND would be a pointer into the DNTT/LNTT). |
| 744 | |
| 745 | DYN_HIGH is similar to DYN_LOW, except it describes the upper bound. |
| 746 | |
| 747 | SUBTYPE points to the type of the subrange. |
| 748 | |
| 749 | BITLENGTH is the length in bits needed to describe the subrange's |
| 750 | values. */ |
| 751 | |
| 752 | struct dntt_type_subrange |
| 753 | { |
| 754 | unsigned int extension: 1; |
| 755 | unsigned int kind: 10; |
| 756 | unsigned int dyn_low: 2; |
| 757 | unsigned int dyn_high: 2; |
| 758 | unsigned int unused: 17; |
| 759 | int lowbound; |
| 760 | int highbound; |
| 761 | dnttpointer subtype; |
| 762 | unsigned int bitlength; |
| 763 | }; |
| 764 | |
| 765 | /* DNTT_TYPE_ARRAY |
| 766 | |
| 767 | Used to describe an array type. |
| 768 | |
| 769 | DECLARATION describes the bit packing used in the array. |
| 770 | |
| 771 | ARRAYISBYTES is nonzero if the field in arraylength describes the |
| 772 | length in bytes rather than in bits. A value of zero is used to |
| 773 | describe an array with size 2**32. |
| 774 | |
| 775 | ELEMISBYTES is nonzero if the length if each element in the array |
| 776 | is describes in bytes rather than bits. A value of zero is used |
| 777 | to an element with size 2**32. |
| 778 | |
| 779 | ELEMORDER is nonzero if the elements are indexed in increasing order. |
| 780 | |
| 781 | JUSTIFIED if the elements are left justified to index zero. |
| 782 | |
| 783 | ARRAYLENGTH is the length of the array. |
| 784 | |
| 785 | INDEXTYPE is a DNTT pointer to the type used to index the array. |
| 786 | |
| 787 | ELEMTYPE is a DNTT pointer to the type for the array elements. |
| 788 | |
| 789 | ELEMLENGTH is the length of each element in the array (including |
| 790 | any padding). |
| 791 | |
| 792 | Multi-dimensional arrays are represented by ELEMTYPE pointing to |
| 793 | another DNTT_TYPE_ARRAY. */ |
| 794 | |
| 795 | struct dntt_type_array |
| 796 | { |
| 797 | unsigned int extension: 1; |
| 798 | unsigned int kind: 10; |
| 799 | unsigned int declaration: 2; |
| 800 | unsigned int dyn_low: 2; |
| 801 | unsigned int dyn_high: 2; |
| 802 | unsigned int arrayisbytes: 1; |
| 803 | unsigned int elemisbytes: 1; |
| 804 | unsigned int elemorder: 1; |
| 805 | unsigned int justified: 1; |
| 806 | unsigned int unused: 11; |
| 807 | unsigned int arraylength; |
| 808 | dnttpointer indextype; |
| 809 | dnttpointer elemtype; |
| 810 | unsigned int elemlength; |
| 811 | }; |
| 812 | |
| 813 | /* DNTT_TYPE_STRUCT |
| 814 | |
| 815 | DNTT_TYPE_STRUCT is used to describe a C structure. |
| 816 | |
| 817 | DECLARATION describes the bitpacking used. |
| 818 | |
| 819 | FIRSTFIELD is a DNTT pointer to the first field of the structure |
| 820 | (each field contains a pointer to the next field, walk the list |
| 821 | to access all fields of the structure). |
| 822 | |
| 823 | VARTAGFIELD and VARLIST are used for Pascal variant records. |
| 824 | |
| 825 | BITLENGTH is the size of the structure in bits. */ |
| 826 | |
| 827 | struct dntt_type_struct |
| 828 | { |
| 829 | unsigned int extension: 1; |
| 830 | unsigned int kind: 10; |
| 831 | unsigned int declaration: 2; |
| 832 | unsigned int unused: 19; |
| 833 | dnttpointer firstfield; |
| 834 | dnttpointer vartagfield; |
| 835 | dnttpointer varlist; |
| 836 | unsigned int bitlength; |
| 837 | }; |
| 838 | |
| 839 | /* DNTT_TYPE_UNION |
| 840 | |
| 841 | DNTT_TYPE_UNION is used to describe a C union. |
| 842 | |
| 843 | FIRSTFIELD is a DNTT pointer to the beginning of the field chain. |
| 844 | |
| 845 | BITLENGTH is the size of the union in bits. */ |
| 846 | |
| 847 | struct dntt_type_union |
| 848 | { |
| 849 | unsigned int extension: 1; |
| 850 | unsigned int kind: 10; |
| 851 | unsigned int unused: 21; |
| 852 | dnttpointer firstfield; |
| 853 | unsigned int bitlength; |
| 854 | }; |
| 855 | |
| 856 | /* DNTT_TYPE_FIELD |
| 857 | |
| 858 | DNTT_TYPE_FIELD describes one field in a structure or union |
| 859 | or C++ class. |
| 860 | |
| 861 | VISIBILITY is used to describe the visibility of the field |
| 862 | (for c++. public = 0, protected = 1, private = 2). |
| 863 | |
| 864 | A_UNION is nonzero if this field is a member of an anonymous union. |
| 865 | |
| 866 | STATICMEM is nonzero if this field is a static member of a template. |
| 867 | |
| 868 | NAME is a pointer into the VT for the name of the field. |
| 869 | |
| 870 | BITOFFSET gives the offset of this field in bits from the beginning |
| 871 | of the structure or union this field is a member of. |
| 872 | |
| 873 | TYPE is a DNTT pointer to the type describing this field. |
| 874 | |
| 875 | BITLENGTH is the size of the entry in bits. |
| 876 | |
| 877 | NEXTFIELD is a DNTT pointer to the next field in the chain. */ |
| 878 | |
| 879 | struct dntt_type_field |
| 880 | { |
| 881 | unsigned int extension: 1; |
| 882 | unsigned int kind: 10; |
| 883 | unsigned int visibility: 2; |
| 884 | unsigned int a_union: 1; |
| 885 | unsigned int staticmem: 1; |
| 886 | unsigned int unused: 17; |
| 887 | vtpointer name; |
| 888 | unsigned int bitoffset; |
| 889 | dnttpointer type; |
| 890 | unsigned int bitlength; |
| 891 | dnttpointer nextfield; |
| 892 | }; |
| 893 | |
| 894 | /* DNTT_TYPE_VARIANT is unused by GDB. */ |
| 895 | /* DNTT_TYPE_FILE is unused by GDB. */ |
| 896 | |
| 897 | /* DNTT_TYPE_FUNCTYPE |
| 898 | |
| 899 | I think this is used to describe a function type (e.g., would |
| 900 | be emitted as part of a function-pointer description). |
| 901 | |
| 902 | VARARGS is nonzero if this function uses varargs. |
| 903 | |
| 904 | FIRSTPARAM is a DNTT pointer to the first entry in the parameter |
| 905 | chain. |
| 906 | |
| 907 | RETVAL is a DNTT pointer to the type of the return value. */ |
| 908 | |
| 909 | struct dntt_type_functype |
| 910 | { |
| 911 | unsigned int extension: 1; |
| 912 | unsigned int kind: 10; |
| 913 | unsigned int varargs: 1; |
| 914 | unsigned int info: 4; |
| 915 | unsigned int unused: 16; |
| 916 | unsigned int bitlength; |
| 917 | dnttpointer firstparam; |
| 918 | dnttpointer retval; |
| 919 | }; |
| 920 | |
| 921 | /* DNTT_TYPE_WITH is emitted by C++ to indicate "with" scoping semantics. |
| 922 | (Probably also emitted by PASCAL to support "with"...). |
| 923 | |
| 924 | C++ example: Say "memfunc" is a method of class "c", and say |
| 925 | "m" is a data member of class "c". Then from within "memfunc", |
| 926 | it is legal to reference "m" directly (e.g. you don't have to |
| 927 | say "this->m". The symbol table indicates |
| 928 | this by emitting a DNTT_TYPE_WITH symbol within the function "memfunc", |
| 929 | pointing to the type symbol for class "c". |
| 930 | |
| 931 | In GDB, this symbol record is unnecessary, |
| 932 | because GDB's symbol lookup algorithm |
| 933 | infers the "with" semantics when it sees a "this" argument to the member |
| 934 | function. So GDB can safely ignore the DNTT_TYPE_WITH record. |
| 935 | |
| 936 | A DNTT_TYPE_WITH has a matching DNTT_TYPE_END symbol. */ |
| 937 | |
| 938 | struct dntt_type_with |
| 939 | { |
| 940 | unsigned int extension: 1; /* always zero */ |
| 941 | unsigned int kind: 10; /* always DNTT_TYPE_WITH */ |
| 942 | unsigned int addrtype: 2; /* 0 => STATTYPE */ |
| 943 | /* 1 => DYNTYPE */ |
| 944 | /* 2 => REGTYPE */ |
| 945 | unsigned int indirect: 1; /* 1 => pointer to object */ |
| 946 | unsigned int longaddr: 1; /* 1 => in long pointer space */ |
| 947 | unsigned int nestlevel: 6; /* # of nesting levels back */ |
| 948 | unsigned int doc_ranges: 1; /* 1 => location is range list */ |
| 949 | unsigned int unused: 10; |
| 950 | long location; /* where stored (allocated) */ |
| 951 | sltpointer address; |
| 952 | dnttpointer type; /* type of with expression */ |
| 953 | vtpointer name; /* name of with expression */ |
| 954 | unsigned long offset; /* byte offset from location */ |
| 955 | }; |
| 956 | |
| 957 | /* DNTT_TYPE_COMMON is unsupported by GDB. */ |
| 958 | /* A DNTT_TYPE_COMMON symbol must have a matching DNTT_TYPE_END symbol */ |
| 959 | |
| 960 | /* DNTT_TYPE_COBSTRUCT is unsupported by GDB. */ |
| 961 | /* DNTT_TYPE_XREF is unsupported by GDB. */ |
| 962 | /* DNTT_TYPE_SA is unsupported by GDB. */ |
| 963 | /* DNTT_TYPE_MACRO is unsupported by GDB */ |
| 964 | |
| 965 | /* DNTT_TYPE_BLOCKDATA has the same structure as DNTT_TYPE_FUNCTION */ |
| 966 | |
| 967 | /* The following are the C++ specific SOM records */ |
| 968 | |
| 969 | /* The purpose of the DNTT_TYPE_CLASS_SCOPE is to bracket C++ methods |
| 970 | and indicate the method name belongs in the "class scope" rather |
| 971 | than in the module they are being defined in. For example: |
| 972 | |
| 973 | class c { |
| 974 | ... |
| 975 | void memfunc(); // member function |
| 976 | }; |
| 977 | |
| 978 | void c::memfunc() // definition of class c's "memfunc" |
| 979 | { |
| 980 | ... |
| 981 | } |
| 982 | |
| 983 | main() |
| 984 | { |
| 985 | ... |
| 986 | } |
| 987 | |
| 988 | In the above, the name "memfunc" is not directly visible from "main". |
| 989 | I.e., you have to say "break c::memfunc". |
| 990 | If it were a normal function (not a method), it would be visible |
| 991 | via the simple "break memfunc". Since "memfunc" otherwise looks |
| 992 | like a normal FUNCTION in the symbol table, the bracketing |
| 993 | CLASS_SCOPE is what is used to indicate it is really a method. |
| 994 | |
| 995 | |
| 996 | A DNTT_TYPE_CLASS_SCOPE symbol must have a matching DNTT_TYPE_END symbol. */ |
| 997 | |
| 998 | struct dntt_type_class_scope |
| 999 | { |
| 1000 | unsigned int extension: 1; /* Always zero. */ |
| 1001 | unsigned int kind: 10; /* Always DNTT_TYPE_CLASS_SCOPE. */ |
| 1002 | unsigned int unused: 21; |
| 1003 | sltpointer address ; /* Pointer to SLT entry. */ |
| 1004 | dnttpointer type ; /* Pointer to class type DNTT. */ |
| 1005 | }; |
| 1006 | |
| 1007 | /* C++ reference parameter. |
| 1008 | The structure of this record is the same as DNTT_TYPE_POINTER - |
| 1009 | refer to struct dntt_type_pointer. */ |
| 1010 | |
| 1011 | /* The next two describe C++ pointer-to-data-member type, and |
| 1012 | pointer-to-member-function type, respectively. |
| 1013 | DNTT_TYPE_PTRMEM and DNTT_TYPE_PTRMEMFUNC have the same structure. */ |
| 1014 | |
| 1015 | struct dntt_type_ptrmem |
| 1016 | { |
| 1017 | unsigned int extension: 1; /* Always zero. */ |
| 1018 | unsigned int kind: 10; /* Always DNTT_TYPE_PTRMEM. */ |
| 1019 | unsigned int unused: 21; |
| 1020 | dnttpointer pointsto ; /* Pointer to class DNTT. */ |
| 1021 | dnttpointer memtype ; /* Type of member. */ |
| 1022 | }; |
| 1023 | |
| 1024 | struct dntt_type_ptrmemfunc |
| 1025 | { |
| 1026 | unsigned int extension: 1; /* Always zero. */ |
| 1027 | unsigned int kind: 10; /* Always DNTT_TYPE_PTRMEMFUNC. */ |
| 1028 | unsigned int unused: 21; |
| 1029 | dnttpointer pointsto ; /* Pointer to class DNTT. */ |
| 1030 | dnttpointer memtype ; /* Type of member. */ |
| 1031 | }; |
| 1032 | |
| 1033 | /* The DNTT_TYPE_CLASS symbol is emitted to describe a class type. |
| 1034 | "memberlist" points to a chained list of FIELD or GENFIELD records |
| 1035 | indicating the class members. "parentlist" points to a chained list |
| 1036 | of INHERITANCE records indicating classes from which we inherit |
| 1037 | fields. */ |
| 1038 | |
| 1039 | struct dntt_type_class |
| 1040 | { |
| 1041 | unsigned int extension: 1; /* Always zero. */ |
| 1042 | unsigned int kind: 10; /* Always DNTT_TYPE_CLASS. */ |
| 1043 | unsigned int abstract: 1; /* Is this an abstract class? */ |
| 1044 | unsigned int class_decl: 2; /* 0=class,1=union,2=struct. */ |
| 1045 | unsigned int expansion: 1; /* 1=template expansion. */ |
| 1046 | unsigned int unused: 17; |
| 1047 | dnttpointer memberlist ; /* Ptr to chain of [GEN]FIELDs. */ |
| 1048 | unsigned long vtbl_loc ; /* Offset in obj of ptr to vtbl. */ |
| 1049 | dnttpointer parentlist ; /* Ptr to K_INHERITANCE list. */ |
| 1050 | unsigned long bitlength ; /* Total at this level. */ |
| 1051 | dnttpointer identlist ; /* Ptr to chain of class ident's. */ |
| 1052 | dnttpointer friendlist ; /* Ptr to K_FRIEND list. */ |
| 1053 | dnttpointer templateptr ; /* Ptr to template. */ |
| 1054 | dnttpointer nextexp ; /* Ptr to next expansion. */ |
| 1055 | }; |
| 1056 | |
| 1057 | /* Class members are indicated via either the FIELD record (for |
| 1058 | data members, same as for C struct fields), or by the GENFIELD record |
| 1059 | (for member functions). */ |
| 1060 | |
| 1061 | struct dntt_type_genfield |
| 1062 | { |
| 1063 | unsigned int extension: 1; /* Always zero. */ |
| 1064 | unsigned int kind: 10; /* Always DNTT_TYPE_GENFIELD. */ |
| 1065 | unsigned int visibility: 2; /* Pub = 0, prot = 1, priv = 2. */ |
| 1066 | unsigned int a_union: 1; /* 1 => anonymous union member. */ |
| 1067 | unsigned int unused: 18; |
| 1068 | dnttpointer field ; /* Pointer to field or qualifier. */ |
| 1069 | dnttpointer nextfield ; /* Pointer to next field. */ |
| 1070 | }; |
| 1071 | |
| 1072 | /* C++ virtual functions. */ |
| 1073 | |
| 1074 | struct dntt_type_vfunc |
| 1075 | { |
| 1076 | unsigned int extension: 1; /* always zero */ |
| 1077 | unsigned int kind: 10; /* always DNTT_TYPE_VFUNC */ |
| 1078 | unsigned int pure: 1; /* pure virtual function ? */ |
| 1079 | unsigned int unused: 20; |
| 1080 | dnttpointer funcptr ; /* points to FUNCTION symbol */ |
| 1081 | unsigned long vtbl_offset ; /* offset into vtbl for virtual */ |
| 1082 | }; |
| 1083 | |
| 1084 | /* Not precisely sure what this is intended for - DDE ignores it. */ |
| 1085 | |
| 1086 | struct dntt_type_memaccess |
| 1087 | { |
| 1088 | unsigned int extension: 1; /* always zero */ |
| 1089 | unsigned int kind: 10; /* always DNTT_TYPE_MEMACCESS */ |
| 1090 | unsigned int unused: 21; |
| 1091 | dnttpointer classptr ; /* pointer to base class */ |
| 1092 | dnttpointer field ; /* pointer field */ |
| 1093 | }; |
| 1094 | |
| 1095 | /* The DNTT_TYPE_INHERITANCE record describes derived classes. |
| 1096 | In particular, the "parentlist" field of the CLASS record points |
| 1097 | to a list of INHERITANCE records for classes from which we |
| 1098 | inherit members. */ |
| 1099 | |
| 1100 | struct dntt_type_inheritance |
| 1101 | { |
| 1102 | unsigned int extension: 1; /* always zero */ |
| 1103 | unsigned int kind: 10; /* always DNTT_TYPE_INHERITANCE */ |
| 1104 | unsigned int Virtual: 1; /* virtual base class ? */ |
| 1105 | unsigned int visibility: 2; /* pub = 0, prot = 1, priv = 2 */ |
| 1106 | unsigned int unused: 18; |
| 1107 | dnttpointer classname ; /* first parent class, if any */ |
| 1108 | unsigned long offset ; /* offset to start of base class */ |
| 1109 | dnttpointer next ; /* pointer to next K_INHERITANCE */ |
| 1110 | unsigned long future[2] ; /* padding to 3-word block end */ |
| 1111 | }; |
| 1112 | |
| 1113 | /* C++ "friend" classes ... */ |
| 1114 | |
| 1115 | struct dntt_type_friend_class |
| 1116 | { |
| 1117 | unsigned int extension: 1; /* always zero */ |
| 1118 | unsigned int kind: 10; /* always DNTT_TYPE_FRIEND_CLASS */ |
| 1119 | unsigned int unused: 21; |
| 1120 | dnttpointer classptr ; /* pointer to class DNTT */ |
| 1121 | dnttpointer next ; /* next DNTT_FRIEND */ |
| 1122 | }; |
| 1123 | |
| 1124 | struct dntt_type_friend_func |
| 1125 | { |
| 1126 | unsigned int extension: 1; /* always zero */ |
| 1127 | unsigned int kind: 10; /* always DNTT_TYPE_FRIEND_FUNC */ |
| 1128 | unsigned int unused: 21; |
| 1129 | dnttpointer funcptr ; /* pointer to function */ |
| 1130 | dnttpointer classptr ; /* pointer to class DNTT */ |
| 1131 | dnttpointer next ; /* next DNTT_FRIEND */ |
| 1132 | unsigned long future[2] ; /* padding to 3-word block end */ |
| 1133 | }; |
| 1134 | |
| 1135 | /* DDE appears to ignore the DNTT_TYPE_MODIFIER record. |
| 1136 | It could perhaps be used to give better "ptype" output in GDB; |
| 1137 | otherwise it is probably safe for GDB to ignore it also. */ |
| 1138 | |
| 1139 | struct dntt_type_modifier |
| 1140 | { |
| 1141 | unsigned int extension: 1; /* always zero */ |
| 1142 | unsigned int kind: 10; /* always DNTT_TYPE_MODIFIER */ |
| 1143 | unsigned int m_const: 1; /* const */ |
| 1144 | unsigned int m_static: 1; /* static */ |
| 1145 | unsigned int m_void: 1; /* void */ |
| 1146 | unsigned int m_volatile: 1; /* volatile */ |
| 1147 | unsigned int m_duplicate: 1; /* duplicate */ |
| 1148 | unsigned int unused: 16; |
| 1149 | dnttpointer type ; /* subtype */ |
| 1150 | unsigned long future ; /* padding to 3-word block end */ |
| 1151 | }; |
| 1152 | |
| 1153 | /* I'm not sure what this was intended for - DDE ignores it. */ |
| 1154 | |
| 1155 | struct dntt_type_object_id |
| 1156 | { |
| 1157 | unsigned int extension: 1; /* always zero */ |
| 1158 | unsigned int kind: 10; /* always DNTT_TYPE_OBJECT_ID */ |
| 1159 | unsigned int indirect: 1; /* Is object_ident addr of addr? */ |
| 1160 | unsigned int unused: 20; |
| 1161 | unsigned long object_ident ; /* object identifier */ |
| 1162 | unsigned long offset ; /* offset to start of base class */ |
| 1163 | dnttpointer next ; /* pointer to next K_OBJECT_ID */ |
| 1164 | unsigned long segoffset ; /* for linker fixup */ |
| 1165 | unsigned long future ; /* padding to 3-word block end */ |
| 1166 | }; |
| 1167 | |
| 1168 | /* No separate dntt_type_memfunc; same as dntt_type_func */ |
| 1169 | |
| 1170 | /* Symbol records to support templates. These only get used |
| 1171 | in DDE's "describe" output (like GDB's "ptype"). */ |
| 1172 | |
| 1173 | /* The TEMPLATE record is the header for a template-class. |
| 1174 | Like the CLASS record, a TEMPLATE record has a memberlist that |
| 1175 | points to a list of template members. It also has an arglist |
| 1176 | pointing to a list of TEMPLATE_ARG records. */ |
| 1177 | |
| 1178 | struct dntt_type_template |
| 1179 | { |
| 1180 | unsigned int extension: 1; /* always zero */ |
| 1181 | unsigned int kind: 10; /* always DNTT_TYPE_TEMPLATE */ |
| 1182 | unsigned int abstract: 1; /* is this an abstract class? */ |
| 1183 | unsigned int class_decl: 2; /* 0=class,1=union,2=struct */ |
| 1184 | unsigned int unused: 18; |
| 1185 | dnttpointer memberlist ; /* ptr to chain of K_[GEN]FIELDs */ |
| 1186 | long unused2 ; /* offset in obj of ptr to vtbl */ |
| 1187 | dnttpointer parentlist ; /* ptr to K_INHERITANCE list */ |
| 1188 | unsigned long bitlength ; /* total at this level */ |
| 1189 | dnttpointer identlist ; /* ptr to chain of class ident's */ |
| 1190 | dnttpointer friendlist ; /* ptr to K_FRIEND list */ |
| 1191 | dnttpointer arglist ; /* ptr to argument list */ |
| 1192 | dnttpointer expansions ; /* ptr to expansion list */ |
| 1193 | }; |
| 1194 | |
| 1195 | /* Template-class arguments are a list of TEMPL_ARG records |
| 1196 | chained together. The "name" field is the name of the formal. |
| 1197 | E.g.: |
| 1198 | |
| 1199 | template <class T> class q { ... }; |
| 1200 | |
| 1201 | Then "T" is the name of the formal argument. */ |
| 1202 | |
| 1203 | struct dntt_type_templ_arg |
| 1204 | { |
| 1205 | unsigned int extension: 1; /* always zero */ |
| 1206 | unsigned int kind: 10; /* always DNTT_TYPE_TEMPL_ARG */ |
| 1207 | unsigned int usagetype: 1; /* 0 type-name 1 expression */ |
| 1208 | unsigned int unused: 20; |
| 1209 | vtpointer name ; /* name of argument */ |
| 1210 | dnttpointer type ; /* for non type arguments */ |
| 1211 | dnttpointer nextarg ; /* Next argument if any */ |
| 1212 | long future[2] ; /* padding to 3-word block end */ |
| 1213 | }; |
| 1214 | |
| 1215 | /* FUNC_TEMPLATE records are sort of like FUNCTION, but are emitted |
| 1216 | for template member functions. E.g., |
| 1217 | |
| 1218 | template <class T> class q |
| 1219 | { |
| 1220 | ... |
| 1221 | void f(); |
| 1222 | ... |
| 1223 | }; |
| 1224 | |
| 1225 | Within the list of FIELDs/GENFIELDs defining the member list |
| 1226 | of the template "q", "f" would appear as a FUNC_TEMPLATE. |
| 1227 | We'll also see instances of FUNCTION "f" records for each |
| 1228 | instantiation of the template. */ |
| 1229 | |
| 1230 | struct dntt_type_func_template |
| 1231 | { |
| 1232 | unsigned int extension: 1; /* always zero */ |
| 1233 | unsigned int kind: 10; /* always DNTT_TYPE_FUNC_TEMPLATE */ |
| 1234 | unsigned int public: 1; /* 1 => globally visible */ |
| 1235 | unsigned int language: 4; /* type of language */ |
| 1236 | unsigned int level: 5; /* nesting level (top level = 0)*/ |
| 1237 | unsigned int optimize: 2; /* level of optimization */ |
| 1238 | unsigned int varargs: 1; /* ellipses. Pascal/800 later */ |
| 1239 | unsigned int info: 4; /* lang-specific stuff; F_xxxx */ |
| 1240 | unsigned int inlined: 1; |
| 1241 | unsigned int localloc: 1; /* 0 at top, 1 at end of block */ |
| 1242 | unsigned int unused: 2; |
| 1243 | vtpointer name ; /* name of function */ |
| 1244 | vtpointer alias ; /* alternate name, if any */ |
| 1245 | dnttpointer firstparam ; /* first FPARAM, if any */ |
| 1246 | dnttpointer retval ; /* return type, if any */ |
| 1247 | dnttpointer arglist ; /* ptr to argument list */ |
| 1248 | }; |
| 1249 | |
| 1250 | /* LINK is apparently intended to link together function template |
| 1251 | definitions with their instantiations. However, it is not clear |
| 1252 | why this would be needed, except to provide the information on |
| 1253 | a "ptype" command. And as far as I can tell, aCC does not |
| 1254 | generate this record. */ |
| 1255 | |
| 1256 | struct dntt_type_link |
| 1257 | { |
| 1258 | unsigned int extension: 1; /* always zero */ |
| 1259 | unsigned int kind: 10; /* always DNTT_TYPE_LINK */ |
| 1260 | unsigned int linkKind: 4; /* always LINK_UNKNOWN */ |
| 1261 | unsigned int unused: 17; |
| 1262 | long future1 ; /* expansion */ |
| 1263 | dnttpointer ptr1 ; /* link from template */ |
| 1264 | dnttpointer ptr2 ; /* to expansion */ |
| 1265 | long future[2] ; /* padding to 3-word block end */ |
| 1266 | }; |
| 1267 | |
| 1268 | /* end of C++ specific SOM's. */ |
| 1269 | |
| 1270 | /* DNTT_TYPE_DYN_ARRAY_DESC is unused by GDB */ |
| 1271 | /* DNTT_TYPE_DESC_SUBRANGE is unused by GDB */ |
| 1272 | /* DNTT_TYPE_BEGIN_EXT is unused by GDB */ |
| 1273 | /* DNTT_TYPE_INLN is unused by GDB */ |
| 1274 | /* DNTT_TYPE_INLN_LIST is unused by GDB */ |
| 1275 | /* DNTT_TYPE_ALIAS is unused by GDB */ |
| 1276 | |
| 1277 | struct dntt_type_doc_function |
| 1278 | { |
| 1279 | unsigned int extension: 1; /* always zero */ |
| 1280 | unsigned int kind: 10; /* K_DOC_FUNCTION or */ |
| 1281 | /* K_DOC_MEMFUNC */ |
| 1282 | unsigned int global: 1; /* 1 => globally visible */ |
| 1283 | unsigned int language: 4; /* type of language */ |
| 1284 | unsigned int level: 5; /* nesting level (top level = 0)*/ |
| 1285 | unsigned int optimize: 2; /* level of optimization */ |
| 1286 | unsigned int varargs: 1; /* ellipses. Pascal/800 later */ |
| 1287 | unsigned int info: 4; /* lang-specific stuff; F_xxxx */ |
| 1288 | unsigned int inlined: 1; |
| 1289 | unsigned int localloc: 1; /* 0 at top, 1 at end of block */ |
| 1290 | unsigned int expansion: 1; /* 1 = function expansion */ |
| 1291 | unsigned int doc_clone: 1; |
| 1292 | vtpointer name; /* name of function */ |
| 1293 | vtpointer alias; /* alternate name, if any */ |
| 1294 | dnttpointer firstparam; /* first FPARAM, if any */ |
| 1295 | sltpointer address; /* code and text locations */ |
| 1296 | CORE_ADDR entryaddr; /* address of entry point */ |
| 1297 | dnttpointer retval; /* return type, if any */ |
| 1298 | CORE_ADDR lowaddr; /* lowest address of function */ |
| 1299 | CORE_ADDR hiaddr; /* highest address of function */ |
| 1300 | dnttpointer inline_list; /* pointer to first inline */ |
| 1301 | ltpointer lt_offset; /* start of frag/cp line table */ |
| 1302 | ctxtpointer ctxt_offset; /* start of context table for this routine */ |
| 1303 | }; |
| 1304 | |
| 1305 | /* DNTT_TYPE_DOC_MEMFUNC is unused by GDB */ |
| 1306 | |
| 1307 | /* DNTT_TYPE_GENERIC and DNTT_TYPE_BLOCK are convience structures |
| 1308 | so we can examine a DNTT entry in a generic fashion. */ |
| 1309 | struct dntt_type_generic |
| 1310 | { |
| 1311 | unsigned int word[9]; |
| 1312 | }; |
| 1313 | |
| 1314 | struct dntt_type_block |
| 1315 | { |
| 1316 | unsigned int extension: 1; |
| 1317 | unsigned int kind: 10; |
| 1318 | unsigned int unused: 21; |
| 1319 | unsigned int word[2]; |
| 1320 | }; |
| 1321 | |
| 1322 | /* One entry in a DNTT (either the LNTT or GNTT). |
| 1323 | This is a union of the above 60 or so structure definitions. */ |
| 1324 | |
| 1325 | union dnttentry |
| 1326 | { |
| 1327 | struct dntt_type_srcfile dsfile; |
| 1328 | struct dntt_type_module dmodule; |
| 1329 | struct dntt_type_function dfunc; |
| 1330 | struct dntt_type_function dentry; |
| 1331 | struct dntt_type_begin dbegin; |
| 1332 | struct dntt_type_end dend; |
| 1333 | struct dntt_type_fparam dfparam; |
| 1334 | struct dntt_type_svar dsvar; |
| 1335 | struct dntt_type_dvar ddvar; |
| 1336 | struct dntt_type_const dconst; |
| 1337 | struct dntt_type_type dtype; |
| 1338 | struct dntt_type_type dtag; |
| 1339 | struct dntt_type_pointer dptr; |
| 1340 | struct dntt_type_enum denum; |
| 1341 | struct dntt_type_memenum dmember; |
| 1342 | struct dntt_type_set dset; |
| 1343 | struct dntt_type_subrange dsubr; |
| 1344 | struct dntt_type_array darray; |
| 1345 | struct dntt_type_struct dstruct; |
| 1346 | struct dntt_type_union dunion; |
| 1347 | struct dntt_type_field dfield; |
| 1348 | struct dntt_type_functype dfunctype; |
| 1349 | struct dntt_type_with dwith; |
| 1350 | struct dntt_type_function dblockdata; |
| 1351 | struct dntt_type_class_scope dclass_scope; |
| 1352 | struct dntt_type_pointer dreference; |
| 1353 | struct dntt_type_ptrmem dptrmem; |
| 1354 | struct dntt_type_ptrmemfunc dptrmemfunc; |
| 1355 | struct dntt_type_class dclass; |
| 1356 | struct dntt_type_genfield dgenfield; |
| 1357 | struct dntt_type_vfunc dvfunc; |
| 1358 | struct dntt_type_memaccess dmemaccess; |
| 1359 | struct dntt_type_inheritance dinheritance; |
| 1360 | struct dntt_type_friend_class dfriend_class; |
| 1361 | struct dntt_type_friend_func dfriend_func; |
| 1362 | struct dntt_type_modifier dmodifier; |
| 1363 | struct dntt_type_object_id dobject_id; |
| 1364 | struct dntt_type_template dtemplate; |
| 1365 | struct dntt_type_templ_arg dtempl_arg; |
| 1366 | struct dntt_type_func_template dfunc_template; |
| 1367 | struct dntt_type_link dlink; |
| 1368 | struct dntt_type_doc_function ddocfunc; |
| 1369 | struct dntt_type_generic dgeneric; |
| 1370 | struct dntt_type_block dblock; |
| 1371 | }; |
| 1372 | |
| 1373 | /* Source line entry types. */ |
| 1374 | enum slttype |
| 1375 | { |
| 1376 | SLT_NORMAL, |
| 1377 | SLT_SRCFILE, |
| 1378 | SLT_MODULE, |
| 1379 | SLT_FUNCTION, |
| 1380 | SLT_ENTRY, |
| 1381 | SLT_BEGIN, |
| 1382 | SLT_END, |
| 1383 | SLT_WITH, |
| 1384 | SLT_EXIT, |
| 1385 | SLT_ASSIST, |
| 1386 | SLT_MARKER, |
| 1387 | SLT_CLASS_SCOPE, |
| 1388 | SLT_INLN, |
| 1389 | SLT_NORMAL_OFFSET, |
| 1390 | }; |
| 1391 | |
| 1392 | /* A normal source line entry. Simply provides a mapping of a source |
| 1393 | line number to a code address. |
| 1394 | |
| 1395 | SLTDESC will always be SLT_NORMAL or SLT_EXIT. */ |
| 1396 | |
| 1397 | struct slt_normal |
| 1398 | { |
| 1399 | unsigned int sltdesc: 4; |
| 1400 | unsigned int line: 28; |
| 1401 | CORE_ADDR address; |
| 1402 | }; |
| 1403 | |
| 1404 | struct slt_normal_off |
| 1405 | { |
| 1406 | unsigned int sltdesc: 4; |
| 1407 | unsigned int offset: 6; |
| 1408 | unsigned int line: 22; |
| 1409 | CORE_ADDR address; |
| 1410 | }; |
| 1411 | |
| 1412 | /* A special source line entry. Provides a mapping of a declaration |
| 1413 | to a line number. These entries point back into the DNTT which |
| 1414 | references them. */ |
| 1415 | |
| 1416 | struct slt_special |
| 1417 | { |
| 1418 | unsigned int sltdesc: 4; |
| 1419 | unsigned int line: 28; |
| 1420 | dnttpointer backptr; |
| 1421 | }; |
| 1422 | |
| 1423 | /* Used to describe nesting. |
| 1424 | |
| 1425 | For nested languages, an slt_assist entry must follow each SLT_FUNC |
| 1426 | entry in the SLT. The address field will point forward to the |
| 1427 | first slt_normal entry within the function's scope. */ |
| 1428 | |
| 1429 | struct slt_assist |
| 1430 | { |
| 1431 | unsigned int sltdesc: 4; |
| 1432 | unsigned int unused: 28; |
| 1433 | sltpointer address; |
| 1434 | }; |
| 1435 | |
| 1436 | struct slt_generic |
| 1437 | { |
| 1438 | unsigned int word[2]; |
| 1439 | }; |
| 1440 | |
| 1441 | union sltentry |
| 1442 | { |
| 1443 | struct slt_normal snorm; |
| 1444 | struct slt_normal_off snormoff; |
| 1445 | struct slt_special sspec; |
| 1446 | struct slt_assist sasst; |
| 1447 | struct slt_generic sgeneric; |
| 1448 | }; |
| 1449 | |
| 1450 | /* $LINES$ declarations |
| 1451 | This is the line table used for optimized code, which is only present |
| 1452 | in the new $PROGRAM_INFO$ debug space. */ |
| 1453 | |
| 1454 | #define DST_LN_ESCAPE_FLAG1 15 |
| 1455 | #define DST_LN_ESCAPE_FLAG2 14 |
| 1456 | #define DST_LN_CTX_SPEC1 13 |
| 1457 | #define DST_LN_CTX_SPEC2 12 |
| 1458 | |
| 1459 | /* Escape function codes: */ |
| 1460 | |
| 1461 | typedef enum |
| 1462 | { |
| 1463 | dst_ln_pad, /* pad byte */ |
| 1464 | dst_ln_escape_1, /* reserved */ |
| 1465 | dst_ln_dpc1_dln1, /* 1 byte line delta, 1 byte pc delta */ |
| 1466 | dst_ln_dpc2_dln2, /* 2 bytes line delta, 2 bytes pc delta */ |
| 1467 | dst_ln_pc4_ln4, /* 4 bytes ABSOLUTE line number, 4 bytes ABSOLUTE pc */ |
| 1468 | dst_ln_dpc0_dln1, /* 1 byte line delta, pc delta = 0 */ |
| 1469 | dst_ln_ln_off_1, /* statement escape, stmt # = 1 (2nd stmt on line) */ |
| 1470 | dst_ln_ln_off, /* statement escape, stmt # = next byte */ |
| 1471 | dst_ln_entry, /* entry escape, next byte is entry number */ |
| 1472 | dst_ln_exit, /* exit escape */ |
| 1473 | dst_ln_stmt_end, /* gap escape, 4 bytes pc delta */ |
| 1474 | dst_ln_stmt_cp, /* current stmt is a critical point */ |
| 1475 | dst_ln_escape_12, /* reserved */ |
| 1476 | dst_ln_escape_13, /* this is an exception site record */ |
| 1477 | dst_ln_nxt_byte, /* next byte contains the real escape code */ |
| 1478 | dst_ln_end, /* end escape, final entry follows */ |
| 1479 | dst_ln_escape1_END_OF_ENUM |
| 1480 | } |
| 1481 | dst_ln_escape1_t; |
| 1482 | |
| 1483 | typedef enum |
| 1484 | { |
| 1485 | dst_ln_ctx_1, /* next byte describes context switch with 5-bit */ |
| 1486 | /* index into the image table and 3-bit run length. */ |
| 1487 | /* If run length is 0, end with another cxt specifier or ctx_end */ |
| 1488 | dst_ln_ctx_2, /* next 2 bytes switch context: 13 bit index, 3 bit run length */ |
| 1489 | dst_ln_ctx_4, /* next 4 bytes switch context: 29 bit index, 3 bit run length */ |
| 1490 | dst_ln_ctx_end, /* end current context */ |
| 1491 | dst_ln_col_run_1, /* next byte is column position of start of next statement, */ |
| 1492 | /* following byte is length of statement */ |
| 1493 | dst_ln_col_run_2, /* next 2 bytes is column position of start of next statement, */ |
| 1494 | /* following 2 bytes is length of statement */ |
| 1495 | dst_ln_init_base1, /* next 4 bytes are absolute PC, followed by 1 byte of line number */ |
| 1496 | dst_ln_init_base2, /* next 4 bytes are absolute PC, followed by 2 bytes of line number */ |
| 1497 | dst_ln_init_base3, /* next 4 bytes are absolute PC, followed by 3 bytes of line number */ |
| 1498 | dst_ln_escape2_END_OF_ENUM |
| 1499 | } |
| 1500 | dst_ln_escape2_t; |
| 1501 | |
| 1502 | typedef union |
| 1503 | { |
| 1504 | struct |
| 1505 | { |
| 1506 | unsigned int pc_delta : 4; /* 4 bit pc delta */ |
| 1507 | int ln_delta : 4; /* 4 bit line number delta */ |
| 1508 | } |
| 1509 | delta; |
| 1510 | |
| 1511 | struct |
| 1512 | { |
| 1513 | unsigned int esc_flag : 4; /* alias for pc_delta */ |
| 1514 | unsigned int esc_code : 4; /* escape function code (dst_ln_escape1_t, or ...2_t */ |
| 1515 | } |
| 1516 | esc; |
| 1517 | |
| 1518 | struct |
| 1519 | { |
| 1520 | unsigned int esc_flag : 4; /* dst_ln_ctx_spec1, or dst_ln_ctx_spec2 */ |
| 1521 | unsigned int run_length : 2; |
| 1522 | unsigned int ctx_index : 2; /* ...spec2 contains index; ...spec1, index - 4 */ |
| 1523 | } |
| 1524 | ctx_spec; |
| 1525 | |
| 1526 | char sdata; /* signed data byte */ |
| 1527 | unsigned char udata; /* unsigned data byte */ |
| 1528 | } |
| 1529 | dst_ln_entry_t, |
| 1530 | * dst_ln_entry_ptr_t; |
| 1531 | |
| 1532 | /* Warning: although the above union occupies only 1 byte the compiler treats |
| 1533 | it as having size 2 (the minimum size of a struct). Therefore a sequence of |
| 1534 | dst_ln_entry_t's cannot be described as an array, and walking through such a |
| 1535 | sequence requires convoluted code such as |
| 1536 | ln_ptr = (dst_ln_entry_ptr_t) (char*) ln_ptr + 1 |
| 1537 | We regret the inconvenience. */ |
| 1538 | |
| 1539 | /* Structure for interpreting the byte following a dst_ln_ctx1 entry. */ |
| 1540 | typedef struct |
| 1541 | { |
| 1542 | unsigned int ctx1_index : 5; /* 5 bit index into context table */ |
| 1543 | unsigned int ctx1_run_length : 3; /* 3 bit run length */ |
| 1544 | } dst_ln_ctx1_t, |
| 1545 | *dst_ln_ctx1_ptr_t; |
| 1546 | |
| 1547 | /* Structure for interpreting the bytes following a dst_ln_ctx2 entry. */ |
| 1548 | typedef struct |
| 1549 | { |
| 1550 | unsigned int ctx2_index : 13; /* 13 bit index into context table */ |
| 1551 | unsigned int ctx2_run_length : 3; /* 3 bit run length */ |
| 1552 | } dst_ln_ctx2_t, |
| 1553 | *dst_ln_ctx2_ptr_t; |
| 1554 | |
| 1555 | /* Structure for interpreting the bytes following a dst_ln_ctx4 entry. */ |
| 1556 | typedef struct |
| 1557 | { |
| 1558 | unsigned int ctx4_index : 29; /* 29 bit index into context table */ |
| 1559 | unsigned int ctx4_run_length : 3; /* 3 bit run length */ |
| 1560 | } dst_ln_ctx4_t, |
| 1561 | *dst_ln_ctx4_ptr_t; |
| 1562 | |
| 1563 | |
| 1564 | /* PXDB definitions. |
| 1565 | |
| 1566 | PXDB is a post-processor which takes the executable file |
| 1567 | and massages the debug information so that the debugger may |
| 1568 | start up and run more efficiently. Some of the tasks |
| 1569 | performed by PXDB are: |
| 1570 | |
| 1571 | o Remove duplicate global type and variable information |
| 1572 | from the GNTT, |
| 1573 | |
| 1574 | o Append the GNTT onto the end of the LNTT and place both |
| 1575 | back in the LNTT section, |
| 1576 | |
| 1577 | o Build quick look-up tables (description follows) for |
| 1578 | files, procedures, modules, and paragraphs (for Cobol), |
| 1579 | placing these in the GNTT section, |
| 1580 | |
| 1581 | o Reconstruct the header appearing in the header section |
| 1582 | to access this information. |
| 1583 | |
| 1584 | The "quick look-up" tables are in the $GNTT$ sub-space, in |
| 1585 | the following order: |
| 1586 | |
| 1587 | Procedures -sorted by address |
| 1588 | Source files -sorted by address (of the |
| 1589 | generated code from routines) |
| 1590 | Modules -sorted by address |
| 1591 | Classes -<unsorted?> |
| 1592 | Address Alias -sorted by index <?> |
| 1593 | Object IDs -sorted by object identifier |
| 1594 | |
| 1595 | Most quick entries have (0-based) indices into the LNTT tables to |
| 1596 | the full entries for the item it describes. |
| 1597 | |
| 1598 | The post-PXDB header is in the $HEADER$ sub-space. Alas, it |
| 1599 | occurs in different forms, depending on the optimization level |
| 1600 | in the compilation step and whether PXDB was run or not. The |
| 1601 | worst part is the forms aren't self-describing, so we'll have |
| 1602 | to grovel in the bits to figure out what kind we're looking at |
| 1603 | (see hp_get_header in hp-psymtab-read.c). */ |
| 1604 | |
| 1605 | /* PXDB versions. */ |
| 1606 | |
| 1607 | #define PXDB_VERSION_CPLUSPLUS 1 |
| 1608 | #define PXDB_VERSION_7_4 2 |
| 1609 | #define PXDB_VERSION_CPP_30 3 |
| 1610 | #define PXDB_VERSION_DDE_3_2A 4 |
| 1611 | #define PXDB_VERSION_DDE_3_2 5 |
| 1612 | #define PXDB_VERSION_DDE_4_0 6 |
| 1613 | |
| 1614 | #define PXDB_VERSION_2_1 1 |
| 1615 | |
| 1616 | /* Header version for the case that there is no DOC info |
| 1617 | but the executable has been processed by pxdb (the easy |
| 1618 | case, from "cc -g"). */ |
| 1619 | |
| 1620 | typedef struct PXDB_struct |
| 1621 | { |
| 1622 | int pd_entries; /* # of entries in function look-up table */ |
| 1623 | int fd_entries; /* # of entries in file look-up table */ |
| 1624 | int md_entries; /* # of entries in module look-up table */ |
| 1625 | unsigned int pxdbed : 1; /* 1 => file has been preprocessed */ |
| 1626 | unsigned int bighdr : 1; /* 1 => this header contains 'time' word */ |
| 1627 | unsigned int sa_header : 1;/* 1 => created by SA version of pxdb */ |
| 1628 | /* used for version check in xdb */ |
| 1629 | unsigned int inlined: 1; /* one or more functions have been inlined */ |
| 1630 | unsigned int spare:12; |
| 1631 | short version; /* pxdb header version */ |
| 1632 | int globals; /* index into the DNTT where GNTT begins */ |
| 1633 | unsigned int time; /* modify time of file before being pxdbed */ |
| 1634 | int pg_entries; /* # of entries in label look-up table */ |
| 1635 | int functions; /* actual number of functions */ |
| 1636 | int files; /* actual number of files */ |
| 1637 | int cd_entries; /* # of entries in class look-up table */ |
| 1638 | int aa_entries; /* # of entries in addr alias look-up table */ |
| 1639 | int oi_entries; /* # of entries in object id look-up table */ |
| 1640 | } PXDB_header, *PXDB_header_ptr; |
| 1641 | |
| 1642 | /* Header version for the case that there is no DOC info and the |
| 1643 | executable has NOT been processed by pxdb. */ |
| 1644 | |
| 1645 | typedef struct XDB_header_struct |
| 1646 | { |
| 1647 | long gntt_length; |
| 1648 | long lntt_length; |
| 1649 | long slt_length; |
| 1650 | long vt_length; |
| 1651 | long xt_length; |
| 1652 | } XDB_header; |
| 1653 | |
| 1654 | /* Header version for the case that there is DOC info and the |
| 1655 | executable has been processed by pxdb. */ |
| 1656 | |
| 1657 | typedef struct DOC_info_PXDB_header_struct |
| 1658 | { |
| 1659 | unsigned int xdb_header: 1; /* bit set if this is post-3.1 xdb */ |
| 1660 | unsigned int doc_header: 1; /* bit set if this is doc-style header */ |
| 1661 | unsigned int version: 8; /* version of pxdb see defines |
| 1662 | PXDB_VERSION_* in this file. */ |
| 1663 | unsigned int reserved_for_flags: 16;/* for future use; -- must be |
| 1664 | set to zero. */ |
| 1665 | unsigned int has_aux_pd_table: 1; /* $GNTT$ has aux PD table */ |
| 1666 | unsigned int has_expr_table: 1; /* space has $EXPR$ */ |
| 1667 | unsigned int has_range_table: 1; /* space has $RANGE$ */ |
| 1668 | unsigned int has_context_table: 1; /* space has $SRC_CTXT$ */ |
| 1669 | unsigned int has_lines_table: 1; /* space contains a $LINES$ |
| 1670 | subspace for line tables. */ |
| 1671 | unsigned int has_lt_offset_map: 1; /* space contains an lt_offset |
| 1672 | subspace for line table mapping. */ |
| 1673 | /* The following fields are the same as those in the PXDB_header in $DEBUG$ */ |
| 1674 | int pd_entries; /* # of entries in function look-up table */ |
| 1675 | int fd_entries; /* # of entries in file look-up table */ |
| 1676 | int md_entries; /* # of entries in module look-up table */ |
| 1677 | unsigned int pxdbed : 1; /* 1 => file has been preprocessed */ |
| 1678 | unsigned int bighdr : 1; /* 1 => this header contains 'time' word */ |
| 1679 | unsigned int sa_header : 1;/* 1 => created by SA version of pxdb */ |
| 1680 | /* used for version check in xdb */ |
| 1681 | unsigned int inlined: 1; /* one or more functions have been inlined */ |
| 1682 | unsigned int spare : 28; |
| 1683 | int globals; /* index into the DNTT where GNTT begins */ |
| 1684 | unsigned int time; /* modify time of file before being pxdbed */ |
| 1685 | int pg_entries; /* # of entries in label look-up table */ |
| 1686 | int functions; /* actual number of functions */ |
| 1687 | int files; /* actual number of files */ |
| 1688 | int cd_entries; /* # of entries in class look-up table */ |
| 1689 | int aa_entries; /* # of entries in addr alias look-up table */ |
| 1690 | int oi_entries; /* # of entries in object id look-up table */ |
| 1691 | } DOC_info_PXDB_header; |
| 1692 | |
| 1693 | /* Header version for the case that there is DOC info and the |
| 1694 | executable has NOT been processed by pxdb. */ |
| 1695 | |
| 1696 | typedef struct DOC_info_header_struct |
| 1697 | { |
| 1698 | unsigned int xdb_header: 1; /* bit set if this is post-3.1 xdb */ |
| 1699 | unsigned int doc_header: 1; /* bit set if this is doc-style header*/ |
| 1700 | unsigned int version: 8; /* version of debug/header |
| 1701 | format. For 10.0 the value |
| 1702 | will be 1. For "Davis" the value is 2. */ |
| 1703 | unsigned int reserved_for_flags: 18; /* for future use; -- must be set to zero. */ |
| 1704 | unsigned int has_range_table: 1; /* space contains a $RANGE$ subspace for variable ranges. */ |
| 1705 | unsigned int has_context_table: 1; /* space contains a $CTXT$ subspace for context/inline table. */ |
| 1706 | unsigned int has_lines_table: 1; /* space contains a $LINES$ subspace for line tables. */ |
| 1707 | unsigned int has_lt_offset_map: 1; /* space contains an lt_offset subspace for line table mapping. */ |
| 1708 | |
| 1709 | long gntt_length; /* same as old header */ |
| 1710 | long lntt_length; /* same as old header */ |
| 1711 | long slt_length; /* same as old header */ |
| 1712 | long vt_length; /* same as old header */ |
| 1713 | long xt_length; /* same as old header */ |
| 1714 | long ctxt_length; /* present only if version >= 2 */ |
| 1715 | long range_length; /* present only if version >= 2 */ |
| 1716 | long expr_length; /* present only if version >= 2 */ |
| 1717 | |
| 1718 | } DOC_info_header; |
| 1719 | |
| 1720 | typedef union GenericDebugHeader_union |
| 1721 | { |
| 1722 | PXDB_header no_doc; |
| 1723 | DOC_info_PXDB_header doc; |
| 1724 | XDB_header no_pxdb_no_doc; |
| 1725 | DOC_info_header no_pxdb_doc; |
| 1726 | } GenericDebugHeader; |
| 1727 | |
| 1728 | |
| 1729 | /* Procedure Descriptor: |
| 1730 | An element of the procedure quick look-up table. */ |
| 1731 | |
| 1732 | typedef struct quick_procedure |
| 1733 | { |
| 1734 | long isym; /* 0-based index of first symbol |
| 1735 | for procedure in $LNTT$, |
| 1736 | i.e. the procedure itself. */ |
| 1737 | CORE_ADDR adrStart; /* memory adr of start of proc */ |
| 1738 | CORE_ADDR adrEnd; /* memory adr of end of proc */ |
| 1739 | char *sbAlias; /* alias name of procedure */ |
| 1740 | char *sbProc; /* real name of procedure */ |
| 1741 | CORE_ADDR adrBp; /* address of entry breakpoint */ |
| 1742 | CORE_ADDR adrExitBp; /* address of exit breakpoint */ |
| 1743 | int icd; /* member of this class (index) */ |
| 1744 | unsigned int ipd; /* index of template for this */ |
| 1745 | /* function (index) */ |
| 1746 | unsigned int unused: 5; |
| 1747 | unsigned int no_lt_offset: 1;/* no entry in lt_offset table */ |
| 1748 | unsigned int fTemplate: 1; /* function template */ |
| 1749 | unsigned int fExpansion: 1; /* function expansion */ |
| 1750 | unsigned int linked : 1; /* linked with other expansions */ |
| 1751 | unsigned int duplicate: 1; /* clone of another procedure */ |
| 1752 | unsigned int overloaded:1; /* overloaded function */ |
| 1753 | unsigned int member: 1; /* class member function */ |
| 1754 | unsigned int constructor:1; /* constructor function */ |
| 1755 | unsigned int destructor:1; /* destructor function */ |
| 1756 | unsigned int Static: 1; /* static function */ |
| 1757 | unsigned int Virtual: 1; /* virtual function */ |
| 1758 | unsigned int constant: 1; /* constant function */ |
| 1759 | unsigned int pure: 1; /* pure (virtual) function */ |
| 1760 | unsigned int language: 4; /* procedure's language */ |
| 1761 | unsigned int inlined: 1; /* function has been inlined */ |
| 1762 | unsigned int Operator: 1; /* operator function */ |
| 1763 | unsigned int stub: 1; /* bodyless function */ |
| 1764 | unsigned int optimize: 2; /* optimization level */ |
| 1765 | unsigned int level: 5; /* nesting level (top=0) */ |
| 1766 | } quick_procedure_entry, *quick_procedure_entry_ptr; |
| 1767 | |
| 1768 | /* Source File Descriptor: |
| 1769 | An element of the source file quick look-up table. */ |
| 1770 | |
| 1771 | typedef struct quick_source |
| 1772 | { |
| 1773 | long isym; /* 0-based index in $LNTT$ of |
| 1774 | first symbol for this file. */ |
| 1775 | CORE_ADDR adrStart; /* mem adr of start of file's code */ |
| 1776 | CORE_ADDR adrEnd; /* mem adr of end of file's code */ |
| 1777 | char *sbFile; /* name of source file */ |
| 1778 | unsigned int fHasDecl: 1; /* do we have a .d file? */ |
| 1779 | unsigned int fWarned: 1; /* have warned about age problems? */ |
| 1780 | unsigned int fSrcfile: 1; /* 0 => include 1=> source */ |
| 1781 | unsigned short ilnMac; /* lines in file (0 if don't know) */ |
| 1782 | int ipd; /* 0-based index of first procedure |
| 1783 | in this file, in the quick |
| 1784 | look-up table of procedures. */ |
| 1785 | unsigned int *rgLn; /* line pointer array, if any */ |
| 1786 | } quick_file_entry, *quick_file_entry_ptr; |
| 1787 | |
| 1788 | /* Module Descriptor: |
| 1789 | An element of the module quick reference table. */ |
| 1790 | |
| 1791 | typedef struct quick_module |
| 1792 | { |
| 1793 | long isym; /* 0-based index of first |
| 1794 | symbol for module. */ |
| 1795 | CORE_ADDR adrStart; /* adr of start of mod. */ |
| 1796 | CORE_ADDR adrEnd; /* adr of end of mod. */ |
| 1797 | char *sbAlias; /* alias name of module */ |
| 1798 | char *sbMod; /* real name of module */ |
| 1799 | unsigned int imports: 1; /* module have any imports? */ |
| 1800 | unsigned int vars_in_front: 1; /* module globals in front? */ |
| 1801 | unsigned int vars_in_gaps: 1; /* module globals in gaps? */ |
| 1802 | unsigned int language: 4; /* type of language */ |
| 1803 | unsigned int unused : 25; |
| 1804 | unsigned int unused2; /* space for future stuff */ |
| 1805 | } quick_module_entry, *quick_module_entry_ptr; |
| 1806 | |
| 1807 | /* Auxiliary Procedure Descriptor: |
| 1808 | An element of the auxiliary procedure quick look-up table. */ |
| 1809 | |
| 1810 | typedef struct quick_aux_procedure |
| 1811 | { |
| 1812 | long isym_inln; /* start on inline list for proc */ |
| 1813 | long spare; |
| 1814 | } quick_aux_procedure_entry, *quick_aux_procedure_entry_ptr; |
| 1815 | |
| 1816 | /* Paragraph Descriptor: |
| 1817 | An element of the paragraph quick look-up table. */ |
| 1818 | |
| 1819 | typedef struct quick_paragraph |
| 1820 | { |
| 1821 | long isym; /* first symbol for label (index) */ |
| 1822 | CORE_ADDR adrStart; /* memory adr of start of label */ |
| 1823 | CORE_ADDR adrEnd; /* memory adr of end of label */ |
| 1824 | char *sbLab; /* name of label */ |
| 1825 | unsigned int inst; /* Used in xdb to store inst @ bp */ |
| 1826 | unsigned int sect: 1; /* true = section, false = parag. */ |
| 1827 | unsigned int unused: 31; /* future use */ |
| 1828 | } quick_paragraph_entry, *quick_paragraph_entry_ptr; |
| 1829 | |
| 1830 | /* Class Descriptor: |
| 1831 | An element of the class quick look-up table. */ |
| 1832 | |
| 1833 | typedef struct quick_class |
| 1834 | { |
| 1835 | char *sbClass; /* name of class */ |
| 1836 | long isym; /* class symbol (tag) */ |
| 1837 | unsigned int type : 2; /* 0=class, 1=union, 2=struct */ |
| 1838 | unsigned int fTemplate : 1;/* class template */ |
| 1839 | unsigned int expansion : 1;/* template expansion */ |
| 1840 | unsigned int unused :28; |
| 1841 | sltpointer lowscope; /* beginning of defined scope */ |
| 1842 | sltpointer hiscope; /* end of defined scope */ |
| 1843 | } quick_class_entry, *quick_class_entry_ptr; |
| 1844 | |
| 1845 | /* Address Alias Entry |
| 1846 | An element of the address alias quick look-up table. */ |
| 1847 | |
| 1848 | typedef struct quick_alias |
| 1849 | { |
| 1850 | CORE_ADDR low; |
| 1851 | CORE_ADDR high; |
| 1852 | int index; |
| 1853 | unsigned int unused : 31; |
| 1854 | unsigned int alternate : 1; /* alternate unnamed aliases? */ |
| 1855 | } quick_alias_entry, *quick_alias_entry_ptr; |
| 1856 | |
| 1857 | /* Object Identification Entry |
| 1858 | An element of the object identification quick look-up table. */ |
| 1859 | |
| 1860 | typedef struct quick_obj_ID |
| 1861 | { |
| 1862 | CORE_ADDR obj_ident; /* class identifier */ |
| 1863 | long isym; /* class symbol */ |
| 1864 | long offset; /* offset to object start */ |
| 1865 | } quick_obj_ID_entry, *quick_obj_ID_entry_ptr; |
| 1866 | |
| 1867 | #endif /* HP_SYMTAB_INCLUDED */ |