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