* bfdlink.h (struct bfd_link_callbacks): Fix comments for
[deliverable/binutils-gdb.git] / include / hpux-symtab.h
1 /***************************************************************************
2 * (c) Copyright 1988 - 1993 HEWLETT-PACKARD COMPANY. All rights reserved. *
3 ***************************************************************************/
4
5 /***************************************************************************
6 * This program is "free" software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; Version 2, June 1991.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this include file; if not, write to the Free Software Foundation,
17 * Inc, 675 Mass Ave, Cambridge, MA 02139, USA
18 *
19 ***************************************************************************/
20
21 /***************************************************************************
22 *
23 * Hewlett-Packard Company will not respond to external queries regarding
24 * the distribution or content of this include file. The University of
25 * Utah Center for Software Science (CSS) is the contact point for its
26 * distribution. CSS distributes this file under the terms of the GNU
27 * General Public License, as above: WITHOUT ANY WARRANTY. CSS makes NO
28 * WARRANTY as to the file's accuracy or timeliness. This file is NOT
29 * SUPPORTED by CSS.
30 *
31 * The current distributed version of this file is available by
32 * anonymous ftp from jaguar.cs.utah.edu in dist/hpux-symtab.h.
33 * The GNU General Public License is in dist/COPYING.
34 * Email may be directed to pa-gdb-bugs@cs.utah.edu.
35 *
36 ***************************************************************************/
37
38 #ifndef _SYMTAB_INCLUDED /* allow multiple inclusions */
39 #define _SYMTAB_INCLUDED
40
41 /*
42 *
43 * SYMBOLIC DEBUG FORMAT ACD
44 * $Revision$
45 *
46 *
47 *
48 * ---- 1. INTRODUCTION
49 *
50 *
51 * This document describes the current format for data tables which
52 * appear in HP-UX / HPE object files (a.out files). These tables
53 * will be generated by the compilers, fixed up by the linker, and
54 * used by various programs (primarily the symbolic debugger(s)) to
55 * reconstruct information about the program. The form of this
56 * document is a C include file annotated with comments.
57 *
58 * On PA-RISC, a major goal was that the linker need not know
59 * anything about the format. To this end, it was decided that the
60 * debug information be composed of several unloadable subspaces
61 * within an unloadable space (named $DEBUG$), and that link time
62 * updates to the debug information be made through the standard
63 * mechanism of a list of fixups. The linker will perform the
64 * required fixups for the debug spaces, and subspaces from
65 * separate compilation units will be concatenated. However, at
66 * exec time, the loader would know that the debug space is not to
67 * be loaded.
68 *
69 * Similarly, on the series 300, several debug tables are present
70 * in the a.out format which are not loaded at exec time. Debug
71 * tables are simply concatenated into larger tables at link time
72 * and all fixups are then performed by pxdb.
73 */
74
75 /*
76 * ---- 2. SUMMARY OF STRUCTURES
77 *
78 *
79 * The debug information consists of six tables: a header table
80 * and five special tables. The header table will contain one
81 * header record for each compilation unit. Each header record
82 * identifies the size (in bytes) of the five tables generated by
83 * that compilation unit. Two of the tables are very similar. The
84 * GNTT and LNTT both contain name and type information (NTT for
85 * Name and Type Table). The GNTT contains information about
86 * globals, and is thus limited to variables, types, and constants.
87 * The LNTT is for information about locals. The LNTT must
88 * therefore contain scoping information such as procedure nesting,
89 * begin-end blocks, etc. The GNTT and LNTT are both DNTTs (Debug
90 * Name and Type Tables), so the prefix DNTT is attached to objects
91 * (like a DNTTPOINTER) that are relevant to both the GNTT and
92 * LNTT. The SLT contains information relating source (or listing)
93 * lines to code addresses. The SLT and LNTT contain pointers
94 * between the two tables, so that the scoping information
95 * contained in the LNTT can also be used with the SLT. The VT
96 * contains ascii strings (such as variable names) and the values
97 * of named constants. The five tables are summarized below:
98 *
99 *
100 * Table Abbr Contains Points into
101 * ============= ==== ========================= ===============
102 * Global symbols GNTT global name-and-type info GNTT
103 * Local symbols LNTT local name-and-type info GNTT,LNTT,SLT,VT
104 * source line SLT source/listing line info LNTT,SLT
105 * value VT names and constants -
106 * xref XT File offsets and Attributes XT,VT
107 *
108 *
109 * The pointers needed within the debug tables are in fact indexes
110 * into the tables. The GNTT, LNTT, and SLT each consist of a series
111 * of equal-sized entries. Some DNTT entries begin a data structure
112 * and some are extension entries. Some SLT entries are "special"
113 * (point back to the LNTT), others are "assist" (point forward in
114 * the SLT), but most are "normal" (point to code).
115 *
116 * There can be pointers from the LNTT to the GNTT, as it is common
117 * to have local variables of a global type. However, there are
118 * never pointers from the GNTT to the LNTT, as global variables
119 * are never of a local type.
120 *
121 * The tables are defined to be as machine-independent as possible,
122 * but the debugger may need to "know" some facts about the system
123 * and language it is dealing with.
124 *
125 * The GNTT and LNTT are the only tables that require fixups to be
126 * generated by the compiler and acted upon by the linker. There
127 * are other fixups to be done, but these are all done by the pre-
128 * processor.
129 */
130
131 /*
132 * ---- 3. LOW-LEVEL TYPE DECLARATIONS
133 */
134
135 /*
136 * Code or data address:
137 *
138 * For the series 300:
139 *
140 * A virtual Address
141 *
142 * For PA-RISC:
143 *
144 * A PA-RISC short pointer.
145 *
146 */
147
148 #if __cplusplus
149 #define public global
150 #endif
151
152 typedef long ADDRESS;
153 typedef unsigned long ADRT, *pADRT;
154
155 /*
156 * Language types:
157 *
158 * Sizeof (LANGTYPE) = 4 bits, for a maximum of 16 possible
159 * language types.
160 */
161
162 typedef unsigned int LANGTYPE;
163
164 #define LANG_UNKNOWN 0
165 #define LANG_C 1
166 #define LANG_HPF77 2
167 #define LANG_HPPASCAL 3
168 #define LANG_HPMODCAL 4
169 #define LANG_HPCOBOL 5
170 #define LANG_HPBASIC 6
171 #define LANG_HPADA 7
172 #ifdef CPLUSPLUS
173 #define LANG_CPLUSPLUS 8
174 #endif
175
176
177 /*
178 * Location types:
179 *
180 * 32-bit, machine-dependent and context-dependent specifiers of
181 * variable storage location.
182 */
183
184 typedef unsigned long STATTYPE; /* static-type location */
185 typedef long DYNTYPE; /* dynamic-type location */
186 typedef unsigned long REGTYPE; /* register-type location */
187
188 #define STATNIL (-1) /* no location for STATTYPE */
189
190 /*
191 * Loc type Series 300 PA-RISC
192 * ======== ================ ===============
193 *
194 * STATTYPE Absolute address A PA-RISC
195 * into process short pointer.
196 * space (could be
197 * code or data).
198 *
199 *
200 * DYNTYPE A6-register- SP-register
201 * relative byte relative byte
202 * offset (+/-). offset (+/-)
203 *
204 * REGTYPE Register number Register number
205 * (see below). (see below).
206 *
207 * All location types are always byte (not word) pointers when they
208 * address memory, and they always point to the first byte
209 * containing the object, skipping any padding bytes. For example,
210 * if in Pascal a CHAR is allocated in the last byte of a whole
211 * word, the pointer is to that byte. (In C, four different CHAR
212 * variables might be packed into one word.)
213 */
214
215 /*
216 * Meaning of STATTYPE for CONST entries:
217 *
218 * Sizeof (LOCDESCTYPE) = 3 bits, for a maximum of 8 possible
219 * desctypes.
220 */
221
222 typedef unsigned int LOCDESCTYPE;
223
224 #define LOC_IMMED 0 /* immediate constant */
225 #define LOC_PTR 1 /* standard STATTYPE */
226 #define LOC_VT 2 /* value table byte offset */
227
228 /*
229 * Register numbers for REGTYPE (Series 300 only):
230 */
231
232 #define REG_D0 0
233 #define REG_D1 1
234 #define REG_D2 2
235 #define REG_D3 3
236 #define REG_D4 4
237 #define REG_D5 5
238 #define REG_D6 6
239 #define REG_D7 7
240
241 #define REG_A0 8
242 #define REG_A1 9
243 #define REG_A2 10
244 #define REG_A3 11
245 #define REG_A4 12
246 #define REG_A5 13
247 #define REG_A6 14
248 #define REG_A7 15
249
250 #define REG_FP0 16
251 #define REG_FP1 17
252 #define REG_FP2 18
253 #define REG_FP3 19
254 #define REG_FP4 20
255 #define REG_FP5 21
256 #define REG_FP6 22
257 #define REG_FP7 23
258
259 #define REG_FPA0 24
260 #define REG_FPA1 25
261 #define REG_FPA2 26
262 #define REG_FPA3 27
263 #define REG_FPA4 28
264 #define REG_FPA5 29
265 #define REG_FPA6 30
266 #define REG_FPA7 31
267 #define REG_FPA8 32
268 #define REG_FPA9 33
269 #define REG_FPA10 34
270 #define REG_FPA11 35
271 #define REG_FPA12 36
272 #define REG_FPA13 37
273 #define REG_FPA14 38
274 #define REG_FPA15 39
275
276 /*
277 * generic floating point registers;
278 * actual register determined at runtime
279 */
280
281 #define REG_FGEN0 40
282 #define REG_FGEN1 41
283 #define REG_FGEN2 42
284 #define REG_FGEN3 43
285 #define REG_FGEN4 44
286 #define REG_FGEN5 45
287 #define REG_FGEN6 46
288 #define REG_FGEN7 47
289 #define REG_FGEN8 48
290 #define REG_FGEN9 49
291 #define REG_FGEN10 50
292 #define REG_FGEN11 51
293 #define REG_FGEN12 52
294 #define REG_FGEN13 53
295 #define REG_FGEN14 54
296 #define REG_FGEN15 55
297
298 /*
299 * Basetypes:
300 *
301 * Sizeof (BASETYPE) = 5 bits, for a maximum of 32 possible
302 * basetypes.
303 */
304
305 typedef unsigned int BASETYPE;
306
307 #define T_UNDEFINED 0 /* unheard of */
308 #define T_BOOLEAN 1 /* true/false or LOGICAL */
309 #define T_CHAR 2 /* ASCII, signed if used as int */
310 #define T_INT 3 /* signed integer */
311 #define T_UNS_INT 4 /* unsigned integer */
312 #define T_REAL 5 /* binary or decimal real */
313 #define T_COMPLEX 6 /* pair of reals */
314 #define T_STRING200 7 /* Series 300 string type */
315 #define T_LONGSTRING200 8 /* Series 300 long string type */
316 #define T_TEXT 9 /* for Pascal TEXT file */
317 #define T_FLABEL 10 /* for any program labels */
318 #define T_FTN_STRING_SPEC 11 /* PA-RISC FORTRAN string type */
319 #define T_MOD_STRING_SPEC 12 /* PA-RISC Modcal/Pascal string */
320 #define T_PACKED_DECIMAL 13 /* packed decimal */
321 #define T_REAL_3000 14 /* HP3000 format real */
322 #define T_MOD_STRING_3000 15 /* HP3000 Modcal/Pascal string */
323 #define T_ANYPTR 16 /* Pascal any-pointer */
324 #define T_GLOBAL_ANYPTR 17 /* Pascal global any-pointer */
325 #define T_LOCAL_ANYPTR 18 /* Pascal local any-pointer */
326 #define T_COMPLEXS3000 19 /* HP3000 format complex */
327 #define T_FTN_STRING_S300_COMPAT 20 /* 9000/s300 compatible fortran string */
328 #define T_FTN_STRING_VAX_COMPAT 21 /* VAX compatible fortran string */
329 #define T_BOOLEAN_S300_COMPAT 22 /* 9000/s300 compatible fortran logical */
330 #define T_BOOLEAN_VAX_COMPAT 23 /* VAX compatible fortran logical */
331 #define T_WIDE_CHAR 24 /* ANSI/C wchar_t pseudo-type */
332 #define T_LONG 25 /* signed long */
333 #define T_UNS_LONG 26 /* unsigned long */
334 #define T_DOUBLE 27 /* binary or decimal double */
335 #ifdef TEMPLATES
336 #define T_TEMPLATE_ARG 28 /* template argument immediate type */
337 #endif /* TEMPLATES */
338
339 /* THE HIGHEST BASE_TYPE ALLOWABLE is 31 (see DNTTP_IMMEDIATE) */
340 /*
341 * The string types are reserved for cases where the language has
342 * an explicit string type separate from "array of char".
343 *
344 * The ANSI/C wchar_t typedef defines a special base-type to
345 * the debugger. The interpretation of wide-characters during
346 * input or display (i.e. their mapping to/from "external"
347 * characters) is defined by the ANSI/C functions mbtowc() and
348 * wctomb(), the "multi-byte" translation functions.
349 *
350 * T_FLABEL is used for CONSTs which are actually FORTRAN labels.
351 * The T_FLABEL is needed for the following: in FORTRAN there is
352 * the ASSIGN statement (ASSIGN <label> TO <integer variable>),
353 * which places the address of the statement prefixed with the
354 * label <label> into the integer variable. This integer variable
355 * can then be used as a label (e.g. GOTO <integer variable>).
356 * The user may wish to display the contents of the integer variable
357 * as a label. The DNTT LABEL entry is not sufficient, as the label
358 * need not be on an executable statement (e.g. a FORMAT statement),
359 * and the DNTT LABEL can only be used with executable statements.
360 *
361 * The bitlength in a DNTT entry further qualifies the basetype.
362 * Here is a summary of the legal values for bitlength. See the
363 * appropriate sections below for details.
364 *
365 * T_UNDEFINED any probably treat as int
366 * T_BOOLEAN 1 one-bit value
367 * 16,32 FORTRAN LOGICAL
368 * T_CHAR 1..8 size of char (really can be < 8 bits in C)
369 * T_INT 2..n probably n <= 64; incl. sign bit
370 * T_UNS_INT 1..n probably n <= 64
371 * T_REAL 32 short binary
372 * 64 long binary
373 * 128 extended real
374 * T_COMPLEX 64 two short binaries
375 * 128 two long binaries
376 * 192 two decimals
377 * T_STRING200 n * 8 maximum allocated memory, including
378 * length byte and/or terminator byte
379 * T_FTN_STRING_SPEC (to be determined)
380 * T_MOD_STRING_SPEC (to be determined)
381 * T_TEXT n size of the element buffer only
382 * T_FLABEL n * 8 size of the format label
383 * T_PACKED_DECIMAL (to be determined)
384 * T_WIDE_CHAR 32 determined by HP's NLS/Ansi-C committees
385 */
386
387 typedef unsigned int BITS;
388
389 /*
390 * DNTT pointer:
391 */
392
393 struct DNTTP_IMMEDIATE {
394 BITS extension: 1; /* always set to 1 */
395 BITS immediate: 1; /* always set to 1 */
396 BITS global: 1; /* always set to 0 */
397 BASETYPE type: 5; /* immediate basetype */
398 BITS bitlength: 24; /* immediate bitlength */
399 };
400
401 /*
402 * Note that for type T_TEMPLATE_ARG bitlength is an positioning
403 * index into the chain of DNTT_TEMPLATE_ARG hanging out of
404 * the DNTT_TEMPLATE arglist field.
405 */
406
407 struct DNTTP_NONIMMED {
408 BITS extension: 1; /* always set to 1 */
409 BITS immediate: 1; /* always set to 0 */
410 BITS global: 1; /* 1 => GNTT, 0 => LNTT */
411 BITS index: 29; /* DNTT table index */
412 };
413
414 typedef union {
415 struct DNTTP_IMMEDIATE dntti;
416 struct DNTTP_NONIMMED dnttp;
417 long word; /* for generic access */
418 } DNTTPOINTER; /* one word */
419
420 #define DNTTNIL (-1)
421
422 /*
423 * A DNTTPOINTER of DNTTNIL means a nil pointer. In the DNTT
424 * immediate case there is always at least one zero bit (the global
425 * bit) to distinguish that case from nil pointer (-1). In the
426 * non-immediate, non-nil case DNTTPOINTER is the block index, base
427 * zero, of another DNTT entry; the global bit indicates which table
428 * it is an index into, the GNTT or LNTT. Each block is 12 bytes.
429 *
430 * Extension bits really have nothing to do with DNTT pointers, but
431 * are needed for constructing the DNTT. See the next section.
432 *
433 * Bitlength is the MINIMUM (packed) size of the object. In lieu
434 * of other information (i.e., outside of a structure or array),
435 * the object is assumed to be right-justified in the minimum
436 * number of whole bytes required to hold the bitlength. An
437 * immediate DNTTPOINTER is only allowed if the type is a simple
438 * BASETYPE. Otherwise, a separate DNTT entry must be used.
439 */
440
441
442 /*
443 * SLT pointer:
444 *
445 * Signed entry index, base zero, into the source line table.
446 * Each entry is eight bytes.
447 */
448
449 typedef long SLTPOINTER;
450
451 #define SLTNIL (-1)
452
453
454 /*
455 * VT pointer:
456 *
457 * Unsigned byte offset into the value table. Note that VTNIL
458 * is not actually a nil pointer, but rather a pointer to a nil
459 * string (see section 6).
460 */
461
462 typedef long VTPOINTER;
463
464 #define VTNIL 0
465
466
467 /*
468 * XREF pointer:
469 *
470 * Signed entry index, base zero, into the cross reference table.
471 * Each entry is four bytes.
472 */
473
474 typedef long XREFPOINTER;
475
476 #define XREFNIL (-1)
477
478
479 /*
480 * Values for "declaration" fields describing packing method
481 */
482
483 #define DECLNORMAL 0
484 #define DECLPACKED 1
485 #define DECLCRUNCHED 2
486
487
488 /*
489 * ---- 4. DEBUG HEADER
490 */
491
492 /*
493 * The header table is composed of five word header records. For
494 * each compilation unit, the compiler must generate a header
495 * record, indicating the length (in bytes) of the five tables
496 * (GNTT, LNTT, SLT, VT and XT) produced for that compilation unit.
497 */
498
499 struct XDB_header {
500 long gntt_length;
501 long lntt_length;
502 long slt_length;
503 long vt_length;
504 long xt_length;
505 };
506
507 #define extension_header 0x80000000
508
509 /*
510 * The purpose of the header record is as follows: the five tables
511 * are each contained in a separate subspace on PA-RISC or in a
512 * separate section of the a.out file on the series 300. Therefore
513 * at link time, the tables from different compilation units will
514 * be con- catenated separately, GNTTs to GNTTS, SLTs to SLTs, etc.
515 * However, the preprocessor requires the number of compilation
516 * units, and the size of each of the five tables produced by each
517 * compilation unit. The header records supply this size
518 * information, and the number of header records equals the number
519 * of compilation units.
520 *
521 * For PA-RISC, the header_extension flag (MSB) is set in the
522 * gntt_length word in each header-record by the HP-UX 3.1+ s800 C
523 * compiler to indicate the header contains an xt_length and is 5
524 * words long. This bit is used to distinguish SOM's that were
525 * created with the pre-SA compiler (HP-UX 3.0, /bin/cc vers.
526 * A.00.15 or earlier) from SOM's that contain an $XT$ subspace.
527 *
528 * For PA-RISC, pxdb and xdb version A.02.xx can be used on
529 * >>all<< SOM's (4 or 5 word XDB headers) that have not already
530 * been pxdb'd. Earlier versions of either are completely
531 * incompatible with SOM's containing an $XT$ (HP-UXS 3.1 or later)
532 * because of the header-length.
533 *
534 * For the series 300, the header_extension flag is not used (i.e.
535 * the gntt_length occupies a full 32 bits).
536 */
537
538 /*
539 * ---- 5. DEBUG SYMBOL TABLE (DNTT) ENTRY FORMAT
540 */
541
542 /*
543 * The DNTT consists of a series of three-word blocks. Each block
544 * starts with an "extension bit". Each structure in the union
545 * "dnttentry" begins in an "initial block" with a bit which is
546 * always zero. If a structure is more than three words (one
547 * block) long, it occupies one or more additional "extension
548 * blocks", each of which starts with a bit set to one to
549 * distinguish it from an initial block.
550 *
551 * Note well that every DNTTPOINTER has a high bit of one and that
552 * every DNTT structure bigger than one block is carefully arranged
553 * so that a DNTTPOINTER resides in the fourth and seventh words.
554 * (The extension bit is in the DNTTPOINTER to avoid wasting space
555 * due to structure packing rules.)
556 */
557
558 #define DNTTBLOCKSIZE 12
559
560 /* The second field in each structure is "kind", which acts like a
561 * Pascal variant tag to denote the type of the structure. The
562 * "unused" fields are just included for clarity. The whole union
563 * "dnttentry" is declared after the definition of KINDTYPE and all
564 * the various structures (below).
565 */
566
567 typedef int KINDTYPE;
568
569 #define K_NIL (-1) /* guaranteed illegal value */
570
571 #define K_SRCFILE 0
572
573 #define K_MODULE 1
574 #define K_FUNCTION 2
575 #define K_ENTRY 3
576 #define K_BEGIN 4
577 #define K_END 5
578 #define K_IMPORT 6
579 #define K_LABEL 7
580 #define K_WITH 27
581 #define K_COMMON 28
582
583 #define K_FPARAM 8
584 #define K_SVAR 9
585 #define K_DVAR 10
586 #define K_CONST 12
587
588 #define K_TYPEDEF 13
589 #define K_TAGDEF 14
590 #define K_POINTER 15
591 #define K_ENUM 16
592 #define K_MEMENUM 17
593 #define K_SET 18
594 #define K_SUBRANGE 19
595 #define K_ARRAY 20
596 #define K_STRUCT 21
597 #define K_UNION 22
598 #define K_FIELD 23
599 #define K_VARIANT 24
600 #define K_FILE 25
601 #define K_FUNCTYPE 26
602 #define K_COBSTRUCT 29
603
604 #define K_XREF 30
605 #define K_SA 31
606 #define K_MACRO 32
607 #define K_BLOCKDATA 33
608
609 #define K_MODIFIER 45 /* used for C too so we can qualify type */
610
611 #ifdef CPLUSPLUS
612 #define K_CLASS_SCOPE 34
613 #define K_REFERENCE 35
614 #define K_PTRMEM 36
615 #define K_PTRMEMFUNC 37
616 #define K_CLASS 38
617 #define K_GENFIELD 39
618 #define K_VFUNC 40
619 #define K_MEMACCESS 41
620 #define K_INHERITANCE 42
621 #define K_FRIEND_CLASS 43
622 #define K_FRIEND_FUNC 44
623 #define K_OBJECT_ID 46
624 #define K_MEMFUNC 47
625 #ifdef TEMPLATES
626 #define K_TEMPLATE 48
627 #define K_TEMPL_ARG 49
628 #define K_FUNC_TEMPLATE 50
629 #define K_LINK 51
630 #endif /* TEMPLATES */
631 #endif
632
633 #ifdef CPLUSPLUS
634 #ifdef TEMPLATES
635 #define K_MAX K_LINK
636 #else /* TEMPLATES */
637 #define K_MAX K_MEMFUNC
638 #endif /* TEMPLATES */
639 #else
640 #define K_MAX K_BLOCKDATA
641 #endif
642
643 /*
644 * ---- 5.1. FILE-CLASS ("FILE") DNTT ENTRIES
645 */
646
647
648 struct DNTT_SRCFILE {
649 /*0*/ BITS extension: 1; /* always zero */
650 KINDTYPE kind: 10; /* always K_SRCFILE */
651 LANGTYPE language: 4; /* type of language */
652 BITS unused: 17;
653 /*1*/ VTPOINTER name; /* name of source/listing file */
654 /*2*/ SLTPOINTER address; /* code and text locations */
655 }; /* three words */
656
657 /*
658 * One SRCFILE is emitted for the start of each source file, the
659 * start of each included file, and the return from each included
660 * file. Additional SRCFILE entries must also be output before each
661 * DNTT_FUNC entry. This guarantees the debuggers know which file a
662 * function came from. Specifically, the rules are as follows:
663 *
664 * Definitions:
665 * Source block: contiguous block of one or more lines of text in a
666 * source-file, bounded by beginning or end-of-file or include
667 * directives (conceptually identical to the "basic block" in
668 * optimizer jargon). No distinction is made between blocks
669 * that contain compilable code and those that don't.
670 *
671 * Code segment: contiguous LINEAR block of DNTT (and associated
672 * SLT) entries that are generated from the same "source block".
673 * "SLT_SRC" is used here to actually refer to an SLT_SPEC entry
674 * of type SLT_SRCFILE. Same goes for SLT_FUNC.
675 *
676 * 1. One DNTT_SRCFILE and SLT_SRC must be emitted at the head of each
677 * code segment to facilitate reading backwards through the DNTT or
678 * SLT tables from any point in the segment to determine the
679 * enclosing source file. If the source-file changes within the
680 * body of a function/subprogram, a DNTT_SRCFILE/SLT_SRC pair must
681 * be emitted prior to any additional DNTT or SLT entries generated
682 * by the remainder of that function/subprogram.
683 *
684 * 2. One DNTT_SRCFILE/SLT_SRC pair is always emitted *immediately*
685 * before any DNTT_FUNC/SLT_FUNC. Exception: a DNTT_SA and
686 * associated DNTT_XREF may appear between a DNTT_FUNC and it's
687 * preceding DNTT_SRCFILE. There can be nothing between the
688 * SLT_SRC and the SLT_FUNC. The DNTT_SRCFILE (preceding the
689 * DNTT_FUNC) must name the file containing the functions
690 * declaration. The SLT_FUNC must contain the line number of the
691 * line in the function's declaration where the function's name
692 * appears. This line number must match the line number that
693 * appears in the XT record denoting the function's declaration.
694 * The SLT_END associated with the SLT_FUNC must contain the line
695 * number of the source line containing the scope-closing token
696 * (i.e. "}" or "end").
697 *
698 * 3. One DNTT_SRCFILE/SLT_SRC pair must be emitted for a source file
699 * that otherwise would not be mentioned in the DNTT i.e. source
700 * files that do not generate a code segment. This is required for
701 * Static analysis only.
702 *
703 *
704 * "address" points to a special SLT entry (for the line number
705 * only), but the code location is known from context in the SLT. *
706 *
707 * NOTE: Listing files and listing file line numbers may be used in
708 * place of source files and source file line numbers. A
709 * special compiler option will designate which is generated
710 * by the compiler.
711 *
712 * SRCFILE names are exactly as seen by the compiler, i.e. they
713 * may be relative, absolute, or whatever. C include file names
714 * must be given as absolute paths if found "in the usual place",
715 * i.e., /usr/include/...
716 */
717
718 /*
719 * ---- 5.2. CODE-CLASS ("SCOPING") DNTT ENTRIES
720 */
721
722
723 struct DNTT_MODULE {
724 /*0*/ BITS extension: 1; /* always zero */
725 KINDTYPE kind: 10; /* always K_MODULE */
726 BITS unused: 21;
727 /*1*/ VTPOINTER name; /* name of module */
728 /*2*/ VTPOINTER alias; /* alternate name, if any */
729 /*3*/ DNTTPOINTER dummy; /* 4th word must be DNTTPOINTER */
730 /*4*/ SLTPOINTER address; /* code and text locations */
731 }; /* five words */
732
733 /*
734 * One MODULE is emitted for the start of each Pascal/Modcal module
735 * or C source file (C sources are considered a nameless module).
736 * "address" points to a special SLT entry, but the code location
737 * is known from context in the SLT.
738 *
739 * In the case of languages that do not support modules (such as
740 * FORTRAN) a DNTT_MODULE and DNTT_END pair are not used. Every
741 * MODULE must have a matching END (see below). If a Pascal/Modcal
742 * module has a module body (some code), the latter must be represented
743 * by a FUNCTION-END pair as well (see below).
744 *
745 * For items within a module, the public bit is true if that item
746 * is exported by the module. If the public bit of an item is set,
747 * that item is visible within any module or procedure that imports
748 * the module containing the item. If the public bit of an item
749 * is not set, then the item is only visible within the module.
750 *
751 * The "dummy" field exists only because the first word of each
752 * extension block must be a DNTTPOINTER; it is important only
753 * that the extension bit of the DNTTPOINTER be set.
754 *
755 * The MODULE DNTT should be used only in the LNTT.
756 */
757
758 #ifdef TEMPLATES
759
760 struct DNTT_LINK
761 {
762 /*0*/ BITS extension: 1; /* always zero */
763 KINDTYPE kind: 10; /* always K_LINK */
764 BITS linkKind: 4; /* always LINK_UNKNOWN */
765 BITS unused: 17;
766 /*1*/ long future1; /* expansion */
767 /*2*/ DNTTPOINTER ptr1; /* link from template */
768 /*3*/ DNTTPOINTER ptr2; /* to expansion */
769 /*4*/ long future[2];
770 };
771
772 #if 1
773 struct DNTT_TFUNC_LINK
774 {
775 /*0*/ BITS extension: 1; /* always zero */
776 KINDTYPE kind: 10; /* always K_LINK */
777 BITS linkKind: 4; /* always LINK_FUNC_TEMPLATE */
778 BITS unused: 17;
779 /*1*/ long args; /* expansion */
780 /*2*/ DNTTPOINTER pTemplate; /* link from template */
781 /*3*/ DNTTPOINTER pExpansion; /* to expansion */
782 /*4*/ long future[2];
783 };
784 #endif /* 0 */
785 /* temporary until we get a new cfront */
786 #if 0
787 struct DNTT_TFUNC_LINK
788 {
789 /*0*/ BITS extension: 1; /* always zero */
790 KINDTYPE kind: 10; /* always K_LINK */
791 BITS linkKind: 4; /* always LINK_FUNC_TEMPLATE */
792 BITS unused: 17;
793 /*2*/ DNTTPOINTER pTemplate; /* link from template */
794 /*3*/ DNTTPOINTER pExpansion; /* to expansion */
795 /*1*/ long args; /* expansion */
796 /*4*/ long future[2];
797 };
798 #endif /* 0 */
799 /*
800 * Note the linkKind bit. The idea is that we might have other
801 * LINKs in the future that share the same format but where we would
802 * call the fields another name. It's hard to debug a program
803 * where fields are called link_word1 and link_word2.
804 */
805
806 #define LINK_UNKNOWN 0
807 #define LINK_FUNC_TEMPLATE 1
808
809 struct DNTT_FUNC_TEMPLATE {
810 /*0*/ BITS extension: 1; /* always zero */
811 KINDTYPE kind: 10; /* K_FUNC_TEMPLATE */
812 BITS public: 1; /* 1 => globally visible */
813 LANGTYPE language: 4; /* type of language */
814 BITS level: 5; /* nesting level (top level = 0)*/
815 BITS optimize: 2; /* level of optimization */
816 BITS varargs: 1; /* ellipses. Pascal/800 later */
817 BITS info: 4; /* lang-specific stuff; F_xxxx */
818 #ifdef CPLUSPLUS
819 BITS inlined: 1;
820 BITS localloc: 1; /* 0 at top, 1 at end of block */
821 BITS unused: 2;
822 #else
823 BITS unused: 4;
824 #endif
825 /*1*/ VTPOINTER name; /* name of function */
826 /*2*/ VTPOINTER alias; /* alternate name, if any */
827 /*3*/ DNTTPOINTER firstparam; /* first FPARAM, if any */
828 /*4*/ DNTTPOINTER retval; /* return type, if any */
829 /*5*/ DNTTPOINTER arglist; /* ptr to argument list */
830 }; /* nine words */
831
832 /*
833 * DNTT_FUNC_TEMPLATEs only appear in the GNTT. Functions and
834 * classes templates cannot be local. (Their instantions may be).
835 */
836 #endif /* TEMPLATES */
837
838 struct DNTT_FUNC {
839 /*0*/ BITS extension: 1; /* always zero */
840 KINDTYPE kind: 10; /* K_FUNCTION, K_ENTRY, */
841 /* K_BLOCKDATA, or K_MEMFUNC */
842 BITS public: 1; /* 1 => globally visible */
843 LANGTYPE language: 4; /* type of language */
844 BITS level: 5; /* nesting level (top level = 0)*/
845 BITS optimize: 2; /* level of optimization */
846 BITS varargs: 1; /* ellipses. Pascal/800 later */
847 BITS info: 4; /* lang-specific stuff; F_xxxx */
848 #ifdef CPLUSPLUS
849 BITS inlined: 1;
850 BITS localloc: 1; /* 0 at top, 1 at end of block */
851 #ifdef TEMPLATES
852 BITS expansion: 1; /* 1 = function expansion */
853 BITS unused: 1;
854 #else /* TEMPLATES */
855 BITS unused: 2;
856 #endif /* TEMPLATES */
857 #else
858 BITS unused: 4;
859 #endif
860 /*1*/ VTPOINTER name; /* name of function */
861 /*2*/ VTPOINTER alias; /* alternate name, if any */
862 /*3*/ DNTTPOINTER firstparam; /* first FPARAM, if any */
863 /*4*/ SLTPOINTER address; /* code and text locations */
864 /*5*/ ADDRESS entryaddr; /* address of entry point */
865 /*6*/ DNTTPOINTER retval; /* return type, if any */
866 /*7*/ ADDRESS lowaddr; /* lowest address of function */
867 /*8*/ ADDRESS hiaddr; /* highest address of function */
868 }; /* nine words */
869
870 /*
871 * Additional function semantics: Values for DNTT_FUNC.info
872 */
873
874 /* In command-line C proc-call... */
875 #define F_ARGMODE_COMPAT_C 0 /* all real params passed as double */
876 #define F_ARGMODE_ANSI_C 1 /* floats-is-floats but PASS as dbl */
877 #define F_ARGMODE_ANSI_C_PROTO 2 /* all real params passed as declared */
878
879 /* special DNTT_FUNC semantics */
880 #define F_ARGMODE_BLKDATA 3 /* Fortran "block data" construct */
881 /* NOT A FUNCTION! */
882 /* F_ARGMODE_BLKDATA is retained for backward compatability only */
883
884 #ifdef CPLUSPLUS
885 #define CPP_OVERLOADED 0x1 /* overloaded function */
886 #define CPP_MEMBERFUNC 0x2 /* member function */
887 #define CPP_INLINE 0x4 /* inline function */
888 #define CPP_OPERATOR 0x8 /* operator function */
889 #endif
890
891 /*
892 * Struct DNTT_FUNC is used for dfunc and dentry, and dblockdata types.
893 * One FUNCTION or ENTRY is emitted for each formal function
894 * declaration (with a body) or secondary entry point,
895 * respectively. They are not emitted for bodyless declarations
896 * (FORWARD, EXTERNAL, "int x ();" etc.). A dblockdata is emitted for
897 * Fortran BLOCK DATA constructs only.
898 *
899 * "address" always points to a special SLT entry.
900 *
901 * For FUNCTION types, the "entryaddr" field is the code address of
902 * the primary entry point of the function. The "lowaddr" field is
903 * the lowest code address of the function. The "hiaddr" field
904 * is the highest code address of the function. This both gives
905 * the size of the function and helps in mapping code locations
906 * to functions when there are anonymous (non-debuggable) functions
907 * present. These three fields should be filled in by the generation
908 * of fixups.
909 *
910 * For ENTRY types, the "entryaddr" field points to the proper code
911 * location for calling the function at the secondary entrypoint,
912 * and the "lowaddr" and "hiaddr" fields are nil (zero). For a
913 * FORTRAN subroutine with alternate entries, DNTT_DVARs are required
914 * to represent the parameters, see the DNTT_FPARAM definition for
915 * the details.
916 *
917 * For BLOCKDATA types, the "public" bit should be set to 1, the
918 * "level", "optimize", "varargs" and "info" fields should all be 0.
919 * The "firstparam" field should be DNTTNIL. The "entryaddr" and
920 * "lowaddr" fields should be 0, and the "highaddr" field should be
921 * FFFFFFFC (-4). The "retval" field should be set to T_UNDEFINED,
922 * with length 0. An SLT_FUNCTION/SNT_END pair should be emitted
923 * for each DNTT_FUNC (BLOCKDATA).
924 *
925 * Every FUNCTION or BLOCKDATA must have a matching END (see below).
926 *
927 * For languages in which a functions return value is set by assigning
928 * the value to the function name (such as FORTRAN & Pascal), a DVAR
929 * entry should also be emitted for the function. The address of this
930 * DVAR for the function should be the address of the answer spot for
931 * the function. This will allow the user to display the current
932 * return value while the function is executing.
933 *
934 * The "varargs" field indicates whether the function was declared as
935 * having a variable-length parameter list. This is currently possible
936 * only via ANSI/C function-prototype "ellipses" (...). The "info" field
937 * provides additional language-specific characteristics of the function
938 * and/or its parameter-list.
939 *
940 * The localloc (local variables location) is currently only used
941 * in the following context: If the function
942 * language is LANG_CPLUSPLUS, then 0 means that locals are
943 * at the beginning of the block, and 1 means that locals appears
944 * at the end of a block. For all other languages
945 * this bit is not used.
946 *
947 * The FUNCTION DNTT should be used only in the LNTT.
948 */
949
950
951 struct DNTT_BEGIN {
952 /*0*/ BITS extension: 1; /* always zero */
953 KINDTYPE kind: 10; /* always K_BEGIN */
954 #ifdef CPLUSPLUS
955 BITS classflag: 1; /* beginning of class def'n */
956 BITS unused: 20;
957 #else
958 BITS unused: 21;
959 #endif
960 /*1*/ SLTPOINTER address; /* code and text locations */
961 }; /* two words */
962
963 /*
964 * BEGINs are emitted as required to open a new (nested) scope for
965 * any type of variable or label, at any level within MODULE-END
966 * and FUNCTION-END pairs. Every BEGIN must have a matching END
967 * (see below). "address" points to a special SLT entry, but the
968 * code location is known from context in the SLT. Because a DNTT
969 * BEGIN-END is used to indicate a new scope, the Pascal BEGIN-
970 * END pair does not produce a DNTT BEGIN-END, while the C { }
971 * construct does.
972 *
973 * The BEGIN DNTT should be used only in the LNTT.
974 */
975
976
977 struct DNTT_COMMON {
978 /*0*/ BITS extension: 1; /* always zero */
979 KINDTYPE kind: 10; /* always K_COMMON */
980 BITS unused: 21;
981 /*1*/ VTPOINTER name; /* name of common block */
982 /*2*/ VTPOINTER alias; /* alternate name, if any */
983 }; /* three words */
984
985 /*
986 * COMMONs are used to indicate that a group of variables are members
987 * of a given FORTRAN common block. For each common block, a DNTT_
988 * COMMON is emitted, followed by a DNTT_SVAR for each member of the
989 * common block, and finally a DNTT_END. If type information is
990 * required for a member of the common block (such as an array), it
991 * may also be within the DNTT_COMMON, DNTT_END pair.
992 *
993 * The COMMON DNTT should be used only in the LNTT.
994 */
995
996
997 struct DNTT_WITH {
998 /*0*/ BITS extension: 1; /* always zero */
999 KINDTYPE kind: 10; /* always K_WITH */
1000 BITS addrtype: 2; /* 0 => STATTYPE */
1001 /* 1 => DYNTYPE */
1002 /* 2 => REGTYPE */
1003 BITS indirect: 1; /* 1 => pointer to object */
1004 BITS longaddr: 1; /* 1 => in long pointer space */
1005 BITS nestlevel: 6; /* # of nesting levels back */
1006 BITS unused: 11;
1007 /*1*/ long location; /* where stored (allocated) */
1008 /*2*/ SLTPOINTER address;
1009 /*3*/ DNTTPOINTER type; /* type of with expression */
1010 /*4*/ VTPOINTER name; /* name of with expression */
1011 /*5*/ unsigned long offset; /* byte offset from location */
1012 }; /* six words */
1013
1014 /*
1015 * WITHs are emitted to open a with scope. Like a BEGIN, a
1016 * WITH requires a matching END to close the scope. A single WITH
1017 * statement possessing more than one record expression, should
1018 * be handled as multiple nested withs with only one expression
1019 * each. The "addrtype" field indicates the addressing mode used
1020 * for the record expression, and along with the "indirect" field,
1021 * tells how to interpret the "location" and "offset" fields. Thus,
1022 * depending upon the value of "addrtype", "location" may contain
1023 * a short pointer, an offset from the local frame pointer, or a
1024 * register number. If "nestlevel" is non-zero and "addrtype" is
1025 * DYNTYPE, the address for the record expression is computed by
1026 * tracing back "nestlevel" static links and using "location" as
1027 * an offset from the frame pointer at that level. (This situation
1028 * occurs only on the FOCUS architecture.) The use of the
1029 * "offset" field is the same as for the DNTT_SVAR entry (see below).
1030 * The "type" field is the type of the record expression. The "name"
1031 * field is the symbolic representation of the record expression
1032 * (ex. "p[i]^"). "address" points to a special SLT, but the code
1033 * location is known from context in the SLT.
1034 *
1035 * The WITH DNTT should be used only in the LNTT.
1036 */
1037
1038 struct DNTT_END {
1039 /*0*/ BITS extension: 1; /* always zero */
1040 KINDTYPE kind: 10; /* always K_END */
1041 KINDTYPE endkind: 10; /* DNTT kind closing scope for */
1042 #ifdef CPLUSPLUS
1043 BITS classflag: 1; /* end of class def'n */
1044 BITS unused: 10;
1045 #else
1046 BITS unused: 11;
1047 #endif
1048 /*1*/ SLTPOINTER address; /* code and text locations */
1049 /*2*/ DNTTPOINTER beginscope; /* start of scope */
1050 }; /* three words */
1051
1052 /*
1053 * ENDs are emitted as required to close a scope started by a
1054 * MODULE, FUNCTION, WITH, COMMON, or BEGIN (but not an ENTRY).
1055 * Each points back to the DNTT entry that opened the scope.
1056 * "endkind" indicates which kind of DNTT entry is associated with
1057 * the END and is filled in by the preprocessor. "address" points
1058 * to a special SLT entry, but the code location is known from context
1059 * in the SLT.
1060 *
1061 * The END DNTT should be used only in the LNTT.
1062 */
1063
1064
1065 struct DNTT_IMPORT {
1066 /*0*/ BITS extension: 1; /* always zero */
1067 KINDTYPE kind: 10; /* always K_IMPORT */
1068 BITS explicit: 1; /* module directly imported */
1069 BITS unused: 20;
1070 /*1*/ VTPOINTER module; /* module imported from */
1071 /*2*/ VTPOINTER item; /* name of item imported */
1072 }; /* three words */
1073
1074 /*
1075 * Within a module, there is one IMPORT entry for each imported
1076 * module, function, or variable. The item field is nil when an
1077 * entire module is imported. Used only by Pascal/Modcal. Note
1078 * that exported functions and variables have their public bits set.
1079 *
1080 * The "explicit" flag indicates the module was directly imported.
1081 * When not set, the module was imported by an imported module.
1082 *
1083 * The IMPORT DNTT should be used only in the LNTT.
1084 */
1085
1086
1087 struct DNTT_LABEL {
1088 /*0*/ BITS extension: 1; /* always zero */
1089 KINDTYPE kind: 10; /* always K_LABEL */
1090 BITS unused: 21;
1091 /*1*/ VTPOINTER name; /* name of label */
1092 /*2*/ SLTPOINTER address; /* code and text locations */
1093 }; /* three words */
1094
1095 /*
1096 * One LABEL is emitted for each source program statement label,
1097 * referencing the matching physical line (SLT entry). An SLT
1098 * pointer is used, instead of just a linenumber, so a code
1099 * location is known for setting a breakpoint. This is the only
1100 * case of SLTPOINTER that points to a normal (not special) SLT
1101 * entry.
1102 *
1103 * If a label appears at the very end of a function (after all
1104 * executable code), a normal SLT entry must be emitted for it
1105 * anyway. In this case the SLT entry points to an exit (return)
1106 * instruction.
1107 *
1108 * Numeric labels are named as the equivalent character string with
1109 * no leading zeroes, except in those languages where the leading
1110 * zeroes are significant (i.e. COBOL).
1111 *
1112 * The LABEL DNTT should be used only in the LNTT.
1113 */
1114
1115
1116 /*
1117 * ---- 5.3. STORAGE-CLASS ("NAME") DNTT ENTRIES
1118 */
1119
1120 struct DNTT_FPARAM {
1121 /*0*/ BITS extension: 1; /* always zero */
1122 KINDTYPE kind: 10; /* always K_FPARAM */
1123 BITS regparam: 1; /* 1 => REGTYPE, not DYNTYPE */
1124 BITS indirect: 1; /* 1 => pass by reference */
1125 BITS longaddr: 1; /* 1 => in long pointer space */
1126 BITS copyparam: 1; /* 1 => Copied to a local */
1127 /* only for fortran strings */
1128 #ifdef CPLUSPLUS
1129 BITS dflt: 1; /* default parameter value? */
1130 BITS unused: 16;
1131 #else
1132 BITS unused: 17;
1133 #endif
1134 /*1*/ VTPOINTER name; /* name of parameter */
1135 /*2*/ DYNTYPE location; /* where stored */
1136 /*3*/ DNTTPOINTER type; /* type information */
1137 /*4*/ DNTTPOINTER nextparam; /* next FPARAM, if any */
1138 /*5*/ int misc; /* assorted uses */
1139 }; /* six words */
1140
1141 /*
1142 * FPARAMs are chained together in parameter list order (left to
1143 * right) from every FUNCTION, ENTRY, or FUNCTYPE (see below), one
1144 * for each parameter, whether or not the type is explicitly
1145 * declared. For unnamed parameters, the FPARAM name is "*".
1146 *
1147 * "regparam" implies that the storage location given is to be
1148 * interpreted as a REGTYPE, not a DYNTYPE, that is, the parameter
1149 * was passed in a register.
1150 *
1151 * "indirect" implies that the storage location given contains a
1152 * data pointer to the parameter described, not the parameter
1153 * itself, due to a call by reference (Pascal VAR, for instance).
1154 * In the case where a call-by-value parameter is too big to be
1155 * passed in the parameter list (e.g., a copied-value parameter in
1156 * Pascal), the "location" must be given as the actual (post-copy)
1157 * location of the parameter.
1158 *
1159 * "longaddr" is meaningful only for varparams, and indicates that
1160 * the storage location given contains a 64 bit PA-RISC long
1161 * pointer. The long pointer could be in 2 consecutive words, or
1162 * in the case of a regparam, two consecutive registers.
1163 *
1164 * "copyparam" implies that the parameter has been copied to a local,
1165 * and thus the location is relative to the sp of the current procedure,
1166 * not the sp of the previous procdeure.
1167 *
1168 * "misc" is for assorted values. Current uses are:
1169 * (1) if the parameter is of type T_FTN_STRING_S300
1170 * then the "misc" field contains the SP relative
1171 * offset of the word containing the length of
1172 * the string
1173 *
1174 * In the case of a FORTRAN routine with alternate entries, DNTT
1175 * DVARs also must be emited for each parameter. The reason is
1176 * that with FORTRAN alternate entries, the same parameter can
1177 * be in two different entry's parameter lists, in a different
1178 * location (ex. the parameter "x" in "subroutine a(x,y,z)" and
1179 * "entry b(v,w,x)") and yet they both represent the same parameter.
1180 * Thus in order to insure a consistant address for such parameters,
1181 * the compiler allocates a local temporary, and the prologue code
1182 * for each entry copies the parameters into the local temps. So, to
1183 * insure that the debugger can find the parameters, a DNTT DVAR
1184 * must be generated for each temporary, with the name of the DVAR
1185 * being the name of the FPARAM for which the temp. was allocated.
1186 *
1187 * The FPARAM DNTT should be used only in the LNTT.
1188 */
1189
1190
1191 struct DNTT_SVAR {
1192 /*0*/ BITS extension: 1; /* always zero */
1193 KINDTYPE kind: 10; /* always K_SVAR */
1194 BITS public: 1; /* 1 => globally visible */
1195 BITS indirect: 1; /* 1 => pointer to object */
1196 BITS longaddr: 1; /* 1 => in long pointer space */
1197 #ifdef CPLUSPLUS
1198 BITS staticmem: 1; /* 1 => member of a class */
1199 BITS a_union: 1; /* 1 => anonymous union member */
1200 BITS unused: 16;
1201 #else
1202 BITS unused: 18;
1203 #endif
1204 /*1*/ VTPOINTER name; /* name of object (variable) */
1205 /*2*/ STATTYPE location; /* where stored (allocated) */
1206 /*3*/ DNTTPOINTER type; /* type information */
1207 /*4*/ unsigned long offset; /* post indirection byte offset */
1208 /*5*/ unsigned long displacement; /* pre indirection byte offset */
1209 }; /* six words */
1210
1211 struct DNTT_DVAR {
1212 /*0*/ BITS extension: 1; /* always zero */
1213 KINDTYPE kind: 10; /* always K_DVAR */
1214 BITS public: 1; /* 1 => globally visible */
1215 BITS indirect: 1; /* 1 => pointer to object */
1216 BITS regvar: 1; /* 1 => REGTYPE, not DYNTYPE */
1217 #ifdef CPLUSPLUS
1218 BITS a_union: 1; /* 1 => anonymous union member */
1219 BITS unused: 17;
1220 #else
1221 BITS unused: 18;
1222 #endif
1223 /*1*/ VTPOINTER name; /* name of object (variable) */
1224 /*2*/ DYNTYPE location; /* where stored (allocated) */
1225 /*3*/ DNTTPOINTER type; /* type information */
1226 /*4*/ unsigned long offset; /* post indirection byte offset */
1227 /* for use in cobol structures */
1228 }; /* five words */
1229
1230 /*
1231 * SVARs describe static variables (with respect to storage, not
1232 * visibility) and DVARs describe dynamic variables, and also
1233 * describe register variables. Note that SVARs have an extra
1234 * word, "offset", not needed for the other types. This provides
1235 * for direct data which is indexed from a base, and indirect data
1236 * which is accessed through a pointer, then indexed.
1237
1238 * The "location" field of an SVAR will require a fixup. An
1239 * example of when the offset field can be useful, is a FORTRAN
1240 * common block. In a common block declaration such as "common
1241 * /marx/ groucho, harpo, chico", the symbol "marx" is the only
1242 * global symbol. If "marx" is accessed indirectly, then the
1243 * address of "harpo" would contain the address of "marx" in the
1244 * location field (with the indirect bit on), and the offset of
1245 * "harpo" from "marx" in the offset field. If "marx" is not
1246 * indirect, then location field can be filled in by a fixup of the
1247 * form address(marx) + offset of harpo, and the offset field is
1248 * not needed.
1249 *
1250 * The compilers must emit SVARs even for data objects the linker
1251 * does not know about by name, such as variables in common blocks.
1252 *
1253 * As in the FPARAM entry, the longaddr field indicates the use
1254 * of a PA-RISC long pointer, and is valid only if the indirect
1255 * flag is true. The "regvar" field also has the same meaning as in
1256 * the FPARAM case.
1257 *
1258 * For languages in which a functions return value is set by assigning
1259 * the value to the function name (such as FORTRAN & Pascal), a DVAR
1260 * entry should also be emitted for the function. The address of this
1261 * DVAR for the function should be the address of the answer spot for
1262 * the function. This will allow the user to display the current
1263 * return value while the function is executing.
1264 *
1265 * For a FORTRAN subroutine with alternate entries, DNTT_DVARs are
1266 * required to represent the parameters, see the DNTT_FPARAM
1267 * definition for the details.
1268 *
1269 * The SVAR can be used in both the GNTT and LNTT, while the DVAR
1270 * is only applicable to the LNTT.
1271 */
1272
1273
1274 struct DNTT_CONST {
1275 /*0*/ BITS extension: 1; /* always zero */
1276 KINDTYPE kind: 10; /* always K_CONST */
1277 BITS public: 1; /* 1 => globally visible */
1278 BITS indirect: 1; /* 1 => pointer to object */
1279 LOCDESCTYPE locdesc: 3; /* meaning of location field */
1280 #ifdef CPLUSPLUS
1281 BITS classmem: 1; /* 1 => member of a class */
1282 BITS unused: 15;
1283 #else
1284 BITS unused: 16;
1285 #endif
1286 /*1*/ VTPOINTER name; /* name of object */
1287 /*2*/ STATTYPE location; /* where stored */
1288 /*3*/ DNTTPOINTER type; /* type information */
1289 /*4*/ unsigned long offset; /* post indirection byte offset */
1290 /*5*/ unsigned long displacement; /* pre indirection byte offset */
1291 }; /* six words */
1292
1293 /*
1294 * The value of locdesc determines the meaning of location.
1295 * Compilers are free to use any of the three types (LOC_IMMED,
1296 * LOC_PTR, LOC_VT) as feasible and appropriate. They might, for
1297 * example, merely dump all CONST values into the VT, with some
1298 * redundancy, if they could do no better. Ideally, each compiler
1299 * would use all three types according to whether the constant is
1300 * stored in an immediate instruction (so a copy is needed here),
1301 * in code or data space, or nowhere else, respectively.
1302 *
1303 * If locdesc == LOC_PTR, CONST is very much like an SVAR, and the
1304 * indirect and offset values are relevant.
1305 *
1306 * The CONST DNTT can be used in both the GNTT and LNTT.
1307 */
1308
1309
1310 /*
1311 * ---- 5.4. TYPE-CLASS ("TYPE") DNTT ENTRIES
1312 */
1313
1314
1315 struct DNTT_TYPE {
1316 /*0*/ BITS extension: 1; /* always zero */
1317 KINDTYPE kind: 10; /* either K_TYPEDEF or K_TAGDEF */
1318 BITS public: 1; /* 1 => globally visible */
1319 BITS typeinfo: 1; /* 1 => type info available */
1320 BITS unused: 19;
1321 /*1*/ VTPOINTER name; /* name of type or tag */
1322 /*2*/ DNTTPOINTER type; /* type information */
1323 }; /* three words */
1324
1325 /*
1326 * The DNTT_TYPE type is used for dtype and dtag entries. TYPEDEFs
1327 * are just a way of remembering names associated with types
1328 * declared in Pascal, via "type" sections, or in C, via "typedef"s.
1329 * TAGDEFs are used for C "struct", "union", and "enum" tags, which
1330 * may be named identically to "typedef"s in the same scope.
1331 * TAGDEFs always point at STRUCTs, UNIONs, or ENUMs (see below),
1332 * and provide a way to "hang" a name onto a subtree.
1333 *
1334 * Note that named types point directly to the underlying
1335 * structures, not to intervening TYPEDEFs or TAGDEFs. Type
1336 * information in TYPEDEFs and TAGDEFs point to the same structures
1337 * independent of named instantiations of the types.
1338 *
1339 * For example:
1340 * +
1341 * typedef struct S { + typedef enum E { ... } EEE;
1342 * ... +
1343 * } *pS; +
1344 *
1345 * would generate something like this (shown graphically)
1346 *
1347 * TYPEDEF "pS" + TYPEDEF "EEE"
1348 * | + |
1349 * POINTER + TAG "E"
1350 * | + |
1351 * TAG "S" + ENUM
1352 * | + |
1353 * STRUCT + :
1354 * | + :
1355 * : +
1356 * : +
1357 *
1358 * Note also that variables (of a named non-base type) must point to
1359 * TYPEDEF or TAGDEF dntt, and not the underlying structures. If
1360 * this is not done, the removal of duplicate global information is
1361 * impossible.
1362 *
1363 * The "typeinfo" flag only applies to TAGDEFs. When not set, it is
1364 * used to indicate that an underlying struct, union, or enum is
1365 * named, but the actual type is not declared. In general,
1366 * "typeinfo" will be set to 1. It will be set to a 0 if the type
1367 * subtree is not available. Consider the C file:
1368 *
1369 * typedef struct s *Sptr;
1370 * main(){}
1371 *
1372 * which is a valid compilation unit with "struct s" defined in
1373 * another file. For this case, the "typeinfo" for TAGDEF "s" will
1374 * be set to 0, and "type" points to a "nil" DNTT_STRUCT (i.e. a
1375 * DNTT_STRUCT entry with its "firstfield", "vartagfield", and
1376 * "varlist" fields set to DNTTNIL and its "declaration" and
1377 * "bitlength" fields set to 0). Graphically:
1378 *
1379 * TYPEDEF "Sptr"
1380 * |
1381 * POINTER
1382 * |
1383 * TAG "s"
1384 * |
1385 * STRUCT
1386 * \---<firstfield>---> DNTTNIL
1387 * \--<vartagfield>--> DNTTNIL
1388 * \-<varlist>------> DNTTNIL
1389 * \- other fields > all set to 0
1390 *
1391 *
1392 * Thus, whenever "typeinfo" is 0, "type" must point to an
1393 * appropriate DNTT entry which has all its fields correctly NIL'ed.
1394 * This applies to *named* DNTT_STRUCT's, DNTT_UNION's, and
1395 * DNTT_ENUM's.
1396 *
1397 * The TYPEDEF and TAGDEF DNTTs may be used in both the GNTT and
1398 * LNTT.
1399 *
1400 */
1401
1402
1403 struct DNTT_POINTER {
1404 /*0*/ BITS extension: 1; /* always zero */
1405 #ifdef CPLUSPLUS
1406 KINDTYPE kind: 10; /* K_POINTER or K_REFERENCE */
1407 #else
1408 KINDTYPE kind: 10; /* always K_POINTER */
1409 #endif
1410 BITS unused: 21;
1411 /*1*/ DNTTPOINTER pointsto; /* type of object */
1412 /*2*/ unsigned long bitlength; /* size of pointer, not object */
1413 }; /* three words */
1414
1415
1416 struct DNTT_ENUM {
1417 /*0*/ BITS extension: 1; /* always zero */
1418 KINDTYPE kind: 10; /* always K_ENUM */
1419 BITS unused: 21;
1420 /*1*/ DNTTPOINTER firstmem; /* first MEMENUM (member) */
1421 /*2*/ unsigned long bitlength; /* packed size */
1422 }; /* three words */
1423
1424 struct DNTT_MEMENUM {
1425 /*0*/ BITS extension: 1; /* always zero */
1426 KINDTYPE kind: 10; /* always K_MEMENUM */
1427 #ifdef CPLUSPLUS
1428 BITS classmem: 1; /* 1 => member of a class */
1429 BITS unused: 20;
1430 #else
1431 BITS unused: 21;
1432 #endif
1433 /*1*/ VTPOINTER name; /* name of member */
1434 /*2*/ unsigned long value; /* equivalent number */
1435 /*3*/ DNTTPOINTER nextmem; /* next MEMENUM, else ENUM type */
1436 }; /* four words */
1437
1438 /*
1439 * Each ENUM begins a chain of (name, value) pairs. The nextmem
1440 * field of the last memenum, should be DNTT NIL. The POINTER,
1441 * ENUM, and MEMENUM DNTTs can all be used in both the GNTT and
1442 * LNTT.
1443 */
1444
1445
1446 struct DNTT_SET {
1447 /*0*/ BITS extension: 1; /* always zero */
1448 KINDTYPE kind: 10; /* always K_SET */
1449 BITS declaration: 2; /* normal, packed, or crunched */
1450 BITS unused: 19;
1451 /*1*/ DNTTPOINTER subtype; /* type implies bounds of set */
1452 /*2*/ unsigned long bitlength; /* packed size */
1453 }; /* three words */
1454
1455
1456 struct DNTT_SUBRANGE {
1457 /*0*/ BITS extension: 1; /* always zero */
1458 KINDTYPE kind: 10; /* always K_SUBRANGE */
1459 BITS dyn_low: 2; /* >0 => nonconstant low bound */
1460 BITS dyn_high: 2; /* >0 => nonconstant high bound */
1461 BITS unused: 17;
1462 /*1*/ long lowbound; /* meaning depends on subtype */
1463 /*2*/ long highbound; /* meaning depends on subtype */
1464 /*3*/ DNTTPOINTER subtype; /* immediate type or ENUM */
1465 /*4*/ unsigned long bitlength; /* packed size */
1466 }; /* five words */
1467
1468
1469 struct DNTT_ARRAY {
1470 /*0*/ BITS extension: 1; /* always zero */
1471 KINDTYPE kind: 10; /* always K_ARRAY */
1472 BITS declaration: 2; /* normal, packed, or crunched */
1473 BITS dyn_low: 2; /* >0 => nonconstant low bound */
1474 BITS dyn_high: 2; /* >0 => nonconstant high bound */
1475 BITS arrayisbytes: 1; /* 1 => array size is in bytes */
1476 BITS elemisbytes: 1; /* 1 => elem. size is in bytes */
1477 BITS elemorder: 1; /* 0 => in increasing order */
1478 BITS justified: 1; /* 0 => left justified */
1479 BITS unused: 11;
1480 /*1*/ unsigned long arraylength; /* size of whole array */
1481 /*2*/ DNTTPOINTER indextype; /* how to index the array */
1482 /*3*/ DNTTPOINTER elemtype; /* type of each array element */
1483 /*4*/ unsigned long elemlength; /* size of one element */
1484 }; /* five words */
1485
1486 /*
1487 * The dyn_low and dyn_high fields are non-zero only if the
1488 * DNTT_SUBRANGE is defining the range of an array index, otherwise
1489 * they are always zero. The dyn_low and dyn_high bits are
1490 * duplicated in the DNTT_SUBRANGE defining the range of the array
1491 * index (so sllic can fix the pointers). "dyn_low" indicates
1492 * whether the lower bound for the subscript of the array is
1493 * dynamic. If the dyn_low field is zero, then the lowbound field
1494 * of the DNTT_SUBRANGE entry, pointed to by the indextype field in
1495 * the DNTT_ARRAY entry, is interpreted as a constant lower bound.
1496 * If the dyn_low field is 1, then the lowbound field of the DNTT
1497 * SUBRANGE is interpreted as a DYNTYPE giving a local address where
1498 * the lower bound can be found. If the dyn_low field is 2, then
1499 * the lowbound field of the DNTT_SUBRANGE is interpreted as a
1500 * DNTTPOINTER to a variable whose value is the lower bound (needed
1501 * if the lower bound is a static variable). The dyn_low value of 3
1502 * is not used. The "dyn_high" bit has a similar meaning relating
1503 * to the upper bound. If an upper bound for an array parameter is
1504 * not given (like assumed size arrays in FORTRAN, or "char foo[]"
1505 * in C) then the upper bound in the DNTT_SUBRANGE should be the
1506 * largest integer that fits in a long integer, so that any value
1507 * the user can give is legal.
1508 *
1509 * "arrayisbytes" indicates that the field "arraylength" contains
1510 * the length in bytes rather then bits. This is needed on PA-RISC
1511 * where an array could be up to 2**32 bytes. A value of zero for
1512 * bitsize will be used to represent 2**32.
1513 *
1514 * "elemisbytes" indicates that the field "elemlength" contains the
1515 * elem. length in bytes rather then bits. The "elemlength" field
1516 * contains the not the "true" size of an array element, but the
1517 * size allocated to each element within the array (the "true" size
1518 * plus any wasted bits on the left or right). As an example for a
1519 * Pascal array of a 13 bit structure, the array element size might
1520 * equal 16, with the justified field equal to 0 to indicate the
1521 * structure is left justified within the 16 bits. The "true" size
1522 * of the structure would be found in the size field of the
1523 * DNTT_STRUCT pointed to by the "elemtype" field of the DNTT_ARRAY.
1524 *
1525 * "indextype" typically points to a SUBRANGE for bounds.
1526 * "elemtype" may point to another ARRAY for multi-dimensional
1527 * arrays. Row or column precedence in the language is reflected in
1528 * the order of the ARRAY entries on the chain. For example, in
1529 * Pascal, which is row-precedent, an array declared [1..2, 3..4,
1530 * 5..6] would result in "array 1..2 of array 3..4 of array 5..6 of
1531 * ...". The same declaration in FORTRAN, which is
1532 * column-precedent, would result in "array 5..6 of array 3..4 of
1533 * array 1..2 of ...". This makes index-to-address conversion much
1534 * easier. Either way an expression handler must know the
1535 * precedence for the language.
1536 *
1537 * The SET, SUBRANGE, and ARRAY DNTTs can be used in both the GNTT
1538 * and LNTT.
1539 */
1540
1541
1542 struct DNTT_STRUCT {
1543 /*0*/ BITS extension: 1; /* always zero */
1544 KINDTYPE kind: 10; /* always K_STRUCT */
1545 BITS declaration: 2; /* normal, packed, or crunched */
1546 BITS unused: 19;
1547 /*1*/ DNTTPOINTER firstfield; /* first FIELD, if any */
1548 /*2*/ DNTTPOINTER vartagfield; /* variant tag FIELD, or type */
1549 /*3*/ DNTTPOINTER varlist; /* first VARIANT, if any */
1550 /*4*/ unsigned long bitlength; /* total at this level */
1551 }; /* five words */
1552
1553 /*
1554 * The "declaration", "vartagfield", and "varlist" fields apply to
1555 * Pascal/Modcal records only and are nil for record structures in
1556 * other languages. If there is a tag, then the "vartagfield" points
1557 * to the FIELD DNTT describing the tag. Otherwise, the "vartagfield"
1558 * points to the tag type.
1559 *
1560 * The STRUCT DNTT may be used in both the GNTT and LNTT.
1561 */
1562
1563
1564 struct DNTT_UNION {
1565 /*0*/ BITS extension: 1; /* always zero */
1566 KINDTYPE kind: 10; /* always K_UNION */
1567 BITS unused: 21;
1568 /*1*/ DNTTPOINTER firstfield; /* first FIELD entry */
1569 /*2*/ unsigned long bitlength; /* total at this level */
1570 }; /* three words */
1571
1572 /*
1573 * This type supports C unions only and is not used otherwise.
1574 *
1575 * Since STRUCTUREs and UNIONs are not packable inside of outer
1576 * STRUCTUREs and UNIONs, their bitlengths tell their actual (not
1577 * necessarily packed) size, according only as to how they are
1578 * internally packed.
1579 *
1580 * The STRUCT DNTT may be used in both the GNTT and LNTT.
1581 */
1582
1583
1584 struct DNTT_FIELD {
1585 /*0*/ BITS extension: 1; /* always zero */
1586 KINDTYPE kind: 10; /* always K_FIELD */
1587 #ifdef CPLUSPLUS
1588 BITS visibility:2; /* pub = 0, prot = 1, priv = 2 */
1589 BITS a_union: 1; /* 1 => anonymous union member */
1590 #ifdef TEMPLATES
1591 BITS staticMem: 1; /* 1 -> static member of a template */
1592 BITS unused: 17;
1593 #else /* TEMPLATES */
1594 BITS unused: 18;
1595 #endif /* TEMPLATES */
1596 #else
1597 BITS unused: 21;
1598 #endif
1599 /*1*/ VTPOINTER name; /* name of field, if any */
1600 /*2*/ unsigned long bitoffset; /* of object itself in STRUCT */
1601 /*3*/ DNTTPOINTER type; /* type information */
1602 /*4*/ unsigned long bitlength; /* size at this level */
1603 /*5*/ DNTTPOINTER nextfield; /* next FIELD in STRUCT, if any */
1604 }; /* six words */
1605
1606 /*
1607 * This type describes the fields in Pascal records and C
1608 * structures and unions. The bitoffset is from the start of the
1609 * STRUCT or UNION that started the chain, to the start of the
1610 * object itself, ignoring any padding. Note that bitoffset
1611 * does not have to be on a byte boundary. For unions, each
1612 * bitoffset should be zero since all fields overlap.
1613 *
1614 * The bitlength field is the same as that of the type except for C
1615 * bit fields, which may be a different size than the base type.
1616 *
1617 * The FIELD DNTT can be used in both the GNTT and LNTT.
1618 */
1619
1620
1621 struct DNTT_VARIANT {
1622 /*0*/ BITS extension: 1; /* always zero */
1623 KINDTYPE kind: 10; /* always K_VARIANT */
1624 BITS unused: 21;
1625 /*1*/ long lowvarvalue; /* meaning depends on vartype */
1626 /*2*/ long hivarvalue; /* meaning depends on vartype */
1627 /*3*/ DNTTPOINTER varstruct; /* this variant STRUCT, if any */
1628 /*4*/ unsigned long bitoffset; /* of variant, in outer STRUCT */
1629 /*5*/ DNTTPOINTER nextvar; /* next VARIANT, if any */
1630 }; /* six words */
1631
1632 /*
1633 * "varstruct" points to the STRUCT which in turn describes the
1634 * contents of the variant. The latter might in turn point to
1635 * VARIANTs of its own, and to FIELDs which point to other STRUCTs.
1636 * "lowvarvalue" and "hivarvalue" are the range of values for which
1637 * this variant applys; more than one dntt VARIANT may be necessary
1638 * to describe the range (e.g., 'a'..'n','q':). A type field is un-
1639 * necessary, as the type can be obtained from the "vartagfield"
1640 * field of the STRUCT DNTT.
1641 *
1642 * The VARIANT DNTT can be used in both the GNTT and LNTT.
1643 */
1644
1645
1646 struct DNTT_FILE {
1647 /*0*/ BITS extension: 1; /* always zero */
1648 KINDTYPE kind: 10; /* always K_FILE */
1649 BITS ispacked: 1; /* 1 => file is packed */
1650 BITS unused: 20;
1651 /*1*/ unsigned long bitlength; /* of whole element buffer */
1652 /*2*/ unsigned long bitoffset; /* of current element in buffer */
1653 /*3*/ DNTTPOINTER elemtype; /* type and size of of element */
1654 }; /* four words */
1655
1656 /*
1657 * Pascal/Modcal is the only language of interest with built-in file
1658 * buffering. For Pascal/Modcal files, the symbol table tells the file
1659 * element type, the sizes of the current element (via "elemtype")
1660 * and the whole buffer (via "bitlength"), and the locations of the
1661 * element buffer (from the parent "NAME" entry) and the element
1662 * itself within the buffer, following header information (from
1663 * "bitoffset").
1664 *
1665 * The FILE DNTT can be used in both the GNTT and LNTT.
1666 */
1667
1668
1669 struct DNTT_FUNCTYPE {
1670 /*0*/ BITS extension: 1; /* always zero */
1671 KINDTYPE kind: 10; /* always K_FUNCTYPE */
1672 BITS varargs: 1; /* func-proto ellipses. */
1673 BITS info: 4; /* lang-specific stuff; F_xxxx */
1674 BITS unused: 16;
1675 /*1*/ unsigned long bitlength; /* size of function pointer */
1676 /*2*/ DNTTPOINTER firstparam; /* first FPARAM, if any */
1677 /*3*/ DNTTPOINTER retval; /* return type, if any */
1678 }; /* four words */
1679
1680 /*
1681 * This type supports function variables in a limited way,
1682 * including the parameter types (if any) and the return value type
1683 * (if any).
1684 *
1685 * See DNTT_FUNC for discussion of various fields.
1686 *
1687 * The FUNCTYPE DNTT can be used in both the GNTT and LNTT.
1688 */
1689
1690
1691 struct DNTT_COBSTRUCT {
1692 /*0*/ BITS extension: 1; /* always zero */
1693 KINDTYPE kind: 10; /* always K_COBSTRUCT */
1694 BITS hasoccurs: 1; /* descendant has OCCURS clause */
1695 BITS istable: 1; /* is a table item? */
1696 BITS unused: 19;
1697 /*1*/ DNTTPOINTER parent; /* next higher data item */
1698 /*2*/ DNTTPOINTER child; /* 1st descendant data item */
1699 /*3*/ DNTTPOINTER sibling; /* next data item at this level */
1700 /*4*/ DNTTPOINTER synonym; /* next data item w/ same name */
1701 /*5*/ BITS catusage: 6; /* category or usage of item */
1702 BITS pointloc: 8; /* location of decimal point */
1703 BITS numdigits:10; /* number of digits */
1704 BITS unused2: 8;
1705 /*6*/ DNTTPOINTER table; /* array entry describing table */
1706 /*7*/ VTPOINTER editpgm; /* name of edit subprogram */
1707 /*8*/ unsigned long bitlength; /* size of item in bits */
1708 }; /* nine words */
1709
1710 /*
1711 * This entry is used to describe COBOL data items and table items.
1712 * A Cobol variable will begin with a DNTT_SVAR, DNTT_DVAR, or DNTT_
1713 * FPARAM whose "type" field is a DNTTPOINTER to a DNTT_COBSTRUCT.
1714 *
1715 * "parent", "child", "sibling", and "synonym" are DNTTPOINTER to
1716 * other DNTT_SVAR, DNTT_DVAR, or DNTT_FPARAMs having these particular
1717 * relationships with the current DNTT_COBSTRUCT (or are set to DNTTNIL
1718 * if no such relationship exists).
1719 *
1720 * "hasoccurs" is set to 1 if the descendent of this COBOL element
1721 * (pointed to by "child") has an OCCURS ... DEPENDING ON clause.
1722 *
1723 * "istable" is set to 1 if this COBOL data item is a table. In this
1724 * case, "table" will point to a DNTT_ARRAY entry describing the table.
1725 *
1726 * The COBSTRUCT DNTT can be used in both the GNTT and LNTT.
1727 */
1728
1729 /*
1730 * Used for C too so pulled out of ifdef CPLUSPLUS.
1731 */
1732
1733 struct DNTT_MODIFIER {
1734 /*0*/ BITS extension: 1; /* always zero */
1735 KINDTYPE kind: 10; /* always K_MODIFIER */
1736 BITS m_const: 1; /* const */
1737 BITS m_static: 1; /* static */
1738 BITS m_void: 1; /* void */
1739 BITS m_volatile: 1; /* volatile */
1740 BITS m_duplicate: 1; /* duplicate */
1741 BITS unused: 16;
1742 /*1*/ DNTTPOINTER type; /* subtype */
1743 }; /* two words */
1744
1745 #ifdef CPLUSPLUS
1746 struct DNTT_GENFIELD {
1747 /*0*/ BITS extension: 1; /* always zero */
1748 KINDTYPE kind: 10; /* always K_GENFIELD */
1749 BITS visibility: 2; /* pub = 0, prot = 1, priv = 2 */
1750 BITS a_union: 1; /* 1 => anonymous union member */
1751 BITS unused: 18;
1752 /*1*/ DNTTPOINTER field; /* pointer to field or qualifier */
1753 /*2*/ DNTTPOINTER nextfield; /* pointer to next field */
1754 }; /* three words */
1755
1756 struct DNTT_MEMACCESS {
1757 /*0*/ BITS extension: 1; /* always zero */
1758 KINDTYPE kind: 10; /* always K_MEMACCESS */
1759 BITS unused: 21;
1760 /*1*/ DNTTPOINTER classptr; /* pointer to base class */
1761 /*2*/ DNTTPOINTER field; /* pointer field */
1762 }; /* three words */
1763
1764 struct DNTT_VFUNC {
1765 /*0*/ BITS extension: 1; /* always zero */
1766 KINDTYPE kind: 10; /* always K_VFUNCTION */
1767 BITS pure: 1; /* pure virtual function ? */
1768 BITS unused: 20;
1769 /*1*/ DNTTPOINTER funcptr; /* function name */
1770 /*2*/ unsigned long vtbl_offset; /* offset into vtbl for virtual */
1771 }; /* three words */
1772
1773 struct DNTT_CLASS_SCOPE {
1774 /*0*/ BITS extension: 1; /* always zero */
1775 KINDTYPE kind: 10; /* always K_CLASS_SCOPE */
1776 BITS unused: 21;
1777 /*1*/ SLTPOINTER address; /* pointer to SLT entry */
1778 /*2*/ DNTTPOINTER type; /* pointer to class type DNTT */
1779 }; /* three words */
1780
1781 struct DNTT_FRIEND_CLASS {
1782 /*0*/ BITS extension: 1; /* always zero */
1783 KINDTYPE kind: 10; /* always K_FRIEND_CLASS */
1784 BITS unused: 21;
1785 /*1*/ DNTTPOINTER classptr; /* pointer to class DNTT */
1786 /*2*/ DNTTPOINTER next; /* next DNTT_FRIEND */
1787 }; /* three words */
1788
1789 struct DNTT_FRIEND_FUNC {
1790 /*0*/ BITS extension: 1; /* always zero */
1791 KINDTYPE kind: 10; /* always K_FRIEND_FUNC */
1792 BITS unused: 21;
1793 /*1*/ DNTTPOINTER funcptr; /* pointer to function */
1794 /*2*/ DNTTPOINTER classptr; /* pointer to class DNTT */
1795 /*3*/ DNTTPOINTER next; /* next DNTT_FRIEND */
1796 }; /* four words */
1797
1798 struct DNTT_CLASS {
1799 /*0*/ BITS extension: 1; /* always zero */
1800 KINDTYPE kind: 10; /* always K_CLASS */
1801 BITS abstract: 1; /* is this an abstract class? */
1802 BITS class_decl: 2; /* 0=class,1=union,2=struct */
1803 #ifdef TEMPLATES
1804 BITS expansion: 1; /* 1=template expansion */
1805 BITS unused: 17;
1806 #else /* TEMPLATES */
1807 BITS unused: 18;
1808 #endif /* TEMPLATES */
1809 /*1*/ DNTTPOINTER memberlist; /* ptr to chain of K_[GEN]FIELDs */
1810 /*2*/ unsigned long vtbl_loc; /* offset in obj of ptr to vtbl */
1811 /*3*/ DNTTPOINTER parentlist; /* ptr to K_INHERITANCE list */
1812 /*4*/ unsigned long bitlength; /* total at this level */
1813 /*5*/ DNTTPOINTER identlist; /* ptr to chain of class ident's */
1814 /*6*/ DNTTPOINTER friendlist; /* ptr to K_FRIEND list */
1815 #ifdef TEMPLATES
1816 /*7*/ DNTTPOINTER templateptr; /* ptr to template */
1817 /*8*/ DNTTPOINTER nextexp; /* ptr to next expansion */
1818 #else /* TEMPLATES */
1819 /*7*/ unsigned long future2;
1820 /*8*/ unsigned long future3;
1821 #endif /* TEMPLATES */
1822 };
1823 /* nine words */
1824 #ifdef TEMPLATES
1825 struct DNTT_TEMPLATE {
1826 /*0*/ BITS extension: 1; /* always zero */
1827 KINDTYPE kind: 10; /* always K_TEMPLATE */
1828 BITS abstract: 1; /* is this an abstract class? */
1829 BITS class_decl: 2; /* 0=class,1=union,2=struct */
1830 BITS unused: 18;
1831 /*1*/ DNTTPOINTER memberlist; /* ptr to chain of K_[GEN]FIELDs */
1832 /*2*/ long unused2; /* offset in obj of ptr to vtbl */
1833 /*3*/ DNTTPOINTER parentlist; /* ptr to K_INHERITANCE list */
1834 /*4*/ unsigned long bitlength; /* total at this level */
1835 /*5*/ DNTTPOINTER identlist; /* ptr to chain of class ident's */
1836 /*6*/ DNTTPOINTER friendlist; /* ptr to K_FRIEND list */
1837 /*7*/ DNTTPOINTER arglist; /* ptr to argument list */
1838 /*8*/ DNTTPOINTER expansions; /* ptr to expansion list */
1839 };
1840
1841 /*
1842 * DNTT_TEMPLATEs only appear in the GNTT. Functions and
1843 * classes templates cannot be local. (Their instantions may be).
1844 */
1845
1846 struct DNTT_TEMPL_ARG {
1847 /*0*/ BITS extension: 1; /* always zero */
1848 KINDTYPE kind: 10; /* always K_TEMPL_ARG */
1849 BITS usagetype:1; /* 0 type-name 1 expression */
1850 BITS unused: 20;
1851 /*1*/ VTPOINTER name; /* name of argument */
1852 /*2*/ DNTTPOINTER type; /* for non type arguments */
1853 /*3*/ DNTTPOINTER nextarg; /* Next argument if any */
1854 /*4*/ long unused2[2];
1855 }; /* 6 words */
1856
1857 /*
1858 * Pxdb fills in the prevexp, and nextexp in the
1859 * DNTT_CLASS. Pxdb also fills in the expansions field in the
1860 * DNTT_TEMPLATE.
1861 */
1862 #endif /* TEMPLATES */
1863
1864 struct DNTT_PTRMEM {
1865 /*0*/ BITS extension: 1; /* always zero */
1866 KINDTYPE kind: 10; /* K_PTRMEM or K_PTRMEMFUNC */
1867 BITS unused: 21;
1868 /*1*/ DNTTPOINTER pointsto; /* pointer to class DNTT */
1869 /*2*/ DNTTPOINTER memtype; /* type of member */
1870 }; /* three words */
1871
1872 struct DNTT_INHERITANCE {
1873 /*0*/ BITS extension: 1; /* always zero */
1874 KINDTYPE kind: 10; /* K_INHERITANCE */
1875 BITS Virtual: 1; /* virtual base class ? */
1876 BITS visibility: 2; /* pub = 0, prot = 1, priv = 2 */
1877 BITS unused: 18;
1878 /*1*/ DNTTPOINTER classname; /* first parent class, if any */
1879 /*2*/ unsigned long offset; /* offset to start of base class */
1880 /*3*/ DNTTPOINTER next; /* pointer to next K_INHERITANCE */
1881 }; /* four words */
1882
1883 struct DNTT_OBJECT_ID {
1884 /*0*/ BITS extension: 1; /* always zero */
1885 KINDTYPE kind: 10; /* K_OBJECT_ID */
1886 BITS unused: 21;
1887 /*1*/ unsigned long object_ident; /* object identifier */
1888 /*2*/ unsigned long offset; /* offset to start of base class */
1889 /*3*/ DNTTPOINTER next; /* pointer to next K_OBJECT_ID */
1890 /*4*/ unsigned long segoffset; /* for linker fixup */
1891 }; /* five words */
1892 #endif
1893
1894 /*
1895 * DNTT_XREF ENTRY:
1896 * This entry is used to retrieve cross-reference information from
1897 * the XREF Table (XT). A DNTT_XREF entry immediately follows the
1898 * DNTT_SVAR, DNTT_DVAR, DNTT_TYPE, etc. entry to which it pertains.
1899 *
1900 * The XREFPOINTER points into the XT table where the information
1901 * about the previous DNTT entry is contained. If no entries are
1902 * generated in the XT table, the xreflist field should contain
1903 * XREFNIL. The language field contains the source language
1904 * (LANG_xxx) value of the DNTT object.
1905 *
1906 * The XREF DNTT can be used in both the GNTT and LNTT.
1907 */
1908
1909 struct DNTT_XREF {
1910 /*0*/ BITS extension: 1; /* always zero */
1911 KINDTYPE kind: 10; /* always K_XREF */
1912 BITS language: 4; /* language of DNTT object */
1913 BITS unused: 17;
1914 /*1*/ XREFPOINTER xreflist; /* index into XREF subspace */
1915 /*2*/ long extra; /* free */
1916 }; /* three words */
1917
1918
1919 /*
1920 * DNTT_SA ENTRY:
1921 * This entry is used with static analysis info. It supplies the
1922 * name and kind for a few special cases not currently handled by a
1923 * DNTT_SVAR, DNTT_DVAR, DNTT_TYPE, etc. It is used for a local
1924 * entity that has a global scope.
1925 *
1926 * Example: a function, has a DNTT_FUNCTION entry in the LNTT;
1927 * but it can be seen globally, thus a K_SA will be emitted in
1928 * the GNTT, with the functions name and a base_kind of K_FUNCTION;
1929 * the DNTT_XREF will follow the DNTT_SA, not the DNTT_FUNCTION.
1930 *
1931 * The DNTT_SA is also used for C macros.
1932 *
1933 * The XREF DNTT can be used in both the GNTT and LNTT.
1934 */
1935
1936 struct DNTT_SA {
1937 /*0*/ BITS extension: 1; /* always zero */
1938 KINDTYPE kind: 10; /* always K_SA */
1939 KINDTYPE base_kind:10; /* K_FUNCTION, K_LABEL, etc */
1940 BITS unused: 11;
1941 /*1*/ VTPOINTER name;
1942 /*2*/ long extra; /* free */
1943 }; /* three words */
1944
1945
1946 /*
1947 * ---- 5.5. OVERALL DNTT ENTRY FORMAT
1948 */
1949
1950
1951 /*
1952 * Generic entry for easy access:
1953 */
1954
1955 struct DNTT_GENERIC { /* rounded up to whole number of blocks */
1956 unsigned long word [9];
1957 };
1958
1959 struct DNTT_BLOCK { /* easy way to deal with one block */
1960 /*0*/ BITS extension: 1; /* always zero */
1961 KINDTYPE kind: 10; /* kind of dnttentry */
1962 BITS unused: 21;
1963 /*1*/ unsigned long word [2];
1964 };
1965
1966
1967 /*
1968 * Overall format:
1969 */
1970
1971 union dnttentry {
1972 struct DNTT_SRCFILE dsfile;
1973
1974 struct DNTT_MODULE dmodule;
1975 struct DNTT_FUNC dfunc;
1976 struct DNTT_FUNC dentry;
1977 struct DNTT_FUNC dblockdata;
1978 struct DNTT_BEGIN dbegin;
1979 struct DNTT_END dend;
1980 struct DNTT_IMPORT dimport;
1981 struct DNTT_LABEL dlabel;
1982 struct DNTT_WITH dwith;
1983 struct DNTT_COMMON dcommon;
1984
1985 struct DNTT_FPARAM dfparam;
1986 struct DNTT_SVAR dsvar;
1987 struct DNTT_DVAR ddvar;
1988 struct DNTT_CONST dconst;
1989
1990 struct DNTT_TYPE dtype;
1991 struct DNTT_TYPE dtag;
1992 struct DNTT_POINTER dptr;
1993 struct DNTT_ENUM denum;
1994 struct DNTT_MEMENUM dmember;
1995 struct DNTT_SET dset;
1996 struct DNTT_SUBRANGE dsubr;
1997 struct DNTT_ARRAY darray;
1998 struct DNTT_STRUCT dstruct;
1999 struct DNTT_UNION dunion;
2000 struct DNTT_FIELD dfield;
2001 struct DNTT_VARIANT dvariant;
2002 struct DNTT_FILE dfile;
2003 struct DNTT_FUNCTYPE dfunctype;
2004 struct DNTT_COBSTRUCT dcobstruct;
2005
2006 #ifdef CPLUSPLUS
2007 struct DNTT_CLASS_SCOPE dclass_scope;
2008 struct DNTT_POINTER dreference;
2009 struct DNTT_PTRMEM dptrmem;
2010 struct DNTT_PTRMEM dptrmemfunc;
2011 struct DNTT_CLASS dclass;
2012 struct DNTT_GENFIELD dgenfield;
2013 struct DNTT_VFUNC dvfunc;
2014 struct DNTT_MEMACCESS dmemaccess;
2015 struct DNTT_INHERITANCE dinheritance;
2016 struct DNTT_FRIEND_CLASS dfriend_class;
2017 struct DNTT_FRIEND_FUNC dfriend_func;
2018 struct DNTT_MODIFIER dmodifier;
2019 struct DNTT_OBJECT_ID dobject_id;
2020 struct DNTT_FUNC dmemfunc;
2021 #ifdef TEMPLATES
2022 struct DNTT_TEMPLATE dtemplate;
2023 struct DNTT_TEMPL_ARG dtempl_arg;
2024 struct DNTT_FUNC_TEMPLATE dfunctempl;
2025 struct DNTT_LINK dlink; /* generic */
2026 struct DNTT_TFUNC_LINK dtflink;
2027 #endif /* TEMPLATES */
2028 #endif
2029
2030 struct DNTT_XREF dxref;
2031 struct DNTT_SA dsa;
2032
2033 struct DNTT_GENERIC dgeneric;
2034 struct DNTT_BLOCK dblock;
2035 };
2036
2037
2038 /*
2039 * ---- 6. SOURCE LINE TABLE (SLT) ENTRY FORMAT
2040 */
2041
2042 /*
2043 * Type of SLT special entry:
2044 *
2045 * Sizeof (SLTTYPE) = 4 bits, for a maximum of 16 possible special
2046 * slttypes. Note that SLT_NIL is the same as SLTNIL.
2047 */
2048
2049 typedef unsigned int SLTTYPE;
2050
2051 #define SLT_NIL SLTNIL
2052
2053 #define SLT_NORMAL 0 /* note that the field is unsigned */
2054 #define SLT_SRCFILE 1
2055 #define SLT_MODULE 2
2056 #define SLT_FUNCTION 3
2057 #define SLT_ENTRY 4
2058 #define SLT_BEGIN 5
2059 #define SLT_END 6
2060 #define SLT_WITH 7
2061 #define SLT_EXIT 8
2062 #define SLT_ASSIST 9
2063 #define SLT_MARKER 10
2064 #ifdef CPLUSPLUS
2065 #define SLT_CLASS_SCOPE 11
2066 #endif
2067
2068 struct SLT_NORM {
2069 SLTTYPE sltdesc: 4; /* always zero */
2070 BITS line: 28; /* where in source text */
2071 ADDRESS address; /* where in function */
2072 }; /* two words */
2073
2074 struct SLT_SPEC {
2075 SLTTYPE sltdesc: 4; /* special entry type */
2076 BITS line: 28; /* where in source text */
2077 DNTTPOINTER backptr; /* where in DNTT */
2078 }; /* two words */
2079
2080 struct SLT_ASST {
2081 SLTTYPE sltdesc: 4; /* always nine */
2082 BITS unused: 28;
2083 SLTPOINTER address; /* first SLT normal */
2084 }; /* two words */
2085
2086 struct SLT_GENERIC {
2087 unsigned long word[2];
2088 }; /* two words */
2089
2090
2091 union sltentry {
2092 struct SLT_NORM snorm;
2093 struct SLT_SPEC sspec;
2094 struct SLT_ASST sasst;
2095 struct SLT_GENERIC sgeneric;
2096 }; /* two words */
2097
2098 #define SLTBLOCKSIZE 8
2099 #define SLT_LN_PROLOGUE 0x0fffffff
2100
2101 /*
2102 * This table consists of a series of entries, each of which is
2103 * either normal, special, or assist according to the sltdesc field
2104 * of the first word. Normal entries contain an address (actually
2105 * a code offset relative to the beginning of the current function)
2106 * and a source/listing line (by line number). Listing line numbers
2107 * may be used in place of source line numbers based upon a compiler
2108 * option. This will also be reflected in the DNTT_SRCFLE entries.
2109 * Special entries also provide a line number (where something was
2110 * declared) and point back to the DNTT which references them. This
2111 * is used for quick determination of scope, including source/listing
2112 * file, after an interrupt. Even if there are multiple source/listing
2113 * files, all source/listing line information is accumulated in this
2114 * one table.
2115 *
2116 * The SLT was originally designed to be unnested, even for those
2117 * languages whose LNTT must reflect their nesting. The debuggers
2118 * depend upon this. For those languages that are nested the SLT
2119 * must now be nested and an SLT_ASST must immediately follow each
2120 * SLT_SPEC of type FUNC. The "address" field will be filled in by
2121 * the compiler back-ends to point forward to the first SLT_NORM in
2122 * the FUNC's scope. The "firstnorm" is set to one if this SLT_NORM
2123 * is the first SLT_NORM looking sequentially forward in the SLT.
2124 *
2125 * The one exception to the normal/special/assist rule is the EXIT SLT.
2126 * The EXIT SLT is used to identify exit points for a routine. The
2127 * EXIT SLT is a special only in the sense that the sltdesc field
2128 * is not equal to SLT_NORMAL. However, it contains a line number
2129 * and address like a normal SLT. The EXIT SLT is used in place of
2130 * a NORMAL SLT for all exit statements (such as "return" in C and
2131 * FORTRAN, or the "end" of a procedure body in Pascal).
2132 *
2133 * The SLT_MARKER is for use in "Chunk-Per-Som". The address field
2134 * contains a new base address (replacing the current procedure's
2135 * low-address field. This new base address will be added to succeding
2136 * SLT_NORMALs and SLT_EXITs to produce an absolute address.
2137 *
2138 * To distinguish prologue (function setup) code emitted at the END
2139 * of a function from the last line (normal SLT) of the function, a
2140 * normal SLT entry with a line number of SLT_LN_PRLOGUE is used.
2141 * Such SLT entries are only emitted if there is trailing prologue
2142 * code, and they are always the last SLT emitted for the function
2143 * except for the special SLT entry for the function END. For com-
2144 * pilers that emit the prologue code before the main body, no
2145 * special prologue SLT entry is required.
2146 *
2147 * One SLT entry is emitted for (the FIRST physical line of) each
2148 * executable statement, for each construct that generates a DNTT
2149 * entry which points to an SLT entry, and for the prologue code,
2150 * if any. The user cannot set a breakpoint without a corresponding
2151 * SLT entry. Compilers must emit multiple SLT entries for parts
2152 * of a composite statement (such as FOR) and for multiple statements
2153 * appearing on one source line.
2154 *
2155 * For compatibility, the high bits of DNTTPOINTERs in SLT entries
2156 * are also set to 1, even though they are not needed here.
2157 *
2158 * The global bit on DNTTPOINTERs in SLT entries should always be 0,
2159 * as the LNTT contains all the scoping information.
2160 */
2161
2162 /*
2163 * ---- 7. VALUE TABLE (VT) ENTRY FORMAT
2164 *
2165 *
2166 * This table contains symbol names plus values for DNTT_CONST
2167 * entries of type LOC_VT. All strings are null-terminated, as in C.
2168 * There are no restrictions on the lengths of values nor the order
2169 * in which they may appear. All symbol names are exactly as given
2170 * by the user, e.g. there are no prepended underscores.
2171 *
2172 * CONST values are not (and need not be) terminated in any way.
2173 * They may be forced to word boundaries if necessary, with
2174 * resulting wasted bytes.
2175 *
2176 * The first byte of the table must be zero (a null string
2177 * terminator), so that the null VTPOINTER results in a null name.
2178 */
2179
2180 /*
2181 * ---- 8. XREF TABLE (XT) ENTRY FORMAT
2182 *
2183 * This table contains static information about each named object in
2184 * a compilation unit. It consists of a collection of of lists,
2185 * each list associated with a DNTT object via the DNTT_XREF that
2186 * follows the object. The DNTT_XREF contains an XREFPOINTER which
2187 * is an offset into the XT table, and denotes the beginning of the
2188 * reference list.
2189 *
2190 * Each list is actually one or more of linear sub-list that are
2191 * linked together. Each sublist begins with an XREFNAME entry,
2192 * which names a (current) source file. Following the XREFNAME is
2193 * one or more XREFINFO entries, one for each appearance of the
2194 * object's name in the current file. These entries list what type
2195 * of reference and the line no. within the file. Column numbers
2196 * are currently unsupported. The XREFINFO1 structure is normally
2197 * used. The XREFINFO2A/B structure pair is only used for compilers
2198 * which support line numbers greater than 16 bits long. An
2199 * XREFLINK marks the end of a sublist, so a typical sequence looks
2200 * like:
2201 *
2202 * XREFNAME, XREFINFO1, XREFINFO1, ... , XREFLINK
2203 *
2204 * Note that all elements of a sublist must appear in sequence
2205 * (linearly). If the list must be continued, the XREFLINK serves
2206 * as a continuation pointer from one sublist to the next, and
2207 * contains another offset into the XT where the next sublist is
2208 * found for the same named object. If there is no additional
2209 * sublist, the XREFLINK contains a 0 index, denoting the end of the
2210 * current list.
2211 *
2212 * Lists for the same named object may appear in different
2213 * compilation units. It is the responsibility of PXDB to link
2214 * these together.
2215 *
2216 */
2217
2218 #define XTBLOCKSIZE 4
2219
2220 #define XINFO1 0
2221 #define XINFO2 1
2222 #define XLINK 2
2223 #define XNAME 3
2224
2225 struct XREFINFO1 {
2226 BITS tag: 3; /* always XINFO1 */
2227 BITS definition: 1; /* True => definition */
2228 BITS declaration: 1; /* True => declaration */
2229 BITS modification: 1; /* True => modification */
2230 BITS use: 1; /* True => use */
2231 BITS call: 1; /* True => call */
2232 BITS column: 8; /* Unsigned Byte for Column within line */
2233 BITS line: 16; /* Unsigned 16-bits for line # relative */
2234 /* to beginning of current inlude file. */
2235 };
2236
2237 struct XREFINFO2A {
2238 /* first word */
2239 BITS tag: 3; /* always XINFO2A */
2240 BITS definition: 1; /* True => definition */
2241 BITS declaration: 1; /* True => declaration */
2242 BITS modification: 1; /* True => modification */
2243 BITS use: 1; /* True => use */
2244 BITS call: 1; /* True => call */
2245 BITS extra: 16; /* ? */
2246 BITS column: 8; /* ? */
2247 };
2248
2249 struct XREFINFO2B {
2250 /* second word */
2251 BITS line: 32; /* Unsigned 32-bits for line # relative */
2252 /* to beginning of current file. */
2253 };
2254
2255 struct XREFLINK {
2256 BITS tag: 3; /* always XLINK for XREFLINK */
2257 BITS next: 29; /* index of next list. If */
2258 /* zero then this is the end of line. */
2259 /* a.k.a. continuation pointer */
2260 };
2261 struct XREFNAME {
2262 BITS tag: 3; /* always XNAME for XREFNAME */
2263 BITS filename: 29; /* VTPOINTER to file name */
2264 };
2265
2266 union xrefentry {
2267 struct XREFINFO1 xrefshort;
2268 struct XREFINFO2A xreflong;
2269 struct XREFINFO2B xrefline;
2270 struct XREFLINK xlink;
2271 struct XREFNAME xfname;
2272 };
2273
2274
2275 /*
2276 * ---- 9. ORDERING OF TABLE ENTRIES
2277 *
2278 *
2279 * LNTT and SLT entries must be emitted and kept in source file
2280 * order wherever possible. As a minimum, named LNTT entries must
2281 * be emitted and kept within the proper scope, though some
2282 * compilers may emit them at the end of a scope instead of the
2283 * beginning. In general, the debugger must know the emission
2284 * rules for the language it is dealing with, and search the LNTT
2285 * accordingly, or else always search in both directions.
2286 *
2287 * Items in the GNTT are all global, so the public bit must always
2288 * be set. Within the LNTT, the public bit indicates that the item
2289 * is exported by the module in which it resides, and is visible
2290 * within a module or procedure that imports the containing module.
2291 *
2292 * Compilers and linkers are encouraged to make multiple references
2293 * to DNTT, SLT, and VT entries (even chains of DNTT entries) where
2294 * possible to reduce redundancy with no loss of data. They are
2295 * also encouraged to emit entries grouped so that related entries
2296 * are physically close, as long as no scope rules are violated.
2297 *
2298 * SLT entries must be emitted in sorted line number order within
2299 * each file, except for special SLT entries for ENTRYs and
2300 * FUNCTIONs only. They may be out of line number order (due to
2301 * nested functions, etc.) so long as the next normal SLT entry is
2302 * the proper place to breakpoint the entity. For example, there
2303 * can be numerous ENTRY types after a FUNCTION, all referring to
2304 * the same code location. (If there are no normal SLT entries
2305 * before the next FUNCTION or MODULE entry and a SLT_ASST does not
2306 * immediately follow the SLT_SPEC for a FUNC, the entity has no
2307 * breakpointable locations.)
2308 *
2309 * SLT entries must be sorted in ascending code address order
2310 * WITHIN EACH MODULE or FUNCTION body. It is impossible to
2311 * require that they be sorted both by file line number and code
2312 * address because function object code may be emitted or linked
2313 * out of source order in a segment.
2314 *
2315 * It is reasonable to expect sequential SLT entries may have the
2316 * same line numbers or code locations (but not both, as that would
2317 * be redundant). This might be due to multiple statements on one
2318 * source line or several scope levels starting at one place in the
2319 * code.
2320 *
2321 * Thus, for nested languages like Pascal and Modcal, the LNTT
2322 * entries must be nested to reflect the program's scope. The SLT
2323 * entries should also be nested with an SLT_ASST entry following
2324 * each SLT_SPEC of type FUNC.
2325 */
2326
2327
2328 /*
2329 * ---- 10. LINKER CONSIDERATIONS
2330 *
2331 * As stated earlier, all fixups to the debug information are
2332 * done through the generation of a list of fixups for the GNTT
2333 * and LNTT subspaces within the debug space. Other than these
2334 * fixups, the only other task for the linker is the concatenation
2335 * of the debug spaces from separate compilation units.
2336 */
2337
2338
2339 /*
2340 * --- 11. PREPROCESSOR
2341 */
2342
2343 /*
2344 * The preprocessor (PXDB) which must be run on the debug info in
2345 * the executable program file massages this debug info so that the
2346 * debugger may start up and run more efficiently. Some of the
2347 * tasks performed by PXDB are: remove duplicate global type and
2348 * variable information from the GNTT, append the GNTT onto the end
2349 * of the LNTT and place both back in the LNTT section, build quick
2350 * look-up tables for files, procedures, modules, and paragraphs
2351 * (for Cobol), placing these in the GNTT section, and reconstruct
2352 * the header appearing in the header section to access this
2353 * information.
2354 *
2355 * This post-PXDB header is as follows:
2356 */
2357
2358 struct PXDB_header {
2359 int pd_entries; /* # of entries in function look-up table */
2360 int fd_entries; /* # of entries in file look-up table */
2361 int md_entries; /* # of entries in module look-up table */
2362 BITS pxdbed : 1; /* 1 => file has been preprocessed */
2363 BITS bighdr : 1; /* 1 => this header contains 'time' word */
2364 BITS sa_header : 1;/* 1 => created by SA version of pxdb */
2365 /* used for version check in xdb */
2366 #ifdef CPLUSPLUS
2367 BITS inlined: 1; /* one or more functions have been inlined */
2368 BITS spare:12;
2369 short version; /* pxdb header version */
2370 #else /* CPLUSPLUS */
2371 BITS spare:29;
2372 #endif /* CPLUSPLUS */
2373 int globals; /* index into the DNTT where GNTT begins */
2374 BITS time; /* modify time of file before being pxdbed */
2375 int pg_entries; /* # of entries in label look-up table */
2376 int functions; /* actual number of functions */
2377 int files; /* actual number of files */
2378 #ifdef CPLUSPLUS
2379 int cd_entries; /* # of entries in class look-up table */
2380 int aa_entries; /* # of entries in addr alias look-up table */
2381 int oi_entries; /* # of entries in object id look-up table */
2382 #endif
2383 };
2384
2385 #define PXDB_VERSION_CPLUSPLUS 1
2386 #define PXDB_VERSION_7_4 2
2387 #define PXDB_VERSION_CPP_30 3
2388
2389 #define PXDB_VERSION_2_1 1
2390
2391 /*
2392 * The structures for the quick look-up tables in the
2393 * post-PXDB GNTT section are:
2394 */
2395
2396 /*
2397 * Source File Descriptor:
2398 *
2399 * An element of the source file quick look-up table
2400 */
2401
2402 typedef struct FDS {
2403 long isym; /* first symbol for file */
2404 ADRT adrStart; /* mem adr of start of file's code */
2405 ADRT adrEnd; /* mem adr of end of file's code */
2406 char *sbFile; /* name of source file */
2407 BITS fHasDecl: 1; /* do we have a .d file? */
2408 BITS fWarned: 1; /* have warned about age problems? */
2409 unsigned short ilnMac; /* lines in file (0 if don't know) */
2410 int ipd; /* first proc for file, in PD [] */
2411 BITS *rgLn; /* line pointer array, if any */
2412 } FDR, *pFDR;
2413
2414 /*
2415 * Procedure Descriptor:
2416 *
2417 * An element of the procedure quick look-up table
2418 */
2419
2420 typedef struct PDS {
2421 long isym; /* first symbol for proc */
2422 ADRT adrStart; /* memory adr of start of proc */
2423 ADRT adrEnd; /* memory adr of end of proc */
2424 char *sbAlias; /* alias name of procedure */
2425 char *sbProc; /* real name of procedure */
2426 ADRT adrBp; /* address of entry breakpoint */
2427 ADRT adrExitBp; /* address of exit breakpoint */
2428 #ifdef CPLUSPLUS
2429 int icd; /* member of this class */
2430 #else /* CPLUSPLUS */
2431 BITS inst; /* instruction at entry */
2432 #endif /* CPLUSPLUS */
2433 #ifdef TEMPLATES
2434 BITS ipd; /* index of template for this function */
2435 #else /* TEMPLATES */
2436 BITS instExit; /* instruction at exit */
2437 #endif /* TEMPLATES */
2438 #ifdef CPLUSPLUS
2439 #ifdef TEMPLATES
2440 BITS unused: 6;
2441 BITS fTemplate: 1; /* function template */
2442 BITS fExpansion: 1; /* function expansion */
2443 BITS linked : 1; /* linked with other expansions */
2444 #else /* TEMPLATES */
2445 BITS unused: 9;
2446 #endif /* TEMPLATES */
2447 BITS duplicate: 1; /* clone of another procedure */
2448 BITS overloaded:1; /* overloaded function */
2449 BITS member: 1; /* class member function */
2450 BITS constructor:1; /* constructor function */
2451 BITS destructor:1; /* destructor function */
2452 BITS Static: 1; /* static function */
2453 BITS Virtual: 1; /* virtual function */
2454 BITS constant: 1; /* constant function */
2455 BITS pure: 1; /* pure (virtual) function */
2456 BITS language: 4; /* procedure's language */
2457 BITS inlined: 1; /* function has been inlined */
2458 BITS Operator: 1; /* operator function */
2459 BITS stub: 1; /* bodyless function */
2460 #else
2461 BITS unused1: 18;
2462 BITS language: 4; /* procedure's language */
2463 BITS unused2: 3;
2464 #endif
2465 BITS optimize: 2; /* optimization level */
2466 BITS level: 5; /* nesting level (top=0) */
2467 } PDR, *pPDR;
2468
2469 /*
2470 * Module Descriptor:
2471 *
2472 * An element of the module quick reference table
2473 */
2474
2475 typedef struct MDS {
2476 long isym; /* first symbol for module */
2477 ADRT adrStart; /* adr of start of mod. */
2478 ADRT adrEnd; /* adr of end of mod. */
2479 char *sbAlias; /* alias name of module */
2480 char *sbMod; /* real name of module */
2481 BITS imports: 1; /* module have any imports? */
2482 BITS vars_in_front: 1; /* module globals in front? */
2483 BITS vars_in_gaps: 1; /* module globals in gaps? */
2484 BITS unused : 29;
2485 BITS unused2; /* space for future stuff */
2486 } MDR, *pMDR;
2487
2488
2489 /*
2490 * Paragraph Descriptor:
2491 *
2492 * An element of the paragraph quick look-up table
2493 */
2494
2495 typedef struct PGS {
2496 long isym; /* first symbol for label */
2497 ADRT adrStart; /* memory adr of start of label */
2498 ADRT adrEnd; /* memory adr of end of label */
2499 char *sbLab; /* name of label */
2500 BITS inst; /* Used in xdb to store inst @ bp */
2501 BITS sect: 1; /* true = section, false = parag. */
2502 BITS unused: 31; /* future use */
2503 } PGR, *pPGR;
2504
2505 #ifdef CPLUSPLUS
2506 /*
2507 * Class Descriptor:
2508 *
2509 * An element of the class quick look-up table
2510 */
2511
2512 typedef struct CDS {
2513 char *sbClass; /* name of class */
2514 long isym; /* class symbol (tag) */
2515 BITS type : 2; /* 0=class, 1=union, 2=struct */
2516 #ifdef TEMPLATES
2517 BITS fTemplate : 1;/* class template */
2518 BITS expansion : 1;/* template expansion */
2519 BITS unused :28;
2520 #else /* TEMPLATES */
2521 BITS unused : 30;
2522 #endif /* TEMPLATES */
2523 SLTPOINTER lowscope; /* beginning of defined scope */
2524 SLTPOINTER hiscope; /* end of defined scope */
2525 } CDR, *pCDR;
2526
2527 /*
2528 * Address Alias Entry
2529 *
2530 * An element of the address alias quick look-up table
2531 */
2532
2533 typedef struct AAS {
2534 ADRT low;
2535 ADRT high;
2536 int index;
2537 BITS unused : 31;
2538 BITS alternate : 1; /* alternate unnamed aliases? */
2539 } AAR, *pAAR;
2540
2541 /*
2542 * Object Identification Entry
2543 *
2544 * An element of the object identification quick look-up table
2545 */
2546
2547 typedef struct OIS {
2548 ADRT obj_ident; /* class identifier */
2549 long isym; /* class symbol */
2550 long offset; /* offset to object start */
2551 } OIR, *pOIR;
2552
2553 #endif /*CPLUSPLUS*/
2554
2555 #if __cplusplus
2556 #undef public
2557 #endif
2558
2559 #endif /* _SYMTAB_INCLUDED */
This page took 0.124682 seconds and 4 git commands to generate.