2 /* Apollo object module DST (debug symbol table) description */
7 #if defined(apollo) && !defined(__GNUC__)
8 #define ALIGNED1 __attribute( (aligned(1)) )
10 /* Remove attribute directives from non-Apollo code: */
11 #define ALIGNED1 /* nil */
16 /* Identification of this version of the debug symbol table. Producers of the
17 debug symbol table must write these values into the version number field of
18 the compilation unit record in .blocks .
20 #define dst_version_major 1
21 #define dst_version_minor 3
25 ** Enumeration of debug record types appearing in .blocks and .symbols ...
30 dst_typ_comp_unit
, /* 1 */
31 dst_typ_section_tab
, /* 2 */
32 dst_typ_file_tab
, /* 3 */
33 dst_typ_block
, /* 4 */
36 dst_typ_pointer
, /* 7 */
37 dst_typ_array
, /* 8 */
38 dst_typ_subrange
, /* 9 */
40 dst_typ_implicit_enum
, /* 11 */
41 dst_typ_explicit_enum
, /* 12 */
42 dst_typ_short_rec
, /* 13 */
44 dst_typ_short_union
, /* 15 */
46 dst_typ_file
, /* 17 */
47 dst_typ_offset
, /* 18 */
48 dst_typ_alias
, /* 19 */
49 dst_typ_signature
, /* 20 */
51 dst_typ_old_label
, /* 22 */
52 dst_typ_scope
, /* 23 */
53 dst_typ_end_scope
, /* 24 */
56 dst_typ_string_tab
, /* 27 */
57 dst_typ_global_name_tab
, /* 28 */
58 dst_typ_forward
, /* 29 */
59 dst_typ_aux_size
, /* 30 */
60 dst_typ_aux_align
, /* 31 */
61 dst_typ_aux_field_size
, /* 32 */
62 dst_typ_aux_field_off
, /* 33 */
63 dst_typ_aux_field_align
, /* 34 */
64 dst_typ_aux_qual
, /* 35 */
65 dst_typ_aux_var_bound
, /* 36 */
66 dst_typ_extension
, /* 37 */
67 dst_typ_string
, /* 38 */
69 dst_typ_const
, /* 40 */
70 dst_typ_reference
, /* 41 */
71 dst_typ_record
, /* 42 */
72 dst_typ_union
, /* 43 */
73 dst_typ_aux_type_deriv
, /* 44 */
74 dst_typ_locpool
, /* 45 */
75 dst_typ_variable
, /* 46 */
76 dst_typ_label
, /* 47 */
77 dst_typ_entry
, /* 48 */
78 dst_typ_aux_lifetime
, /* 49 */
79 dst_typ_aux_ptr_base
, /* 50 */
80 dst_typ_aux_src_range
, /* 51 */
81 dst_typ_aux_reg_val
, /* 52 */
82 dst_typ_aux_unit_names
, /* 53 */
83 dst_typ_aux_sect_info
, /* 54 */
90 ** Dummy bounds for variably dimensioned arrays:
92 #define dst_dummy_array_size 100
96 ** Reference to another item in the symbol table.
98 ** The value of a dst_rel_offset_t is the relative offset from the start of the
99 ** referencing record to the start of the referenced record, string, etc.
101 ** The value of a NIL dst_rel_offset_t is zero.
104 typedef long dst_rel_offset_t ALIGNED1
;
107 /* FIXME: Here and many places we make assumptions about sizes of host
108 data types, structure layout, etc. Only needs to be fixed if we care
109 about cross-debugging, though. */
112 ** Section-relative reference.
114 ** The section index field is an index into the local compilation unit's
115 ** section table (see dst_rec_section_tab_t)--NOT into the object module
118 ** The sect_offset field is the offset in bytes into the section.
120 ** A NIL dst_sect_ref_t has a sect_index field of zero. Indexes originate
126 unsigned short sect_index
;
127 unsigned long sect_offset ALIGNED1
;
131 #define dst_sect_index_nil 0
132 #define dst_sect_index_origin 1
136 ** Source location descriptor.
138 ** The file_index field is an index into the local compilation unit's
139 ** file table (see dst_rec_file_tab_t).
141 ** A NIL dst_src_loc_t has a file_index field of zero. Indexes originate
147 boolean reserved
: 1; /* reserved for future use */
148 int file_index
: 11; /* index into .blocks source file list */
149 int line_number
: 20; /* source line number */
153 #define dst_file_index_nil 0
154 #define dst_file_index_origin 1
158 ** Standard (primitive) type codes.
164 dst_int8_type
, /* 8 bit integer */
165 dst_int16_type
, /* 16 bit integer */
166 dst_int32_type
, /* 32 bit integer */
167 dst_uint8_type
, /* 8 bit unsigned integer */
168 dst_uint16_type
, /* 16 bit unsigned integer */
169 dst_uint32_type
, /* 32 bit unsigned integer */
170 dst_real32_type
, /* single precision ieee floatining point */
171 dst_real64_type
, /* double precision ieee floatining point */
172 dst_complex_type
, /* single precision complex */
173 dst_dcomplex_type
, /* double precision complex */
174 dst_bool8_type
, /* boolean =logical*1 */
175 dst_bool16_type
, /* boolean =logical*2 */
176 dst_bool32_type
, /* boolean =logical*4 */
177 dst_char_type
, /* 8 bit ascii character */
178 dst_string_type
, /* string of 8 bit ascii characters */
179 dst_ptr_type
, /* univ_pointer */
180 dst_set_type
, /* generic 256 bit set */
181 dst_proc_type
, /* generic procedure (signature not specified) */
182 dst_func_type
, /* generic function (signature not specified) */
183 dst_void_type
, /* c void type */
184 dst_uchar_type
, /* c unsigned char */
185 dst_std_type_END_OF_ENUM
191 ** General data type descriptor
193 ** If the user_defined_type bit is clear, then the type is a standard type, and
194 ** the remaining bits contain the dst_std_type_t of the type. If the bit is
195 ** set, then the type is defined in a separate dst record, which is referenced
196 ** by the remaining bits as a dst_rel_offset_t.
203 boolean user_defined_type
: 1; /* tag field */
204 int must_be_zero
: 23; /* 23 bits of pad */
205 dst_std_type_t dtc
: 8; /* 8 bit primitive data */
211 boolean user_defined_type
: 1; /* tag field */
212 int doffset
: 31; /* offset to type record */
218 /* The user_type.doffset field is a 31-bit signed value. Some versions of C
219 do not support signed bit fields. The following macro will extract that
220 field as a signed value:
222 #define dst_user_type_offset(type_rec) \
223 ( ((int) ((type_rec).user_type.doffset << 1)) >> 1 )
226 /*================================================*/
227 /*========== RECORDS IN .blocks SECTION ==========*/
228 /*================================================*/
230 /*-----------------------
231 COMPILATION UNIT record
232 -----------------------
233 This must be the first record in each .blocks section.
234 Provides a set of information describing the output of a single compilation
235 and pointers to additional information for the compilation unit.
240 dst_pc_code_locs
, /* ranges in loc strings are pc ranges */
241 dst_comp_unit_END_OF_ENUM
243 dst_comp_unit_flag_t
;
247 dst_lang_unk
, /* unknown language */
248 dst_lang_pas
, /* Pascal */
249 dst_lang_ftn
, /* FORTRAN */
251 dst_lang_mod2
, /* Modula-2 */
252 dst_lang_asm_m68k
, /* 68K assembly language */
253 dst_lang_asm_a88k
, /* AT assembly language */
254 dst_lang_ada
, /* Ada */
255 dst_lang_cxx
, /* C++ */
264 unsigned char major_part
; /* = dst_version_major */
265 unsigned char minor_part
; /* = dst_version_minor */
267 version
; /* version of dst */
268 unsigned short flags
; /* mask of dst_comp_unit_flag_t */
269 unsigned short lang_type
; /* source language */
270 unsigned short number_of_blocks
; /* number of blocks records */
271 dst_rel_offset_t root_block_offset
; /* offset to root block (module?) */
272 dst_rel_offset_t section_table
/* offset to section table record */;
273 dst_rel_offset_t file_table
; /* offset to file table record */
274 unsigned long data_size
; /* total size of .blocks data */
276 dst_rec_comp_unit_t ALIGNED1
;
279 /*--------------------
282 There must be one section table associated with each compilation unit.
283 Other debug records refer to sections via their index in this table. The
284 section base addresses in the table are virtual addresses of the sections,
285 relocated by the linker.
290 unsigned short number_of_sections
; /* size of array: */
291 unsigned long section_base
[dst_dummy_array_size
] ALIGNED1
;
293 dst_rec_section_tab_t ALIGNED1
;
299 There must be one file table associated with each compilation unit describing
300 the source (and include) files used by each compilation unit. Other debug
301 records refer to files via their index in this table. The first entry is the
307 long dtm
; /* time last modified (time_$clock_t) */
308 dst_rel_offset_t noffset
; /* offset to name string for source file */
314 unsigned short number_of_files
; /* size of array: */
315 dst_file_desc_t files
[dst_dummy_array_size
] ALIGNED1
;
317 dst_rec_file_tab_t ALIGNED1
;
323 A name table record may appear as an auxiliary record to the file table,
324 providing additional qualification of the file indexes for languages that
325 need it (i.e. Ada). Name table entries parallel file table entries of the
331 unsigned short number_of_names
; /* size of array: */
332 dst_rel_offset_t names
[dst_dummy_array_size
] ALIGNED1
;
334 dst_rec_name_tab_t ALIGNED1
;
340 Describes a lexical program block--a procedure, function, module, etc.
343 /* Block types. These may be used in any way desired by the compiler writers.
344 The debugger uses them only to give a description to the user of the type of
345 a block. The debugger makes no other assumptions about the meaning of any
346 of these. For example, the fact that a block is executable (e.g., program)
347 or not (e.g., module) is expressed in block attributes (see below), not
348 guessed at from the block type.
352 dst_block_module
, /* some pascal = modula = ada types */
355 dst_block_function
, /* C function */
356 dst_block_subroutine
, /* some fortran block types */
357 dst_block_block_data
,
358 dst_block_stmt_function
,
359 dst_block_package
, /* a few particular to Ada */
360 dst_block_package_body
,
363 dst_block_file
, /* a C outer scope? */
364 dst_block_class
, /* C++ or Simula */
365 dst_block_END_OF_ENUM
369 /* Block attributes. This is the information used by the debugger to represent
370 the semantics of blocks.
374 dst_block_main_entry
, /* the block's entry point is a main entry into
375 the compilation unit */
376 dst_block_executable
, /* the block has an entry point */
377 dst_block_attr_END_OF_ENUM
381 /* Code range. Each block has associated with it one or more code ranges. An
382 individual code range is identified by a range of source (possibly nil) and
383 a range of executable code. For example, a block which has its executable
384 code spread over multiple sections will have one code range per section.
388 unsigned long code_size
; /* size of executable code (in bytes ) */
389 dst_sect_ref_t code_start
; /* starting address of executable code */
390 dst_sect_ref_t lines_start
; /* start of line number tables */
396 dst_block_type_t block_type
: 8;
397 unsigned short flags
: 8; /* mask of dst_block_attr_t flags */
398 dst_rel_offset_t sibling_block_off
; /* offset to next sibling block */
399 dst_rel_offset_t child_block_off
; /* offset to first contained block */
400 dst_rel_offset_t noffset
; /* offset to block name string */
401 dst_sect_ref_t symbols_start
; /* start of debug symbols */
402 unsigned short n_of_code_ranges
; /* size of array... */
403 dst_code_range_t code_ranges
[dst_dummy_array_size
] ALIGNED1
;
405 dst_rec_block_t ALIGNED1
;
408 /*--------------------------
409 AUX SECT INFO TABLE record
410 --------------------------
411 Appears as an auxiliary to a block record. Expands code range information
412 by providing references into additional, language-dependent sections for
413 information related to specific code ranges of the block. Sect info table
414 entries parallel code range array entries of the same index.
419 unsigned char tag
; /* currently can only be zero */
420 unsigned char number_of_refs
; /* size of array: */
421 dst_sect_ref_t refs
[dst_dummy_array_size
] ALIGNED1
;
423 dst_rec_sect_info_tab_t ALIGNED1
;
425 /*=================================================*/
426 /*========== RECORDS IN .symbols SECTION ==========*/
427 /*=================================================*/
432 Describes a symbolic constant.
437 float r
; /* real part */
438 float i
; /* imaginary part */
444 double dr
; /* real part */
445 double di
; /* imaginary part */
447 dst_double_complex_t
;
449 /* The following record provides a way of describing constant values with
450 non-standard type and no limit on size.
454 char char_data
[dst_dummy_array_size
];
455 short int_data
[dst_dummy_array_size
];
456 long long_data
[dst_dummy_array_size
];
460 /* Representation of the value of a general constant.
464 unsigned short length
; /* size of constant value (bytes) */
468 unsigned short kon_int8
;
470 long kon_int32 ALIGNED1
;
471 float kon_real ALIGNED1
;
472 double kon_dbl ALIGNED1
;
473 dst_complex_t kon_cplx ALIGNED1
;
474 dst_double_complex_t kon_dcplx ALIGNED1
;
476 dst_big_kon_t kon ALIGNED1
;
478 val
; /* value data of constant */
480 dst_const_t ALIGNED1
;
484 dst_rel_offset_t noffset
; /* offset to name string */
485 dst_src_loc_t src_loc
; /* file/line of const definition */
486 dst_type_t type_desc
; /* type of this (manifest) constant */
489 dst_rec_const_t ALIGNED1
;
494 Describes a program variable.
497 /* Variable attributes. These define certain variable semantics to the
502 dst_var_attr_read_only
, /* is read-only (a program literal) */
503 dst_var_attr_volatile
, /* same as compiler's VOLATILE attribute */
504 dst_var_attr_global
, /* is a global definition or reference */
505 dst_var_attr_compiler_gen
, /* is compiler-generated */
506 dst_var_attr_static
, /* has static location */
507 dst_var_attr_END_OF_ENUM
513 dst_rel_offset_t noffset
; /* offset to name string */
514 dst_rel_offset_t loffset
; /* offset to loc string */
515 dst_src_loc_t src_loc
; /* file/line of variable definition */
516 dst_type_t type_desc
; /* type descriptor */
517 unsigned short attributes
; /* mask of dst_var_attr_t flags */
519 dst_rec_variable_t ALIGNED1
;
525 Used by older compilers to describe a variable
530 dst_var_loc_unknown
, /* Actually defined as "unknown" */
531 dst_var_loc_abs
, /* Absolute address */
532 dst_var_loc_sect_off
, /* Absolute address as a section offset */
533 dst_var_loc_ind_sect_off
, /* An indexed section offset ???? */
534 dst_var_loc_reg
, /* register */
535 dst_var_loc_reg_rel
, /* register relative - usually fp */
536 dst_var_loc_ind_reg_rel
, /* Indexed register relative */
537 dst_var_loc_ftn_ptr_based
, /* Fortran pointer based */
538 dst_var_loc_pc_rel
, /* PC relative. Really. */
539 dst_var_loc_external
, /* External */
540 dst_var_loc_END_OF_ENUM
544 /* Locations come in two versions. The sort, and the long. The difference
545 * between the short and the long is the addition of a statement number
546 * field to the start andend of the range of the long, and and unkown
547 * purpose field in the middle. Also, loc_type and loc_index aren't
548 * bitfields in the long version.
553 unsigned short loc_type
: 4;
554 unsigned short loc_index
: 12;
556 short start_line
; /* start_line and end_line? */
557 short end_line
; /* I'm guessing here. */
558 } dst_var_loc_short_t
;
562 unsigned short loc_type
;
563 unsigned short loc_index
;
565 short unknown
; /* Always 0003 or 3b3c. Why? */
566 short start_statement
;
570 } dst_var_loc_long_t
;
575 dst_rel_offset_t noffset
; /* offset to name string */
576 dst_src_loc_t src_loc
; /* file/line of description */
577 dst_type_t type_desc
; /* Type description */
578 unsigned short attributes
; /* mask of dst_var_attr_t flags */
579 unsigned short no_of_locs
: 15;/* Number of locations */
580 unsigned short short_locs
: 1; /* True if short locations. */
583 dst_var_loc_short_t shorts
[dst_dummy_array_size
];
584 dst_var_loc_long_t longs
[dst_dummy_array_size
];
591 Used by older compilers to describe a label
596 dst_rel_offset_t noffset
; /* offset to name string */
597 dst_src_loc_t src_loc
; /* file/line of description */
598 char location
[12]; /* location string */
600 dst_rec_old_label_t ALIGNED1
;
605 Describes a pointer type.
610 dst_rel_offset_t noffset
; /* offset to the name string for this type */
611 dst_src_loc_t src_loc
; /* file/line of definition */
612 dst_type_t type_desc
; /* base type of this pointer */
614 dst_rec_pointer_t ALIGNED1
;
620 Describes an array type.
622 Multidimensional arrays are described with a number of dst_rec_array_t
623 records, one per array dimension, each linked to the next through the
624 elem_type_desc.doffset field. Each record must have its multi_dim flag
627 If column_major is true (as with FORTRAN arrays) then the last array bound in
628 the declaration is the first array index in memory, which is the opposite of
629 the usual case (as with Pascal and C arrays).
631 Variable array bounds are described by auxiliary records; if aux_var_bound
632 records are present, the lo_bound and hi_bound fields of this record are
633 ignored by the debugger.
635 span_comp identifies one of the language-dependent ways in which the distance
636 between successive array elements (span) is calculated.
637 dst_use_span_field -- the span is the value of span field.
638 dst_compute_from_prev -- the span is the size of the previous dimension.
639 dst_compute_from_next -- the span is the size of the next dimension.
640 In the latter two cases, the span field contains an amount of padding to add
641 to the size of the appropriate dimension to calculate the span.
647 dst_compute_from_prev
,
648 dst_compute_from_next
,
649 dst_span_comp_END_OF_ENUM
655 dst_rel_offset_t noffset
; /* offset to name string */
656 dst_src_loc_t src_loc
; /* file/line of definition */
657 dst_type_t elem_type_desc
; /* array element type */
658 dst_type_t indx_type_desc
; /* array index type */
659 long lo_bound
; /* lower bound of index */
660 long hi_bound
; /* upper bound of index */
661 unsigned long span
; /* see above */
662 unsigned long size
; /* total array size (bytes) */
663 boolean multi_dim
: 1;
664 boolean is_packed
: 1; /* true if packed array */
665 boolean is_signed
: 1; /* true if packed elements are signed */
666 dst_span_comp_t span_comp
: 2; /* how to compute span */
667 boolean column_major
: 1;
668 unsigned short reserved
: 2; /* must be zero */
669 unsigned short elem_size
: 8; /* element size if packed (bits) */
671 dst_rec_array_t ALIGNED1
;
677 Describes a subrange type.
680 /* Variable subrange bounds are described by auxiliary records; if aux_var_bound
681 records are present, the lo_bound and hi_bound fields of this record are
682 ignored by the debugger.
687 dst_rel_offset_t noffset
; /* offset to name string */
688 dst_src_loc_t src_loc
; /* file/line of subrange definition */
689 dst_type_t type_desc
; /* parent type */
690 long lo_bound
; /* lower bound of subrange */
691 long hi_bound
; /* upper bound of subrange */
692 unsigned short size
; /* storage size (bytes) */
694 dst_rec_subrange_t ALIGNED1
;
700 Describes a string type.
703 /* Variable subrange bounds are described by auxiliary records; if aux_var_bound
704 records are present, the lo_bound and hi_bound fields of this record are
705 ignored by the debugger.
710 dst_rel_offset_t noffset
; /* offset to name string */
711 dst_src_loc_t src_loc
; /* file/line of string definition */
712 dst_type_t elem_type_desc
; /* element type */
713 dst_type_t indx_type_desc
; /* index type */
714 long lo_bound
; /* lower bound */
715 long hi_bound
; /* upper bound */
716 unsigned long size
; /* total string size (bytes) if fixed */
718 dst_rec_string_t ALIGNED1
;
724 Describes a set type.
729 dst_rel_offset_t noffset
; /* offset to name string */
730 dst_src_loc_t src_loc
; /* file/line of definition */
731 dst_type_t type_desc
; /* element type */
732 unsigned short nbits
; /* number of bits in set */
733 unsigned short size
; /* storage size (bytes) */
735 dst_rec_set_t ALIGNED1
;
738 /*-----------------------------
739 IMPLICIT ENUMERATION record
740 -----------------------------
741 Describes an enumeration type with implicit element values = 0, 1, 2, ...
747 dst_rel_offset_t noffset
; /* offset to name string */
748 dst_src_loc_t src_loc
; /* file/line of definition */
749 unsigned short nelems
; /* number of elements in enumeration */
750 unsigned short size
; /* storage size (bytes) */
751 /* offsets to name strings of elements 0, 1, 2, ... */
752 dst_rel_offset_t elem_noffsets
[dst_dummy_array_size
];
754 dst_rec_implicit_enum_t ALIGNED1
;
757 /*-----------------------------
758 EXPLICIT ENUMERATION record
759 -----------------------------
760 Describes an enumeration type with explicitly assigned element values
766 dst_rel_offset_t noffset
; /* offset to element name string */
767 long value
; /* element value */
773 dst_rel_offset_t noffset
; /* offset to name string */
774 dst_src_loc_t src_loc
; /* file/line of definition */
775 unsigned short nelems
; /* number of elements in enumeration */
776 unsigned short size
; /* storage size (bytes) */
777 /* name/value pairs, one describing each enumeration value: */
778 dst_enum_elem_t elems
[dst_dummy_array_size
];
780 dst_rec_explicit_enum_t ALIGNED1
;
783 /*-----------------------
784 RECORD / UNION record
785 -----------------------
786 Describes a record (struct) or union.
788 If the record is larger than 2**16 bytes then an attached aux record
789 specifies its size. Also, if the record is stored in short form then
790 attached records specify field offsets larger than 2**16 bytes.
792 Whether the fields[] array or sfields[] array is used is selected by
793 the dst_rec_type_t of the overall dst record.
797 Record field descriptor, short form. This form handles only fields which
798 are an even number of bytes long, located some number of bytes from the
803 dst_rel_offset_t noffset
; /* offset to field name string */
804 dst_type_t type_desc
; /* field type */
805 unsigned short foffset
; /* field offset from start of record (bytes) */
807 dst_short_field_t ALIGNED1
;
811 dst_rel_offset_t noffset
; /* offset to name string */
812 dst_type_t type_desc
; /* field type */
813 unsigned short foffset
; /* byte offset */
814 unsigned short is_packed
: 1; /* True if field is packed */
815 unsigned short bit_offset
: 6; /* Bit offset */
816 unsigned short size
: 6; /* Size in bits */
817 unsigned short sign
: 1; /* True if signed */
818 unsigned short pad
: 2; /* Padding. Must be 0 */
820 dst_old_field_t ALIGNED1
;
822 /* Tag enumeration for long record field descriptor:
829 dst_field_END_OF_ENUM
834 Record field descriptor, long form. The format of the field information
835 is identified by the format_tag, which contains one of the above values.
836 The field_byte variant is equivalent to the short form of field descriptor.
837 The field_bit variant handles fields which are any number of bits long,
838 located some number of bits from the start of the record. The field_loc
839 variant allows the location of the field to be described by a general loc
844 dst_rel_offset_t noffset
; /* offset to name of field */
845 dst_type_t type_desc
; /* type of field */
849 dst_field_format_t format_tag
: 2; /* dst_field_byte */
850 unsigned long offset
: 30; /* offset of field in bytes */
854 dst_field_format_t format_tag
: 2; /* dst_field_bit */
855 unsigned long nbits
: 6; /* bit size of field */
856 unsigned long is_signed
: 1; /* signed/unsigned attribute */
857 unsigned long bit_offset
: 3; /* bit offset from byte boundary */
858 int pad
: 4; /* must be zero */
859 unsigned short byte_offset
; /* offset of byte boundary */
863 dst_field_format_t format_tag
: 2; /* dst_field_loc */
864 int loffset
: 30; /* dst_rel_offset_t to loc string */
872 /* The field_loc.loffset field is a 30-bit signed value. Some versions of C do
873 not support signed bit fields. The following macro will extract that field
876 #define dst_field_loffset(field_rec) \
877 ( ((int) ((field_rec).f.field_loc.loffset << 2)) >> 2 )
882 dst_rel_offset_t noffset
; /* offset to record name string */
883 dst_src_loc_t src_loc
; /* file/line where this record is defined */
884 unsigned short size
; /* storage size (bytes) */
885 unsigned short nfields
; /* number of fields in this record */
888 dst_field_t fields
[dst_dummy_array_size
];
889 dst_short_field_t sfields
[dst_dummy_array_size
];
890 dst_old_field_t ofields
[dst_dummy_array_size
];
892 f
; /* array of fields */
894 dst_rec_record_t ALIGNED1
;
900 Describes a file type.
905 dst_rel_offset_t noffset
; /* offset to name string */
906 dst_src_loc_t src_loc
; /* file/line where type was defined */
907 dst_type_t type_desc
; /* file element type */
909 dst_rec_file_t ALIGNED1
;
915 Describes a Pascal offset type.
916 (This type, an undocumented Domain Pascal extension, is currently not
917 supported by the debugger)
922 dst_rel_offset_t noffset
; /* offset to the name string */
923 dst_src_loc_t src_loc
; /* file/line of definition */
924 dst_type_t area_type_desc
; /* area type */
925 dst_type_t base_type_desc
; /* base type */
926 long lo_bound
; /* low bound of the offset range */
927 long hi_bound
; /* high bound of the offset range */
928 long bias
; /* bias */
929 unsigned short scale
; /* scale factor */
930 unsigned short size
; /* storage size (bytes) */
932 dst_rec_offset_t ALIGNED1
;
938 Describes a type alias (e.g., typedef).
943 dst_rel_offset_t noffset
; /* offset to name string */
944 dst_src_loc_t src_loc
; /* file/line of definition */
945 dst_type_t type_desc
; /* parent type */
947 dst_rec_alias_t ALIGNED1
;
953 Describes a procedure/function type.
956 /* Enumeration of argument semantics. Note that most are mutually
961 dst_arg_attr_val
, /* passed by value */
962 dst_arg_attr_ref
, /* passed by reference */
963 dst_arg_attr_name
, /* passed by name */
964 dst_arg_attr_in
, /* readable in the callee */
965 dst_arg_attr_out
, /* writable in the callee */
966 dst_arg_attr_hidden
, /* not visible in the caller */
967 dst_arg_attr_END_OF_ENUM
971 /* Argument descriptor. Actually points to a variable record for most of the
976 dst_rel_offset_t var_offset
; /* offset to variable record */
977 unsigned short attributes
; /* a mask of dst_arg_attr_t flags */
983 dst_rel_offset_t noffset
; /* offset to name string */
984 dst_src_loc_t src_loc
; /* file/line of function definition */
985 dst_rel_offset_t result
; /* offset to function result variable record */
986 unsigned short nargs
; /* number of arguments */
987 dst_arg_t args
[dst_dummy_array_size
];
989 dst_rec_signature_t ALIGNED1
;
994 Obsolete. Use the new ENTRY type instead.
995 Old compilers may put this in as the first entry in a function,
996 terminated by an end of scope entry.
1001 dst_rel_offset_t noffset
; /* Name offset */
1002 dst_src_loc_t start_line
; /* Starting line */
1003 dst_src_loc_t end_line
; /* Ending line */
1005 dst_rec_scope_t ALIGNED1
;
1010 Describes a procedure/function entry point. An entry record is to a
1011 signature record roughly as a variable record is to a type descriptor record.
1013 The entry_number field is keyed to the entry numbers in .lines -- the
1014 debugger locates the code location of an entry by searching the line
1015 number table for an entry numbered with the value of entry_number. The
1016 main entry is numbered zero.
1021 dst_rel_offset_t noffset
; /* offset to entry name string */
1022 dst_rel_offset_t loffset
; /* where to jump to call this entry */
1023 dst_src_loc_t src_loc
; /* file/line of definition */
1024 dst_rel_offset_t sig_desc
; /* offset to signature descriptor */
1025 unsigned int entry_number
: 8;
1026 int pad
: 8; /* must be zero */
1028 dst_rec_entry_t ALIGNED1
;
1030 /*-----------------------
1031 Old format ENTRY record
1032 -----------------------
1033 Supposedly obsolete but still used by some compilers.
1038 dst_rel_offset_t noffset
; /* Offset to entry name string */
1039 dst_src_loc_t src_loc
; /* Location in source */
1040 dst_rel_offset_t sig_desc
; /* Signature description */
1043 dst_rec_old_entry_t ALIGNED1
;
1048 Describes a program label.
1053 dst_rel_offset_t noffset
; /* offset to label string */
1054 dst_rel_offset_t loffset
; /* offset to loc string */
1055 dst_src_loc_t src_loc
; /* file/line of definition */
1057 dst_rec_label_t ALIGNED1
;
1060 /*-----------------------
1061 AUXILIARY SIZE record
1062 -----------------------
1063 May appear in the auxiliary record list of any type or variable record to
1064 modify the default size of the type or variable.
1069 unsigned long size
; /* size (bytes) */
1071 dst_rec_aux_size_t ALIGNED1
;
1074 /*-----------------------
1075 AUXILIARY ALIGN record
1076 -----------------------
1077 May appear in the auxiliary record list of any type or variable record to
1078 modify the default alignment of the type or variable.
1083 unsigned short alignment
; /* # of low order zero bits */
1085 dst_rec_aux_align_t ALIGNED1
;
1088 /*-----------------------------
1089 AUXILIARY FIELD SIZE record
1090 -----------------------------
1091 May appear in the auxiliary record list of any RECORD/UNION record to
1092 modify the default size of a field.
1097 unsigned short field_no
; /* field number */
1098 unsigned long size
; /* size (bits) */
1100 dst_rec_aux_field_size_t ALIGNED1
;
1104 /*-----------------------------
1105 AUXILIARY FIELD OFFSET record
1106 -----------------------------
1107 May appear in the auxiliary record list of any RECORD/UNION record to
1108 specify a field offset larger than 2**16.
1113 unsigned short field_no
; /* field number */
1114 unsigned long foffset
; /* offset */
1116 dst_rec_aux_field_off_t ALIGNED1
;
1119 /*-----------------------------
1120 AUXILIARY FIELD ALIGN record
1121 -----------------------------
1122 May appear in the auxiliary record list of any RECORD/UNION record to
1123 modify the default alignment of a field.
1128 unsigned short field_no
; /* field number */
1129 unsigned short alignment
; /* number of low order zero bits */
1131 dst_rec_aux_field_align_t ALIGNED1
;
1134 /*----------------------------
1135 AUXILIARY VAR BOUND record
1136 ----------------------------
1137 May appear in the auxiliary record list of any ARRAY, SUBRANGE or STRING
1138 record to describe a variable bound for the range of the type.
1143 dst_low_bound
, /* the low bound is variable */
1144 dst_high_bound
, /* the high bound is variable */
1145 dst_var_bound_END_OF_ENUM
1151 unsigned short which
; /* which bound */
1152 dst_rel_offset_t voffset ALIGNED1
; /* variable that defines bound */
1154 dst_rec_aux_var_bound_t ALIGNED1
;
1157 /*----------------------------------
1158 AUXILIARY TYPE DERIVATION record
1159 ----------------------------------
1160 May appear in the auxiliary record list of any RECORD/UNION record to denote
1161 class inheritance of that type from a parent type.
1163 Inheritance implies that it is possible to convert the inheritor type to the
1164 inherited type, retaining those fields which were inherited. To allow this,
1165 orig_field_no, a field number into the record type, is provided. If
1166 orig_is_pointer is false, then the start of the inherited record is located
1167 at the location of the field indexed by orig_field_no. If orig_is_pointer
1168 is true, then it is located at the address contained in the field indexed
1169 by orig_field_no (assumed to be a pointer).
1174 dst_type_t parent_type
; /* reference to inherited type */
1175 unsigned short orig_field_no
;
1176 boolean orig_is_pointer
: 1;
1177 int unused
: 15; /* must be zero */
1179 dst_rec_aux_type_deriv_t ALIGNED1
;
1182 /*------------------------------------
1183 AUXILIARY VARIABLE LIFETIME record
1184 ------------------------------------
1185 May appear in the auxiliary record list of a VARIABLE record to add location
1186 information for an additional variable lifetime.
1191 dst_rel_offset_t loffset
;
1193 dst_rec_aux_lifetime_t ALIGNED1
;
1196 /*-------------------------------
1197 AUXILIARY POINTER BASE record
1198 -------------------------------
1199 May appear in the auxiliary record list of a VARIABLE record to provide a
1200 pointer base to substitute for references to any such bases in the location
1201 string of the variable. A pointer base is another VARIABLE record. When
1202 the variable is evaluated by the debugger, it uses the current value of the
1203 pointer base variable in computing its location.
1205 This is useful for representing FORTRAN pointer-based variables.
1210 dst_rel_offset_t voffset
;
1212 dst_rec_aux_ptr_base_t ALIGNED1
;
1215 /*---------------------------------
1216 AUXILIARY REGISTER VALUE record
1217 ---------------------------------
1218 May appear in the auxiliary record list of an ENTRY record to specify
1219 a register that must be set to a specific value before jumping to the entry
1220 point in a debugger "call". The debugger must set the debuggee register,
1221 specified by the register code, to the value of the *address* to which the
1222 location string resolves. If the address is register-relative, then the
1223 call cannot be made unless the current stack frame is the lexical parent
1224 of the entry. An example of this is when a (Pascal) nested procedure
1225 contains references to its parent's variables, which it accesses through
1226 a static link register. The static link register must be set to some
1227 address relative to the parent's stack base register.
1232 unsigned short reg
; /* identifies register to set (isp enum) */
1233 dst_rel_offset_t loffset
; /* references a location string */
1235 dst_rec_aux_reg_val_t ALIGNED1
;
1238 /*==========================================================*/
1239 /*========== RECORDS USED IN .blocks AND .symbols ==========*/
1240 /*==========================================================*/
1242 /*---------------------
1244 ---------------------
1245 A string table record contains any number of null-terminated, variable length
1246 strings. The length field gives the size in bytes of the text field, which
1249 The global name table shares this format. This record appears in the
1250 .blocks section. Each string in the table identifies a global defined in
1251 the current compilation unit.
1253 The loc pool record shares this format as well. Loc strings are described
1259 unsigned long length
;
1260 char text
[dst_dummy_array_size
];
1262 dst_rec_string_tab_t ALIGNED1
;
1265 /*-----------------------
1266 AUXILIARY QUAL record
1267 -----------------------
1268 May appear in the auxiliary record list of any BLOCK, VARIABLE, or type record
1269 to provide it with a fully-qualified, language-dependent name.
1274 dst_rel_offset_t lang_qual_name
;
1276 dst_rec_aux_qual_t ALIGNED1
;
1282 Reference to a record somewhere else. This allows identical definitions in
1283 different scopes to share data.
1288 dst_rel_offset_t rec_off
;
1290 dst_rec_forward_t ALIGNED1
;
1293 /*-------------------------------
1294 AUXILIARY SOURCE RANGE record
1295 -------------------------------
1296 May appear in the auxiliary record list of any BLOCK record to specify a
1297 range of source lines over which the block is active.
1302 dst_src_loc_t first_line
; /* first source line */
1303 dst_src_loc_t last_line
; /* last source line */
1305 dst_rec_aux_src_range_t ALIGNED1
;
1308 /*------------------
1311 Provision for "foreign" records, such as might be generated by a non-Apollo
1312 compiler. Apollo software will ignore these.
1317 unsigned short rec_size
; /* record size (bytes) */
1318 unsigned short ext_type
; /* defined by whoever generates it */
1319 unsigned short ext_data
; /* place-holder for arbitrary amount of data */
1321 dst_rec_extension_t ALIGNED1
;
1325 ** DEBUG SYMBOL record -- The wrapper for all .blocks and .symbols records.
1327 ** This record ties together all previous .blocks and .symbols records
1328 ** together in a union with a common header. The rec_type field of the
1329 ** header identifies the record type. The rec_flags field currently only
1330 ** defines auxiliary record lists.
1332 ** If a record carries with it a non-null auxiliary record list, its
1333 ** dst_flag_has_aux_recs flag is set, and each of the records that follow
1334 ** it are treated as its auxiliary records, until the end of the compilation
1335 ** unit or scope is reached, or until an auxiliary record with its
1336 ** dst_flag_last_aux_rec flag set is reached.
1341 dst_flag_has_aux_recs
,
1342 dst_flag_last_aux_rec
,
1343 dst_rec_flag_END_OF_ENUM
1349 dst_rec_type_t rec_type
: 8; /* record type */
1350 int rec_flags
: 8; /* mask of dst_rec_flags_t */
1351 union /* switched on rec_type field above */
1353 /* dst_typ_pad requires no additional fields */
1354 dst_rec_comp_unit_t comp_unit_
;
1355 dst_rec_section_tab_t section_tab_
;
1356 dst_rec_file_tab_t file_tab_
;
1357 dst_rec_block_t block_
;
1359 dst_rec_pointer_t pointer_
;
1360 dst_rec_array_t array_
;
1361 dst_rec_subrange_t subrange_
;
1363 dst_rec_implicit_enum_t implicit_enum_
;
1364 dst_rec_explicit_enum_t explicit_enum_
;
1365 /* dst_typ_short_{rec,union} are represented by 'rec' (below) */
1366 dst_rec_file_t file_
;
1367 dst_rec_offset_t offset_
;
1368 dst_rec_alias_t alias_
;
1369 dst_rec_signature_t signature_
;
1370 dst_rec_old_label_t old_label_
;
1371 dst_rec_scope_t scope_
;
1372 /* dst_typ_end_scope requires no additional fields */
1373 dst_rec_string_tab_t string_tab_
;
1374 /* dst_typ_global_name_tab is represented by 'string_tab' (above) */
1375 dst_rec_forward_t forward_
;
1376 dst_rec_aux_size_t aux_size_
;
1377 dst_rec_aux_align_t aux_align_
;
1378 dst_rec_aux_field_size_t aux_field_size_
;
1379 dst_rec_aux_field_off_t aux_field_off_
;
1380 dst_rec_aux_field_align_t aux_field_align_
;
1381 dst_rec_aux_qual_t aux_qual_
;
1382 dst_rec_aux_var_bound_t aux_var_bound_
;
1383 dst_rec_extension_t extension_
;
1384 dst_rec_string_t string_
;
1385 dst_rec_const_t const_
;
1386 /* dst_typ_reference is represented by 'pointer' (above) */
1387 dst_rec_record_t record_
;
1388 /* dst_typ_union is represented by 'record' (above) */
1389 dst_rec_aux_type_deriv_t aux_type_deriv_
;
1390 /* dst_typ_locpool is represented by 'string_tab' (above) */
1391 dst_rec_variable_t variable_
;
1392 dst_rec_label_t label_
;
1393 dst_rec_entry_t entry_
;
1394 dst_rec_aux_lifetime_t aux_lifetime_
;
1395 dst_rec_aux_ptr_base_t aux_ptr_base_
;
1396 dst_rec_aux_src_range_t aux_src_range_
;
1397 dst_rec_aux_reg_val_t aux_reg_val_
;
1398 dst_rec_name_tab_t aux_unit_names_
;
1399 dst_rec_sect_info_tab_t aux_sect_info_
;
1403 dst_rec_t
, *dst_rec_ptr_t
;
1406 /*===============================================*/
1407 /*========== .lines SECTION DEFINITIONS =========*/
1408 /*===============================================*/
1410 The .lines section contains a sequence of line number tables. There is no
1411 record structure within the section. The start of the table for a routine
1412 is pointed to by the block record, and the end of the table is signaled by
1415 A line number table is a sequence of bytes. The default entry contains a line
1416 number delta (-7..+7) in the high 4 bits and a pc delta (0..15) in the low 4
1417 bits. Special cases, including when one or both of the values is too large
1418 to fit in 4 bits and other special cases are handled through escape entries.
1419 Escape entries are identified by the value 0x8 in the high 4 bits. The low 4
1420 bits are occupied by a function code. Some escape entries are followed by
1421 additional arguments, which may be bytes, words, or longwords. This data is
1424 The initial PC offset, file number and line number are zero. Normally, the
1425 table begins with a dst_ln_file escape which establishes the initial file
1426 and line number. All PC deltas are unsigned (thus the table is ordered by
1427 increasing PC); line number deltas are signed. The table ends with a
1428 dst_ln_end escape, which is followed by a final table entry whose PC delta
1429 gives the code size of the last statement.
1432 --------- ------------------------------------------------------------
1433 file Changes file state. The current source file remains constant
1434 until another file escape. Though the line number state is
1435 also updated by a file escape, a file escape does NOT
1436 constitute a line table entry.
1438 statement Alters the statement number of the next table entry. By
1439 default, all table entries refer to the first statement on a
1440 line. Statement number one is the second statement, and so on.
1442 entry Identifies the next table entry as the position of an entry
1443 point for the current block. The PC position should follow
1444 any procedure prologue code. An argument specifies the entry
1445 number, which is keyed to the entry number of the corresponding
1446 .symbols ENTRY record.
1448 exit Identifies the next table entry as the last position within
1449 the current block before a procedure epiloge and subsequent
1452 gap By default, the executable code corresponding to a table entry
1453 is assumed to extend to the beginning of the next table entry.
1454 If this is not the case--there is a "hole" in the table--then
1455 a gap escape should follow the first table entry to specify
1456 where the code for that entry ends.
1459 #define dst_ln_escape_flag -8
1462 Escape function codes:
1466 dst_ln_pad
, /* pad byte */
1467 dst_ln_file
, /* file escape. Next 4 bytes are a dst_src_loc_t */
1468 dst_ln_dln1_dpc1
, /* 1 byte line delta, 1 byte pc delta */
1469 dst_ln_dln2_dpc2
, /* 2 bytes line delta, 2 bytes pc delta */
1470 dst_ln_ln4_pc4
, /* 4 bytes ABSOLUTE line number, 4 bytes ABSOLUTE pc */
1471 dst_ln_dln1_dpc0
, /* 1 byte line delta, pc delta = 0 */
1472 dst_ln_ln_off_1
, /* statement escape, stmt # = 1 (2nd stmt on line) */
1473 dst_ln_ln_off
, /* statement escape, stmt # = next byte */
1474 dst_ln_entry
, /* entry escape, next byte is entry number */
1475 dst_ln_exit
, /* exit escape */
1476 dst_ln_stmt_end
, /* gap escape, 4 bytes pc delta */
1477 dst_ln_escape_11
, /* reserved */
1478 dst_ln_escape_12
, /* reserved */
1479 dst_ln_escape_13
, /* reserved */
1480 dst_ln_nxt_byte
, /* next byte contains the real escape code */
1481 dst_ln_end
, /* end escape, final entry follows */
1482 dst_ln_escape_END_OF_ENUM
1487 Line number table entry
1493 unsigned int ln_delta
: 4; /* 4 bit line number delta */
1494 unsigned int pc_delta
: 4; /* 4 bit pc delta */
1500 unsigned int esc_flag
: 4; /* alias for ln_delta */
1501 dst_ln_escape_t esc_code
: 4; /* escape function code */
1505 char sdata
; /* signed data byte */
1506 unsigned char udata
; /* unsigned data byte */
1509 *dst_ln_entry_ptr_t
,
1510 dst_ln_table_t
[dst_dummy_array_size
];
1512 /* The following macro will extract the ln_delta field as a signed value:
1514 #define dst_ln_ln_delta(ln_rec) \
1515 ( ((short) ((ln_rec).delta.ln_delta << 12)) >> 12 )
1520 typedef struct dst_sec_struct
{
1528 /* Macros for access to the data */
1530 #define DST_comp_unit(x) ((x)->rec_data.comp_unit_)
1531 #define DST_section_tab(x) ((x)->rec_data.section_tab_)
1532 #define DST_file_tab(x) ((x)->rec_data.file_tab_)
1533 #define DST_block(x) ((x)->rec_data.block_)
1534 #define DST_var(x) ((x)->rec_data.var_)
1535 #define DST_pointer(x) ((x)->rec_data.pointer_)
1536 #define DST_array(x) ((x)->rec_data.array_)
1537 #define DST_subrange(x) ((x)->rec_data.subrange_)
1538 #define DST_set(x) ((x)->rec_data.set_)
1539 #define DST_implicit_enum(x) ((x)->rec_data.implicit_enum_)
1540 #define DST_explicit_enum(x) ((x)->rec_data.explicit_enum_)
1541 #define DST_short_rec(x) ((x)->rec_data.record_)
1542 #define DST_short_union(x) ((x)->rec_data.record_)
1543 #define DST_file(x) ((x)->rec_data.file_)
1544 #define DST_offset(x) ((x)->rec_data.offset_)
1545 #define DST_alias(x) ((x)->rec_data.alias_)
1546 #define DST_signature(x) ((x)->rec_data.signature_)
1547 #define DST_old_label(x) ((x)->rec_data.old_label_)
1548 #define DST_scope(x) ((x)->rec_data.scope_)
1549 #define DST_string_tab(x) ((x)->rec_data.string_tab_)
1550 #define DST_global_name_tab(x) ((x)->rec_data.string_tab_)
1551 #define DST_forward(x) ((x)->rec_data.forward_)
1552 #define DST_aux_size(x) ((x)->rec_data.aux_size_)
1553 #define DST_aux_align(x) ((x)->rec_data.aux_align_)
1554 #define DST_aux_field_size(x) ((x)->rec_data.aux_field_size_)
1555 #define DST_aux_field_off(x) ((x)->rec_data.aux_field_off_)
1556 #define DST_aux_field_align(x) ((x)->rec_data.aux_field_align_)
1557 #define DST_aux_qual(x) ((x)->rec_data.aux_qual_)
1558 #define DST_aux_var_bound(x) ((x)->rec_data.aux_var_bound_)
1559 #define DST_extension(x) ((x)->rec_data.extension_)
1560 #define DST_string(x) ((x)->rec_data.string_)
1561 #define DST_const(x) ((x)->rec_data.const_)
1562 #define DST_reference(x) ((x)->rec_data.pointer_)
1563 #define DST_record(x) ((x)->rec_data.record_)
1564 #define DST_union(x) ((x)->rec_data.record_)
1565 #define DST_aux_type_deriv(x) ((x)->rec_data.aux_type_deriv_)
1566 #define DST_locpool(x) ((x)->rec_data.string_tab_)
1567 #define DST_variable(x) ((x)->rec_data.variable_)
1568 #define DST_label(x) ((x)->rec_data.label_)
1569 #define DST_entry(x) ((x)->rec_data.entry_)
1570 #define DST_aux_lifetime(x) ((x)->rec_data.aux_lifetime_)
1571 #define DST_aux_ptr_base(x) ((x)->rec_data.aux_ptr_base_)
1572 #define DST_aux_src_range(x) ((x)->rec_data.aux_src_range_)
1573 #define DST_aux_reg_val(x) ((x)->rec_data.aux_reg_val_)
1574 #define DST_aux_unit_names(x) ((x)->rec_data.aux_unit_names_)
1575 #define DST_aux_sect_info(x) ((x)->rec_data.aux_sect_info_)
1579 * Type codes for loc strings. I'm not entirely certain about all of
1580 * these, but they seem to work.
1581 * troy@cbme.unsw.EDU.AU
1582 * If you find a variable whose location can't be decoded, you should
1583 * find out it's code using "dstdump -s filename". It will record an
1584 * entry for the variable, and give a text representation of what
1585 * the locstring means. Before that explaination there will be a
1586 * number. In the LOCSTRING table, that number will appear before
1587 * the start of the location string. Location string codes are
1588 * five bit codes with a 3 bit argument. Check the high 5 bits of
1589 * the one byte code, and figure out where it goes in here.
1590 * Then figure out exactly what the meaning is and code it in
1593 * Note that ranged locs mean that the variable is in different locations
1594 * depending on the current PC. We ignore these because (a) gcc can't handle
1595 * them, and (b), If you don't use high levels of optimisation they won't
1600 dst_lsc_end
, /* End of string */
1601 dst_lsc_indirect
, /* Indirect through previous. Arg == 6 */
1602 /* Or register ax (x=arg) */
1603 dst_lsc_dreg
, /* register dx (x=arg) */
1605 dst_lsc_section
, /* Section (arg+1) */
1608 dst_lsc_add
, /* Add (arg+1)*2 */
1609 dst_lsc_sub
, /* Subtract (arg+1)*2 */
1612 dst_lsc_sec_byte
, /* Section of next byte+1 */
1613 dst_lsc_add_byte
, /* Add next byte (arg == 5) or next word
1616 dst_lsc_sub_byte
, /* Subtract next byte. (arg == 1) or next
1619 dst_lsc_sbreg
, /* Stack base register (frame pointer). Arg==0*/
1621 dst_lsc_ranged
, /* location is pc dependent */
1637 } dst_loc_string_code_t
;
1639 /* If the following occurs after an addition/subtraction, that addition
1640 * or subtraction should be multiplied by 256. It's a complete byte, not
1644 #define dst_multiply_256 ((char) 0x73)
1650 } dst_loc_header_t ALIGNED1
;
1654 dst_loc_header_t header
;
1656 } dst_loc_entry_t ALIGNED1
;
1659 #endif /* apollo_dst_h */