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