]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/dst.h
import gdb-1999-07-07 post reformat
[thirdparty/binutils-gdb.git] / gdb / dst.h
CommitLineData
c906108c
SS
1/* <apollo/dst.h> */
2/* Apollo object module DST (debug symbol table) description */
3
4#ifndef apollo_dst_h
c5aa993b 5#define apollo_dst_h
c906108c
SS
6
7#if defined(apollo) && !defined(__GNUC__)
8#define ALIGNED1 __attribute( (aligned(1)) )
9#else
10/* Remove attribute directives from non-Apollo code: */
c5aa993b 11#define ALIGNED1 /* nil */
c906108c
SS
12#endif
13
14
15
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 .
c5aa993b
JM
19 */
20#define dst_version_major 1
21#define dst_version_minor 3
c906108c
SS
22
23
24/*
c5aa993b
JM
25 ** Enumeration of debug record types appearing in .blocks and .symbols ...
26 */
c906108c 27typedef enum
c5aa993b
JM
28 {
29 dst_typ_pad, /* 0 */
30 dst_typ_comp_unit, /* 1 */
31 dst_typ_section_tab, /* 2 */
32 dst_typ_file_tab, /* 3 */
33 dst_typ_block, /* 4 */
c906108c
SS
34 dst_typ_5,
35 dst_typ_var,
c5aa993b
JM
36 dst_typ_pointer, /* 7 */
37 dst_typ_array, /* 8 */
38 dst_typ_subrange, /* 9 */
39 dst_typ_set, /* 10 */
40 dst_typ_implicit_enum, /* 11 */
41 dst_typ_explicit_enum, /* 12 */
42 dst_typ_short_rec, /* 13 */
c906108c 43 dst_typ_old_record,
c5aa993b 44 dst_typ_short_union, /* 15 */
c906108c 45 dst_typ_old_union,
c5aa993b
JM
46 dst_typ_file, /* 17 */
47 dst_typ_offset, /* 18 */
48 dst_typ_alias, /* 19 */
49 dst_typ_signature, /* 20 */
c906108c 50 dst_typ_21,
c5aa993b
JM
51 dst_typ_old_label, /* 22 */
52 dst_typ_scope, /* 23 */
53 dst_typ_end_scope, /* 24 */
c906108c
SS
54 dst_typ_25,
55 dst_typ_26,
c5aa993b
JM
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 */
c906108c 68 dst_typ_old_entry,
c5aa993b
JM
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 */
c906108c 84 dst_typ_END_OF_ENUM
c5aa993b
JM
85 }
86dst_rec_type_t;
c906108c
SS
87
88
89/*
c5aa993b
JM
90 ** Dummy bounds for variably dimensioned arrays:
91 */
c906108c
SS
92#define dst_dummy_array_size 100
93
94
95/*
c5aa993b
JM
96 ** Reference to another item in the symbol table.
97 **
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.
100 **
101 ** The value of a NIL dst_rel_offset_t is zero.
102 */
c906108c 103
c5aa993b 104typedef long dst_rel_offset_t ALIGNED1;
c906108c
SS
105
106
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. */
110
111/*
c5aa993b
JM
112 ** Section-relative reference.
113 **
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
116 ** section table!
117 **
118 ** The sect_offset field is the offset in bytes into the section.
119 **
120 ** A NIL dst_sect_ref_t has a sect_index field of zero. Indexes originate
121 ** at one.
122 */
c906108c
SS
123
124typedef struct
c5aa993b
JM
125 {
126 unsigned short sect_index;
127 unsigned long sect_offset ALIGNED1;
128 }
129dst_sect_ref_t;
c906108c
SS
130
131#define dst_sect_index_nil 0
132#define dst_sect_index_origin 1
133
134
135/*
c5aa993b
JM
136 ** Source location descriptor.
137 **
138 ** The file_index field is an index into the local compilation unit's
139 ** file table (see dst_rec_file_tab_t).
140 **
141 ** A NIL dst_src_loc_t has a file_index field of zero. Indexes originate
142 ** at one.
143 */
c906108c
SS
144
145typedef struct
c5aa993b
JM
146 {
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 */
150 }
151dst_src_loc_t;
c906108c
SS
152
153#define dst_file_index_nil 0
154#define dst_file_index_origin 1
155
156
157/*
c5aa993b
JM
158 ** Standard (primitive) type codes.
159 */
c906108c
SS
160
161typedef enum
c5aa993b 162 {
c906108c 163 dst_non_std_type,
c5aa993b
JM
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 */
c906108c 185 dst_std_type_END_OF_ENUM
c5aa993b
JM
186 }
187dst_std_type_t;
c906108c
SS
188
189
190/*
c5aa993b
JM
191 ** General data type descriptor
192 **
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.
197 */
c906108c
SS
198
199typedef union
c5aa993b 200 {
c906108c 201 struct
c5aa993b
JM
202 {
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 */
206 }
207 std_type;
208
c906108c 209 struct
c5aa993b
JM
210 {
211 boolean user_defined_type:1; /* tag field */
212 int doffset:31; /* offset to type record */
213 }
214 user_type;
215 }
216dst_type_t ALIGNED1;
c906108c
SS
217
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:
c5aa993b 221 */
c906108c
SS
222#define dst_user_type_offset(type_rec) \
223 ( ((int) ((type_rec).user_type.doffset << 1)) >> 1 )
224
225
226/*================================================*/
227/*========== RECORDS IN .blocks SECTION ==========*/
228/*================================================*/
229
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.
236*/
237
238typedef enum
c5aa993b
JM
239 {
240 dst_pc_code_locs, /* ranges in loc strings are pc ranges */
c906108c 241 dst_comp_unit_END_OF_ENUM
c5aa993b
JM
242 }
243dst_comp_unit_flag_t;
c906108c
SS
244
245typedef enum
c5aa993b
JM
246 {
247 dst_lang_unk, /* unknown language */
248 dst_lang_pas, /* Pascal */
249 dst_lang_ftn, /* FORTRAN */
250 dst_lang_c, /* C */
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++ */
c906108c 256 dst_lang_END_OF_ENUM
c5aa993b
JM
257 }
258dst_lang_type_t;
c906108c
SS
259
260typedef struct
c5aa993b 261 {
c906108c 262 struct
c5aa993b
JM
263 {
264 unsigned char major_part; /* = dst_version_major */
265 unsigned char minor_part; /* = dst_version_minor */
266 }
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 */
275 }
276dst_rec_comp_unit_t ALIGNED1;
c906108c
SS
277
278
279/*--------------------
280 SECTION TABLE record
281 --------------------
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.
286*/
287
288typedef struct
c5aa993b
JM
289 {
290 unsigned short number_of_sections; /* size of array: */
291 unsigned long section_base[dst_dummy_array_size] ALIGNED1;
292 }
293dst_rec_section_tab_t ALIGNED1;
c906108c
SS
294
295
296/*-----------------
297 FILE TABLE record
298 -----------------
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
302 primary source file.
303*/
304
305typedef struct
c5aa993b
JM
306 {
307 long dtm; /* time last modified (time_$clock_t) */
308 dst_rel_offset_t noffset; /* offset to name string for source file */
309 }
310dst_file_desc_t;
c906108c
SS
311
312typedef struct
c5aa993b
JM
313 {
314 unsigned short number_of_files; /* size of array: */
315 dst_file_desc_t files[dst_dummy_array_size] ALIGNED1;
316 }
317dst_rec_file_tab_t ALIGNED1;
c906108c
SS
318
319
320/*-----------------
321 NAME TABLE record
322 -----------------
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
326 same file index.
327*/
328
329typedef struct
c5aa993b
JM
330 {
331 unsigned short number_of_names; /* size of array: */
332 dst_rel_offset_t names[dst_dummy_array_size] ALIGNED1;
333 }
334dst_rec_name_tab_t ALIGNED1;
c906108c
SS
335
336
337/*--------------
338 BLOCK record
339 --------------
340 Describes a lexical program block--a procedure, function, module, etc.
341*/
342
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.
c5aa993b 349 */
c906108c 350typedef enum
c5aa993b
JM
351 {
352 dst_block_module, /* some pascal = modula = ada types */
353 dst_block_program,
354 dst_block_procedure,
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,
361 dst_block_subunit,
362 dst_block_task,
363 dst_block_file, /* a C outer scope? */
364 dst_block_class, /* C++ or Simula */
c906108c 365 dst_block_END_OF_ENUM
c5aa993b
JM
366 }
367dst_block_type_t;
c906108c
SS
368
369/* Block attributes. This is the information used by the debugger to represent
370 the semantics of blocks.
c5aa993b 371 */
c906108c 372typedef enum
c5aa993b
JM
373 {
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 */
c906108c 377 dst_block_attr_END_OF_ENUM
c5aa993b
JM
378 }
379dst_block_attr_t;
c906108c
SS
380
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.
c5aa993b 385 */
c906108c 386typedef struct
c5aa993b
JM
387 {
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 */
391 }
392dst_code_range_t;
c906108c
SS
393
394typedef struct
c5aa993b
JM
395 {
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;
404 }
405dst_rec_block_t ALIGNED1;
c906108c
SS
406
407
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.
415*/
416
417typedef struct
c5aa993b
JM
418 {
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;
422 }
423dst_rec_sect_info_tab_t ALIGNED1;
c906108c
SS
424
425/*=================================================*/
426/*========== RECORDS IN .symbols SECTION ==========*/
427/*=================================================*/
428
429/*-----------------
430 CONSTANT record
431 -----------------
432 Describes a symbolic constant.
433*/
434
435typedef struct
c5aa993b
JM
436 {
437 float r; /* real part */
438 float i; /* imaginary part */
439 }
440dst_complex_t;
c906108c
SS
441
442typedef struct
c5aa993b
JM
443 {
444 double dr; /* real part */
445 double di; /* imaginary part */
446 }
447dst_double_complex_t;
c906108c
SS
448
449/* The following record provides a way of describing constant values with
450 non-standard type and no limit on size.
c5aa993b 451 */
c906108c 452typedef union
c5aa993b
JM
453 {
454 char char_data[dst_dummy_array_size];
455 short int_data[dst_dummy_array_size];
456 long long_data[dst_dummy_array_size];
457 }
458dst_big_kon_t;
c906108c
SS
459
460/* Representation of the value of a general constant.
c5aa993b 461 */
c906108c 462typedef struct
c5aa993b
JM
463 {
464 unsigned short length; /* size of constant value (bytes) */
c906108c
SS
465
466 union
c5aa993b
JM
467 {
468 unsigned short kon_int8;
469 short kon_int16;
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;
475 char kon_char;
476 dst_big_kon_t kon ALIGNED1;
477 }
478 val; /* value data of constant */
479 }
480dst_const_t ALIGNED1;
c906108c
SS
481
482typedef struct
c5aa993b
JM
483 {
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 */
487 dst_const_t value;
488 }
489dst_rec_const_t ALIGNED1;
c906108c
SS
490
491/*----------------
492 VARIABLE record
493 ----------------
494 Describes a program variable.
495*/
496
497/* Variable attributes. These define certain variable semantics to the
498 debugger.
c5aa993b 499 */
c906108c 500typedef enum
c5aa993b
JM
501 {
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 */
c906108c 507 dst_var_attr_END_OF_ENUM
c5aa993b
JM
508 }
509dst_var_attr_t;
c906108c
SS
510
511typedef struct
c5aa993b
JM
512 {
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 */
518 }
519dst_rec_variable_t ALIGNED1;
c906108c
SS
520
521
522/*----------------
523 old VAR record
524 -----------------
525 Used by older compilers to describe a variable
526*/
527
528typedef enum
c5aa993b 529 {
c906108c
SS
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
c5aa993b
JM
541 }
542dst_var_loc_t;
c906108c
SS
543
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.
549 */
550
c5aa993b
JM
551typedef struct
552 {
553 unsigned short loc_type:4;
554 unsigned short loc_index:12;
555 long location;
556 short start_line; /* start_line and end_line? */
557 short end_line; /* I'm guessing here. */
558 }
559dst_var_loc_short_t;
c906108c
SS
560
561typedef struct
c5aa993b
JM
562 {
563 unsigned short loc_type;
564 unsigned short loc_index;
565 long location;
566 short unknown; /* Always 0003 or 3b3c. Why? */
567 short start_statement;
568 short start_line;
569 short end_statement;
570 short end_line;
571 }
572dst_var_loc_long_t;
c906108c
SS
573
574
575typedef struct
c5aa993b
JM
576 {
577 dst_rel_offset_t noffset; /* offset to name string */
578 dst_src_loc_t src_loc; /* file/line of description */
579 dst_type_t type_desc; /* Type description */
580 unsigned short attributes; /* mask of dst_var_attr_t flags */
581 unsigned short no_of_locs:15; /* Number of locations */
582 unsigned short short_locs:1; /* True if short locations. */
c906108c 583 union
c5aa993b 584 {
c906108c
SS
585 dst_var_loc_short_t shorts[dst_dummy_array_size];
586 dst_var_loc_long_t longs[dst_dummy_array_size];
c5aa993b
JM
587 }
588 locs;
589 }
590dst_rec_var_t;
c906108c
SS
591
592/*----------------
593 old LABEL record
594 -----------------
595 Used by older compilers to describe a label
596*/
597
598typedef struct
c5aa993b
JM
599 {
600 dst_rel_offset_t noffset; /* offset to name string */
601 dst_src_loc_t src_loc; /* file/line of description */
602 char location[12]; /* location string */
603 }
604dst_rec_old_label_t ALIGNED1;
c906108c
SS
605
606/*----------------
607 POINTER record
608 ----------------
609 Describes a pointer type.
610*/
611
612typedef struct
c5aa993b
JM
613 {
614 dst_rel_offset_t noffset; /* offset to the name string for this type */
615 dst_src_loc_t src_loc; /* file/line of definition */
616 dst_type_t type_desc; /* base type of this pointer */
617 }
618dst_rec_pointer_t ALIGNED1;
c906108c
SS
619
620
621/*-------------
622 ARRAY record
623 -------------
624 Describes an array type.
625
626 Multidimensional arrays are described with a number of dst_rec_array_t
627 records, one per array dimension, each linked to the next through the
628 elem_type_desc.doffset field. Each record must have its multi_dim flag
629 set.
630
631 If column_major is true (as with FORTRAN arrays) then the last array bound in
632 the declaration is the first array index in memory, which is the opposite of
633 the usual case (as with Pascal and C arrays).
634
635 Variable array bounds are described by auxiliary records; if aux_var_bound
636 records are present, the lo_bound and hi_bound fields of this record are
637 ignored by the debugger.
638
639 span_comp identifies one of the language-dependent ways in which the distance
640 between successive array elements (span) is calculated.
641 dst_use_span_field -- the span is the value of span field.
642 dst_compute_from_prev -- the span is the size of the previous dimension.
643 dst_compute_from_next -- the span is the size of the next dimension.
644 In the latter two cases, the span field contains an amount of padding to add
645 to the size of the appropriate dimension to calculate the span.
646*/
647
648typedef enum
c5aa993b
JM
649 {
650 dst_use_span_field,
c906108c 651 dst_compute_from_prev,
c5aa993b 652 dst_compute_from_next,
c906108c 653 dst_span_comp_END_OF_ENUM
c5aa993b
JM
654 }
655dst_span_comp_t;
c906108c
SS
656
657typedef struct
c5aa993b
JM
658 {
659 dst_rel_offset_t noffset; /* offset to name string */
660 dst_src_loc_t src_loc; /* file/line of definition */
661 dst_type_t elem_type_desc; /* array element type */
662 dst_type_t indx_type_desc; /* array index type */
663 long lo_bound; /* lower bound of index */
664 long hi_bound; /* upper bound of index */
665 unsigned long span; /* see above */
666 unsigned long size; /* total array size (bytes) */
667 boolean multi_dim:1;
668 boolean is_packed:1; /* true if packed array */
669 boolean is_signed:1; /* true if packed elements are signed */
670 dst_span_comp_t span_comp:2; /* how to compute span */
671 boolean column_major:1;
672 unsigned short reserved:2; /* must be zero */
673 unsigned short elem_size:8; /* element size if packed (bits) */
674 }
675dst_rec_array_t ALIGNED1;
c906108c
SS
676
677
678/*-----------------
679 SUBRANGE record
680 -----------------
681 Describes a subrange type.
682*/
683
684/* Variable subrange bounds are described by auxiliary records; if aux_var_bound
685 records are present, the lo_bound and hi_bound fields of this record are
686 ignored by the debugger.
c5aa993b 687 */
c906108c
SS
688
689typedef struct
c5aa993b
JM
690 {
691 dst_rel_offset_t noffset; /* offset to name string */
692 dst_src_loc_t src_loc; /* file/line of subrange definition */
693 dst_type_t type_desc; /* parent type */
694 long lo_bound; /* lower bound of subrange */
695 long hi_bound; /* upper bound of subrange */
696 unsigned short size; /* storage size (bytes) */
697 }
698dst_rec_subrange_t ALIGNED1;
c906108c
SS
699
700
701/*---------------
702 STRING record
703 ---------------
704 Describes a string type.
705*/
706
707/* Variable subrange bounds are described by auxiliary records; if aux_var_bound
708 records are present, the lo_bound and hi_bound fields of this record are
709 ignored by the debugger.
c5aa993b 710 */
c906108c
SS
711
712typedef struct
c5aa993b
JM
713 {
714 dst_rel_offset_t noffset; /* offset to name string */
715 dst_src_loc_t src_loc; /* file/line of string definition */
716 dst_type_t elem_type_desc; /* element type */
717 dst_type_t indx_type_desc; /* index type */
718 long lo_bound; /* lower bound */
719 long hi_bound; /* upper bound */
720 unsigned long size; /* total string size (bytes) if fixed */
721 }
722dst_rec_string_t ALIGNED1;
c906108c
SS
723
724
725/*---------------
726 SET record
727 ---------------
728 Describes a set type.
729*/
730
731typedef struct
c5aa993b
JM
732 {
733 dst_rel_offset_t noffset; /* offset to name string */
734 dst_src_loc_t src_loc; /* file/line of definition */
735 dst_type_t type_desc; /* element type */
736 unsigned short nbits; /* number of bits in set */
737 unsigned short size; /* storage size (bytes) */
738 }
739dst_rec_set_t ALIGNED1;
c906108c
SS
740
741
742/*-----------------------------
743 IMPLICIT ENUMERATION record
744 -----------------------------
745 Describes an enumeration type with implicit element values = 0, 1, 2, ...
746 (Pascal-style).
747*/
748
749typedef struct
c5aa993b
JM
750 {
751 dst_rel_offset_t noffset; /* offset to name string */
752 dst_src_loc_t src_loc; /* file/line of definition */
753 unsigned short nelems; /* number of elements in enumeration */
754 unsigned short size; /* storage size (bytes) */
c906108c 755 /* offsets to name strings of elements 0, 1, 2, ... */
c5aa993b
JM
756 dst_rel_offset_t elem_noffsets[dst_dummy_array_size];
757 }
758dst_rec_implicit_enum_t ALIGNED1;
c906108c
SS
759
760
761/*-----------------------------
762 EXPLICIT ENUMERATION record
763 -----------------------------
764 Describes an enumeration type with explicitly assigned element values
765 (C-style).
766*/
767
768typedef struct
c5aa993b
JM
769 {
770 dst_rel_offset_t noffset; /* offset to element name string */
771 long value; /* element value */
772 }
773dst_enum_elem_t;
c906108c
SS
774
775typedef struct
c5aa993b
JM
776 {
777 dst_rel_offset_t noffset; /* offset to name string */
778 dst_src_loc_t src_loc; /* file/line of definition */
779 unsigned short nelems; /* number of elements in enumeration */
780 unsigned short size; /* storage size (bytes) */
c906108c 781 /* name/value pairs, one describing each enumeration value: */
c5aa993b
JM
782 dst_enum_elem_t elems[dst_dummy_array_size];
783 }
784dst_rec_explicit_enum_t ALIGNED1;
c906108c
SS
785
786
787/*-----------------------
788 RECORD / UNION record
789 -----------------------
790 Describes a record (struct) or union.
791
792 If the record is larger than 2**16 bytes then an attached aux record
793 specifies its size. Also, if the record is stored in short form then
794 attached records specify field offsets larger than 2**16 bytes.
795
796 Whether the fields[] array or sfields[] array is used is selected by
797 the dst_rec_type_t of the overall dst record.
798*/
799
800/*
801 Record field descriptor, short form. This form handles only fields which
802 are an even number of bytes long, located some number of bytes from the
803 start of the record.
c5aa993b 804 */
c906108c 805typedef struct
c5aa993b
JM
806 {
807 dst_rel_offset_t noffset; /* offset to field name string */
808 dst_type_t type_desc; /* field type */
809 unsigned short foffset; /* field offset from start of record (bytes) */
810 }
811dst_short_field_t ALIGNED1;
c906108c
SS
812
813typedef struct
c5aa993b
JM
814 {
815 dst_rel_offset_t noffset; /* offset to name string */
816 dst_type_t type_desc; /* field type */
817 unsigned short foffset; /* byte offset */
818 unsigned short is_packed:1; /* True if field is packed */
819 unsigned short bit_offset:6; /* Bit offset */
820 unsigned short size:6; /* Size in bits */
821 unsigned short sign:1; /* True if signed */
822 unsigned short pad:2; /* Padding. Must be 0 */
823 }
824dst_old_field_t ALIGNED1;
c906108c
SS
825
826/* Tag enumeration for long record field descriptor:
c5aa993b 827 */
c906108c 828typedef enum
c5aa993b 829 {
c906108c
SS
830 dst_field_byte,
831 dst_field_bit,
832 dst_field_loc,
833 dst_field_END_OF_ENUM
c5aa993b
JM
834 }
835dst_field_format_t;
c906108c
SS
836
837/*
838 Record field descriptor, long form. The format of the field information
839 is identified by the format_tag, which contains one of the above values.
840 The field_byte variant is equivalent to the short form of field descriptor.
841 The field_bit variant handles fields which are any number of bits long,
842 located some number of bits from the start of the record. The field_loc
843 variant allows the location of the field to be described by a general loc
844 string.
c5aa993b 845 */
c906108c 846typedef struct
c5aa993b
JM
847 {
848 dst_rel_offset_t noffset; /* offset to name of field */
849 dst_type_t type_desc; /* type of field */
c906108c 850 union
c5aa993b
JM
851 {
852 struct
853 {
854 dst_field_format_t format_tag:2; /* dst_field_byte */
855 unsigned long offset:30; /* offset of field in bytes */
856 }
857 field_byte ALIGNED1;
858 struct
859 {
860 dst_field_format_t format_tag:2; /* dst_field_bit */
861 unsigned long nbits:6; /* bit size of field */
862 unsigned long is_signed:1; /* signed/unsigned attribute */
863 unsigned long bit_offset:3; /* bit offset from byte boundary */
864 int pad:4; /* must be zero */
865 unsigned short byte_offset; /* offset of byte boundary */
866 }
867 field_bit ALIGNED1;
868 struct
869 {
870 dst_field_format_t format_tag:2; /* dst_field_loc */
871 int loffset:30; /* dst_rel_offset_t to loc string */
872 }
873 field_loc ALIGNED1;
874 }
875 f ALIGNED1;
876 }
877dst_field_t;
c906108c
SS
878
879/* The field_loc.loffset field is a 30-bit signed value. Some versions of C do
880 not support signed bit fields. The following macro will extract that field
881 as a signed value:
c5aa993b 882 */
c906108c
SS
883#define dst_field_loffset(field_rec) \
884 ( ((int) ((field_rec).f.field_loc.loffset << 2)) >> 2 )
885
886
887typedef struct
c5aa993b
JM
888 {
889 dst_rel_offset_t noffset; /* offset to record name string */
890 dst_src_loc_t src_loc; /* file/line where this record is defined */
891 unsigned short size; /* storage size (bytes) */
892 unsigned short nfields; /* number of fields in this record */
c906108c 893 union
c5aa993b
JM
894 {
895 dst_field_t fields[dst_dummy_array_size];
896 dst_short_field_t sfields[dst_dummy_array_size];
897 dst_old_field_t ofields[dst_dummy_array_size];
898 }
899 f; /* array of fields */
900 }
901dst_rec_record_t ALIGNED1;
c906108c
SS
902
903
904/*-------------
905 FILE record
906 -------------
907 Describes a file type.
908*/
909
910typedef struct
c5aa993b
JM
911 {
912 dst_rel_offset_t noffset; /* offset to name string */
913 dst_src_loc_t src_loc; /* file/line where type was defined */
914 dst_type_t type_desc; /* file element type */
915 }
916dst_rec_file_t ALIGNED1;
c906108c
SS
917
918
919/*---------------
920 OFFSET record
921 ---------------
922 Describes a Pascal offset type.
923 (This type, an undocumented Domain Pascal extension, is currently not
924 supported by the debugger)
925*/
926
927typedef struct
c5aa993b
JM
928 {
929 dst_rel_offset_t noffset; /* offset to the name string */
930 dst_src_loc_t src_loc; /* file/line of definition */
931 dst_type_t area_type_desc; /* area type */
932 dst_type_t base_type_desc; /* base type */
933 long lo_bound; /* low bound of the offset range */
934 long hi_bound; /* high bound of the offset range */
935 long bias; /* bias */
936 unsigned short scale; /* scale factor */
937 unsigned short size; /* storage size (bytes) */
938 }
939dst_rec_offset_t ALIGNED1;
c906108c
SS
940
941
942/*--------------
943 ALIAS record
944 --------------
945 Describes a type alias (e.g., typedef).
946*/
947
948typedef struct
c5aa993b
JM
949 {
950 dst_rel_offset_t noffset; /* offset to name string */
951 dst_src_loc_t src_loc; /* file/line of definition */
952 dst_type_t type_desc; /* parent type */
953 }
954dst_rec_alias_t ALIGNED1;
c906108c
SS
955
956
957/*------------------
958 SIGNATURE record
959 ------------------
960 Describes a procedure/function type.
961*/
962
963/* Enumeration of argument semantics. Note that most are mutually
964 exclusive.
c5aa993b 965 */
c906108c 966typedef enum
c5aa993b
JM
967 {
968 dst_arg_attr_val, /* passed by value */
969 dst_arg_attr_ref, /* passed by reference */
970 dst_arg_attr_name, /* passed by name */
971 dst_arg_attr_in, /* readable in the callee */
972 dst_arg_attr_out, /* writable in the callee */
973 dst_arg_attr_hidden, /* not visible in the caller */
c906108c 974 dst_arg_attr_END_OF_ENUM
c5aa993b
JM
975 }
976dst_arg_attr_t;
c906108c
SS
977
978/* Argument descriptor. Actually points to a variable record for most of the
979 information.
c5aa993b 980 */
c906108c 981typedef struct
c5aa993b
JM
982 {
983 dst_rel_offset_t var_offset; /* offset to variable record */
984 unsigned short attributes; /* a mask of dst_arg_attr_t flags */
985 }
986dst_arg_t ALIGNED1;
c906108c
SS
987
988typedef struct
c5aa993b
JM
989 {
990 dst_rel_offset_t noffset; /* offset to name string */
991 dst_src_loc_t src_loc; /* file/line of function definition */
992 dst_rel_offset_t result; /* offset to function result variable record */
993 unsigned short nargs; /* number of arguments */
994 dst_arg_t args[dst_dummy_array_size];
995 }
996dst_rec_signature_t ALIGNED1;
c906108c
SS
997
998/*--------------
999 SCOPE record
1000 --------------
1001 Obsolete. Use the new ENTRY type instead.
1002 Old compilers may put this in as the first entry in a function,
1003 terminated by an end of scope entry.
1004*/
1005
1006typedef struct
c5aa993b
JM
1007 {
1008 dst_rel_offset_t noffset; /* Name offset */
1009 dst_src_loc_t start_line; /* Starting line */
1010 dst_src_loc_t end_line; /* Ending line */
1011 }
1012dst_rec_scope_t ALIGNED1;
c906108c
SS
1013
1014/*--------------
1015 ENTRY record
1016 --------------
1017 Describes a procedure/function entry point. An entry record is to a
1018 signature record roughly as a variable record is to a type descriptor record.
1019
1020 The entry_number field is keyed to the entry numbers in .lines -- the
1021 debugger locates the code location of an entry by searching the line
1022 number table for an entry numbered with the value of entry_number. The
1023 main entry is numbered zero.
1024*/
1025
1026typedef struct
c5aa993b
JM
1027 {
1028 dst_rel_offset_t noffset; /* offset to entry name string */
1029 dst_rel_offset_t loffset; /* where to jump to call this entry */
1030 dst_src_loc_t src_loc; /* file/line of definition */
1031 dst_rel_offset_t sig_desc; /* offset to signature descriptor */
1032 unsigned int entry_number:8;
1033 int pad:8; /* must be zero */
1034 }
1035dst_rec_entry_t ALIGNED1;
c906108c
SS
1036
1037/*-----------------------
1038 Old format ENTRY record
1039 -----------------------
1040 Supposedly obsolete but still used by some compilers.
1041 */
1042
1043typedef struct
c5aa993b
JM
1044 {
1045 dst_rel_offset_t noffset; /* Offset to entry name string */
1046 dst_src_loc_t src_loc; /* Location in source */
1047 dst_rel_offset_t sig_desc; /* Signature description */
1048 char unknown[36];
1049 }
1050dst_rec_old_entry_t ALIGNED1;
c906108c
SS
1051
1052/*--------------
1053 LABEL record
1054 --------------
1055 Describes a program label.
1056*/
1057
1058typedef struct
c5aa993b
JM
1059 {
1060 dst_rel_offset_t noffset; /* offset to label string */
1061 dst_rel_offset_t loffset; /* offset to loc string */
1062 dst_src_loc_t src_loc; /* file/line of definition */
1063 }
1064dst_rec_label_t ALIGNED1;
c906108c
SS
1065
1066
1067/*-----------------------
1068 AUXILIARY SIZE record
1069 -----------------------
1070 May appear in the auxiliary record list of any type or variable record to
1071 modify the default size of the type or variable.
1072*/
1073
1074typedef struct
c5aa993b
JM
1075 {
1076 unsigned long size; /* size (bytes) */
1077 }
1078dst_rec_aux_size_t ALIGNED1;
c906108c
SS
1079
1080
1081/*-----------------------
1082 AUXILIARY ALIGN record
1083 -----------------------
1084 May appear in the auxiliary record list of any type or variable record to
1085 modify the default alignment of the type or variable.
1086*/
1087
1088typedef struct
c5aa993b
JM
1089 {
1090 unsigned short alignment; /* # of low order zero bits */
1091 }
1092dst_rec_aux_align_t ALIGNED1;
c906108c
SS
1093
1094
1095/*-----------------------------
1096 AUXILIARY FIELD SIZE record
1097 -----------------------------
1098 May appear in the auxiliary record list of any RECORD/UNION record to
1099 modify the default size of a field.
1100*/
1101
1102typedef struct
c5aa993b
JM
1103 {
1104 unsigned short field_no; /* field number */
1105 unsigned long size; /* size (bits) */
1106 }
1107dst_rec_aux_field_size_t ALIGNED1;
c906108c
SS
1108
1109
1110
1111/*-----------------------------
1112 AUXILIARY FIELD OFFSET record
1113 -----------------------------
1114 May appear in the auxiliary record list of any RECORD/UNION record to
1115 specify a field offset larger than 2**16.
1116*/
1117
1118typedef struct
c5aa993b
JM
1119 {
1120 unsigned short field_no; /* field number */
1121 unsigned long foffset; /* offset */
1122 }
1123dst_rec_aux_field_off_t ALIGNED1;
c906108c
SS
1124
1125
1126/*-----------------------------
1127 AUXILIARY FIELD ALIGN record
1128 -----------------------------
1129 May appear in the auxiliary record list of any RECORD/UNION record to
1130 modify the default alignment of a field.
1131*/
1132
1133typedef struct
c5aa993b
JM
1134 {
1135 unsigned short field_no; /* field number */
1136 unsigned short alignment; /* number of low order zero bits */
1137 }
1138dst_rec_aux_field_align_t ALIGNED1;
c906108c
SS
1139
1140
1141/*----------------------------
1142 AUXILIARY VAR BOUND record
1143 ----------------------------
1144 May appear in the auxiliary record list of any ARRAY, SUBRANGE or STRING
1145 record to describe a variable bound for the range of the type.
1146*/
1147
1148typedef enum
c5aa993b
JM
1149 {
1150 dst_low_bound, /* the low bound is variable */
1151 dst_high_bound, /* the high bound is variable */
c906108c 1152 dst_var_bound_END_OF_ENUM
c5aa993b
JM
1153 }
1154dst_var_bound_t;
c906108c
SS
1155
1156typedef struct
c5aa993b
JM
1157 {
1158 unsigned short which; /* which bound */
1159 dst_rel_offset_t voffset ALIGNED1; /* variable that defines bound */
1160 }
1161dst_rec_aux_var_bound_t ALIGNED1;
c906108c
SS
1162
1163
1164/*----------------------------------
1165 AUXILIARY TYPE DERIVATION record
1166 ----------------------------------
1167 May appear in the auxiliary record list of any RECORD/UNION record to denote
1168 class inheritance of that type from a parent type.
1169
1170 Inheritance implies that it is possible to convert the inheritor type to the
1171 inherited type, retaining those fields which were inherited. To allow this,
1172 orig_field_no, a field number into the record type, is provided. If
1173 orig_is_pointer is false, then the start of the inherited record is located
1174 at the location of the field indexed by orig_field_no. If orig_is_pointer
1175 is true, then it is located at the address contained in the field indexed
1176 by orig_field_no (assumed to be a pointer).
1177*/
1178
1179typedef struct
c5aa993b
JM
1180 {
1181 dst_type_t parent_type; /* reference to inherited type */
c906108c 1182 unsigned short orig_field_no;
c5aa993b
JM
1183 boolean orig_is_pointer:1;
1184 int unused:15; /* must be zero */
1185 }
1186dst_rec_aux_type_deriv_t ALIGNED1;
c906108c
SS
1187
1188
1189/*------------------------------------
1190 AUXILIARY VARIABLE LIFETIME record
1191 ------------------------------------
1192 May appear in the auxiliary record list of a VARIABLE record to add location
1193 information for an additional variable lifetime.
1194*/
1195
1196typedef struct
c5aa993b 1197 {
c906108c 1198 dst_rel_offset_t loffset;
c5aa993b
JM
1199 }
1200dst_rec_aux_lifetime_t ALIGNED1;
c906108c
SS
1201
1202
1203/*-------------------------------
1204 AUXILIARY POINTER BASE record
1205 -------------------------------
1206 May appear in the auxiliary record list of a VARIABLE record to provide a
1207 pointer base to substitute for references to any such bases in the location
1208 string of the variable. A pointer base is another VARIABLE record. When
1209 the variable is evaluated by the debugger, it uses the current value of the
1210 pointer base variable in computing its location.
1211
1212 This is useful for representing FORTRAN pointer-based variables.
1213*/
1214
1215typedef struct
c5aa993b 1216 {
c906108c 1217 dst_rel_offset_t voffset;
c5aa993b
JM
1218 }
1219dst_rec_aux_ptr_base_t ALIGNED1;
c906108c
SS
1220
1221
1222/*---------------------------------
1223 AUXILIARY REGISTER VALUE record
1224 ---------------------------------
1225 May appear in the auxiliary record list of an ENTRY record to specify
1226 a register that must be set to a specific value before jumping to the entry
1227 point in a debugger "call". The debugger must set the debuggee register,
1228 specified by the register code, to the value of the *address* to which the
1229 location string resolves. If the address is register-relative, then the
1230 call cannot be made unless the current stack frame is the lexical parent
1231 of the entry. An example of this is when a (Pascal) nested procedure
1232 contains references to its parent's variables, which it accesses through
1233 a static link register. The static link register must be set to some
1234 address relative to the parent's stack base register.
1235*/
1236
1237typedef struct
c5aa993b
JM
1238 {
1239 unsigned short reg; /* identifies register to set (isp enum) */
1240 dst_rel_offset_t loffset; /* references a location string */
1241 }
1242dst_rec_aux_reg_val_t ALIGNED1;
c906108c
SS
1243
1244
1245/*==========================================================*/
1246/*========== RECORDS USED IN .blocks AND .symbols ==========*/
1247/*==========================================================*/
1248
1249/*---------------------
1250 STRING TABLE record
1251 ---------------------
1252 A string table record contains any number of null-terminated, variable length
1253 strings. The length field gives the size in bytes of the text field, which
1254 can be any size.
1255
1256 The global name table shares this format. This record appears in the
1257 .blocks section. Each string in the table identifies a global defined in
1258 the current compilation unit.
1259
1260 The loc pool record shares this format as well. Loc strings are described
1261 elsewhere.
1262*/
1263
1264typedef struct
c5aa993b
JM
1265 {
1266 unsigned long length;
1267 char text[dst_dummy_array_size];
1268 }
1269dst_rec_string_tab_t ALIGNED1;
c906108c
SS
1270
1271
1272/*-----------------------
1273 AUXILIARY QUAL record
1274 -----------------------
1275 May appear in the auxiliary record list of any BLOCK, VARIABLE, or type record
1276 to provide it with a fully-qualified, language-dependent name.
1277*/
1278
1279typedef struct
c5aa993b
JM
1280 {
1281 dst_rel_offset_t lang_qual_name;
1282 }
1283dst_rec_aux_qual_t ALIGNED1;
c906108c
SS
1284
1285
1286/*----------------
1287 FORWARD record
1288 ----------------
1289 Reference to a record somewhere else. This allows identical definitions in
1290 different scopes to share data.
1291*/
1292
1293typedef struct
c5aa993b
JM
1294 {
1295 dst_rel_offset_t rec_off;
1296 }
1297dst_rec_forward_t ALIGNED1;
c906108c
SS
1298
1299
1300/*-------------------------------
1301 AUXILIARY SOURCE RANGE record
1302 -------------------------------
1303 May appear in the auxiliary record list of any BLOCK record to specify a
1304 range of source lines over which the block is active.
1305*/
1306
1307typedef struct
c5aa993b
JM
1308 {
1309 dst_src_loc_t first_line; /* first source line */
1310 dst_src_loc_t last_line; /* last source line */
1311 }
1312dst_rec_aux_src_range_t ALIGNED1;
c906108c
SS
1313
1314
1315/*------------------
1316 EXTENSION record
1317 ------------------
1318 Provision for "foreign" records, such as might be generated by a non-Apollo
1319 compiler. Apollo software will ignore these.
1320*/
1321
1322typedef struct
c5aa993b
JM
1323 {
1324 unsigned short rec_size; /* record size (bytes) */
1325 unsigned short ext_type; /* defined by whoever generates it */
1326 unsigned short ext_data; /* place-holder for arbitrary amount of data */
1327 }
1328dst_rec_extension_t ALIGNED1;
c906108c
SS
1329
1330
1331/*
c5aa993b
JM
1332 ** DEBUG SYMBOL record -- The wrapper for all .blocks and .symbols records.
1333 **
1334 ** This record ties together all previous .blocks and .symbols records
1335 ** together in a union with a common header. The rec_type field of the
1336 ** header identifies the record type. The rec_flags field currently only
1337 ** defines auxiliary record lists.
1338 **
1339 ** If a record carries with it a non-null auxiliary record list, its
1340 ** dst_flag_has_aux_recs flag is set, and each of the records that follow
1341 ** it are treated as its auxiliary records, until the end of the compilation
1342 ** unit or scope is reached, or until an auxiliary record with its
1343 ** dst_flag_last_aux_rec flag set is reached.
1344 */
c906108c
SS
1345
1346typedef enum
c5aa993b 1347 {
c906108c
SS
1348 dst_flag_has_aux_recs,
1349 dst_flag_last_aux_rec,
1350 dst_rec_flag_END_OF_ENUM
c5aa993b
JM
1351 }
1352dst_rec_flags_t;
c906108c
SS
1353
1354typedef struct
c5aa993b
JM
1355 {
1356 dst_rec_type_t rec_type:8; /* record type */
1357 int rec_flags:8; /* mask of dst_rec_flags_t */
1358 union /* switched on rec_type field above */
1359 {
1360 /* dst_typ_pad requires no additional fields */
1361 dst_rec_comp_unit_t comp_unit_;
1362 dst_rec_section_tab_t section_tab_;
1363 dst_rec_file_tab_t file_tab_;
1364 dst_rec_block_t block_;
1365 dst_rec_var_t var_;
1366 dst_rec_pointer_t pointer_;
1367 dst_rec_array_t array_;
1368 dst_rec_subrange_t subrange_;
1369 dst_rec_set_t set_;
1370 dst_rec_implicit_enum_t implicit_enum_;
1371 dst_rec_explicit_enum_t explicit_enum_;
1372 /* dst_typ_short_{rec,union} are represented by 'rec' (below) */
1373 dst_rec_file_t file_;
1374 dst_rec_offset_t offset_;
1375 dst_rec_alias_t alias_;
1376 dst_rec_signature_t signature_;
1377 dst_rec_old_label_t old_label_;
1378 dst_rec_scope_t scope_;
1379 /* dst_typ_end_scope requires no additional fields */
1380 dst_rec_string_tab_t string_tab_;
1381 /* dst_typ_global_name_tab is represented by 'string_tab' (above) */
1382 dst_rec_forward_t forward_;
1383 dst_rec_aux_size_t aux_size_;
1384 dst_rec_aux_align_t aux_align_;
1385 dst_rec_aux_field_size_t aux_field_size_;
1386 dst_rec_aux_field_off_t aux_field_off_;
1387 dst_rec_aux_field_align_t aux_field_align_;
1388 dst_rec_aux_qual_t aux_qual_;
1389 dst_rec_aux_var_bound_t aux_var_bound_;
1390 dst_rec_extension_t extension_;
1391 dst_rec_string_t string_;
1392 dst_rec_const_t const_;
1393 /* dst_typ_reference is represented by 'pointer' (above) */
1394 dst_rec_record_t record_;
1395 /* dst_typ_union is represented by 'record' (above) */
1396 dst_rec_aux_type_deriv_t aux_type_deriv_;
1397 /* dst_typ_locpool is represented by 'string_tab' (above) */
1398 dst_rec_variable_t variable_;
1399 dst_rec_label_t label_;
1400 dst_rec_entry_t entry_;
1401 dst_rec_aux_lifetime_t aux_lifetime_;
1402 dst_rec_aux_ptr_base_t aux_ptr_base_;
1403 dst_rec_aux_src_range_t aux_src_range_;
1404 dst_rec_aux_reg_val_t aux_reg_val_;
1405 dst_rec_name_tab_t aux_unit_names_;
1406 dst_rec_sect_info_tab_t aux_sect_info_;
1407 }
1408 rec_data ALIGNED1;
1409 }
1410dst_rec_t, *dst_rec_ptr_t;
c906108c
SS
1411
1412
1413/*===============================================*/
1414/*========== .lines SECTION DEFINITIONS =========*/
1415/*===============================================*/
1416/*
c5aa993b
JM
1417 The .lines section contains a sequence of line number tables. There is no
1418 record structure within the section. The start of the table for a routine
1419 is pointed to by the block record, and the end of the table is signaled by
1420 an escape code.
1421
1422 A line number table is a sequence of bytes. The default entry contains a line
1423 number delta (-7..+7) in the high 4 bits and a pc delta (0..15) in the low 4
1424 bits. Special cases, including when one or both of the values is too large
1425 to fit in 4 bits and other special cases are handled through escape entries.
1426 Escape entries are identified by the value 0x8 in the high 4 bits. The low 4
1427 bits are occupied by a function code. Some escape entries are followed by
1428 additional arguments, which may be bytes, words, or longwords. This data is
1429 not aligned.
1430
1431 The initial PC offset, file number and line number are zero. Normally, the
1432 table begins with a dst_ln_file escape which establishes the initial file
1433 and line number. All PC deltas are unsigned (thus the table is ordered by
1434 increasing PC); line number deltas are signed. The table ends with a
1435 dst_ln_end escape, which is followed by a final table entry whose PC delta
1436 gives the code size of the last statement.
1437
1438 Escape Semantic
1439 --------- ------------------------------------------------------------
1440 file Changes file state. The current source file remains constant
1441 until another file escape. Though the line number state is
1442 also updated by a file escape, a file escape does NOT
1443 constitute a line table entry.
1444
1445 statement Alters the statement number of the next table entry. By
1446 default, all table entries refer to the first statement on a
1447 line. Statement number one is the second statement, and so on.
1448
1449 entry Identifies the next table entry as the position of an entry
1450 point for the current block. The PC position should follow
1451 any procedure prologue code. An argument specifies the entry
1452 number, which is keyed to the entry number of the corresponding
1453 .symbols ENTRY record.
1454
1455 exit Identifies the next table entry as the last position within
1456 the current block before a procedure epiloge and subsequent
1457 procedure exit.
1458
1459 gap By default, the executable code corresponding to a table entry
1460 is assumed to extend to the beginning of the next table entry.
1461 If this is not the case--there is a "hole" in the table--then
1462 a gap escape should follow the first table entry to specify
1463 where the code for that entry ends.
1464 */
c906108c 1465
c5aa993b 1466#define dst_ln_escape_flag -8
c906108c
SS
1467
1468/*
c5aa993b
JM
1469 Escape function codes:
1470 */
c906108c 1471typedef enum
c5aa993b
JM
1472 {
1473 dst_ln_pad, /* pad byte */
1474 dst_ln_file, /* file escape. Next 4 bytes are a dst_src_loc_t */
1475 dst_ln_dln1_dpc1, /* 1 byte line delta, 1 byte pc delta */
1476 dst_ln_dln2_dpc2, /* 2 bytes line delta, 2 bytes pc delta */
1477 dst_ln_ln4_pc4, /* 4 bytes ABSOLUTE line number, 4 bytes ABSOLUTE pc */
1478 dst_ln_dln1_dpc0, /* 1 byte line delta, pc delta = 0 */
1479 dst_ln_ln_off_1, /* statement escape, stmt # = 1 (2nd stmt on line) */
1480 dst_ln_ln_off, /* statement escape, stmt # = next byte */
1481 dst_ln_entry, /* entry escape, next byte is entry number */
1482 dst_ln_exit, /* exit escape */
1483 dst_ln_stmt_end, /* gap escape, 4 bytes pc delta */
1484 dst_ln_escape_11, /* reserved */
1485 dst_ln_escape_12, /* reserved */
1486 dst_ln_escape_13, /* reserved */
1487 dst_ln_nxt_byte, /* next byte contains the real escape code */
1488 dst_ln_end, /* end escape, final entry follows */
c906108c 1489 dst_ln_escape_END_OF_ENUM
c5aa993b
JM
1490 }
1491dst_ln_escape_t;
c906108c
SS
1492
1493/*
c5aa993b
JM
1494 Line number table entry
1495 */
c906108c 1496typedef union
c5aa993b 1497 {
c906108c 1498 struct
c5aa993b
JM
1499 {
1500 unsigned int ln_delta:4; /* 4 bit line number delta */
1501 unsigned int pc_delta:4; /* 4 bit pc delta */
1502 }
1503 delta;
1504
c906108c 1505 struct
c5aa993b
JM
1506 {
1507 unsigned int esc_flag:4; /* alias for ln_delta */
1508 dst_ln_escape_t esc_code:4; /* escape function code */
1509 }
1510 esc;
1511
1512 char sdata; /* signed data byte */
1513 unsigned char udata; /* unsigned data byte */
1514 }
1515dst_ln_entry_t,
1516 *dst_ln_entry_ptr_t,
1517 dst_ln_table_t[dst_dummy_array_size];
c906108c
SS
1518
1519/* The following macro will extract the ln_delta field as a signed value:
c5aa993b 1520 */
c906108c
SS
1521#define dst_ln_ln_delta(ln_rec) \
1522 ( ((short) ((ln_rec).delta.ln_delta << 12)) >> 12 )
1523
1524
1525
1526
c5aa993b
JM
1527typedef struct dst_sec_struct
1528 {
1529 char *buffer;
1530 long position;
1531 long size;
1532 long base;
1533 }
1534dst_sec;
c906108c
SS
1535
1536
1537/* Macros for access to the data */
1538
1539#define DST_comp_unit(x) ((x)->rec_data.comp_unit_)
1540#define DST_section_tab(x) ((x)->rec_data.section_tab_)
1541#define DST_file_tab(x) ((x)->rec_data.file_tab_)
1542#define DST_block(x) ((x)->rec_data.block_)
1543#define DST_var(x) ((x)->rec_data.var_)
1544#define DST_pointer(x) ((x)->rec_data.pointer_)
1545#define DST_array(x) ((x)->rec_data.array_)
1546#define DST_subrange(x) ((x)->rec_data.subrange_)
1547#define DST_set(x) ((x)->rec_data.set_)
1548#define DST_implicit_enum(x) ((x)->rec_data.implicit_enum_)
1549#define DST_explicit_enum(x) ((x)->rec_data.explicit_enum_)
1550#define DST_short_rec(x) ((x)->rec_data.record_)
1551#define DST_short_union(x) ((x)->rec_data.record_)
1552#define DST_file(x) ((x)->rec_data.file_)
1553#define DST_offset(x) ((x)->rec_data.offset_)
1554#define DST_alias(x) ((x)->rec_data.alias_)
1555#define DST_signature(x) ((x)->rec_data.signature_)
1556#define DST_old_label(x) ((x)->rec_data.old_label_)
1557#define DST_scope(x) ((x)->rec_data.scope_)
1558#define DST_string_tab(x) ((x)->rec_data.string_tab_)
1559#define DST_global_name_tab(x) ((x)->rec_data.string_tab_)
1560#define DST_forward(x) ((x)->rec_data.forward_)
1561#define DST_aux_size(x) ((x)->rec_data.aux_size_)
1562#define DST_aux_align(x) ((x)->rec_data.aux_align_)
1563#define DST_aux_field_size(x) ((x)->rec_data.aux_field_size_)
1564#define DST_aux_field_off(x) ((x)->rec_data.aux_field_off_)
1565#define DST_aux_field_align(x) ((x)->rec_data.aux_field_align_)
1566#define DST_aux_qual(x) ((x)->rec_data.aux_qual_)
1567#define DST_aux_var_bound(x) ((x)->rec_data.aux_var_bound_)
1568#define DST_extension(x) ((x)->rec_data.extension_)
1569#define DST_string(x) ((x)->rec_data.string_)
1570#define DST_const(x) ((x)->rec_data.const_)
1571#define DST_reference(x) ((x)->rec_data.pointer_)
1572#define DST_record(x) ((x)->rec_data.record_)
1573#define DST_union(x) ((x)->rec_data.record_)
1574#define DST_aux_type_deriv(x) ((x)->rec_data.aux_type_deriv_)
1575#define DST_locpool(x) ((x)->rec_data.string_tab_)
1576#define DST_variable(x) ((x)->rec_data.variable_)
1577#define DST_label(x) ((x)->rec_data.label_)
1578#define DST_entry(x) ((x)->rec_data.entry_)
1579#define DST_aux_lifetime(x) ((x)->rec_data.aux_lifetime_)
1580#define DST_aux_ptr_base(x) ((x)->rec_data.aux_ptr_base_)
1581#define DST_aux_src_range(x) ((x)->rec_data.aux_src_range_)
1582#define DST_aux_reg_val(x) ((x)->rec_data.aux_reg_val_)
1583#define DST_aux_unit_names(x) ((x)->rec_data.aux_unit_names_)
1584#define DST_aux_sect_info(x) ((x)->rec_data.aux_sect_info_)
1585
1586
1587/*
1588 * Type codes for loc strings. I'm not entirely certain about all of
1589 * these, but they seem to work.
c5aa993b 1590 * troy@cbme.unsw.EDU.AU
c906108c
SS
1591 * If you find a variable whose location can't be decoded, you should
1592 * find out it's code using "dstdump -s filename". It will record an
1593 * entry for the variable, and give a text representation of what
1594 * the locstring means. Before that explaination there will be a
1595 * number. In the LOCSTRING table, that number will appear before
1596 * the start of the location string. Location string codes are
1597 * five bit codes with a 3 bit argument. Check the high 5 bits of
1598 * the one byte code, and figure out where it goes in here.
1599 * Then figure out exactly what the meaning is and code it in
1600 * dstread.c
1601 *
1602 * Note that ranged locs mean that the variable is in different locations
1603 * depending on the current PC. We ignore these because (a) gcc can't handle
1604 * them, and (b), If you don't use high levels of optimisation they won't
1605 * occur.
1606 */
1607typedef enum
c5aa993b
JM
1608 {
1609 dst_lsc_end, /* End of string */
1610 dst_lsc_indirect, /* Indirect through previous. Arg == 6 */
1611 /* Or register ax (x=arg) */
1612 dst_lsc_dreg, /* register dx (x=arg) */
1613 dst_lsc_03,
1614 dst_lsc_section, /* Section (arg+1) */
1615 dst_lsc_05,
1616 dst_lsc_06,
1617 dst_lsc_add, /* Add (arg+1)*2 */
1618 dst_lsc_sub, /* Subtract (arg+1)*2 */
1619 dst_lsc_09,
1620 dst_lsc_0a,
1621 dst_lsc_sec_byte, /* Section of next byte+1 */
1622 dst_lsc_add_byte, /* Add next byte (arg == 5) or next word
c906108c
SS
1623 * (arg == 6)
1624 */
c5aa993b 1625 dst_lsc_sub_byte, /* Subtract next byte. (arg == 1) or next
c906108c
SS
1626 * word (arg == 6 ?)
1627 */
c5aa993b
JM
1628 dst_lsc_sbreg, /* Stack base register (frame pointer). Arg==0 */
1629 dst_lsc_0f,
1630 dst_lsc_ranged, /* location is pc dependent */
1631 dst_lsc_11,
1632 dst_lsc_12,
1633 dst_lsc_13,
1634 dst_lsc_14,
1635 dst_lsc_15,
1636 dst_lsc_16,
1637 dst_lsc_17,
1638 dst_lsc_18,
1639 dst_lsc_19,
1640 dst_lsc_1a,
1641 dst_lsc_1b,
1642 dst_lsc_1c,
1643 dst_lsc_1d,
1644 dst_lsc_1e,
1645 dst_lsc_1f
1646 }
1647dst_loc_string_code_t;
c906108c
SS
1648
1649/* If the following occurs after an addition/subtraction, that addition
1650 * or subtraction should be multiplied by 256. It's a complete byte, not
1651 * a code.
1652 */
1653
1654#define dst_multiply_256 ((char) 0x73)
1655
1656typedef struct
c5aa993b
JM
1657 {
1658 char code:5;
1659 char arg:3;
1660 }
1661dst_loc_header_t ALIGNED1;
c906108c
SS
1662
1663typedef union
c5aa993b
JM
1664 {
1665 dst_loc_header_t header;
1666 char data;
1667 }
1668dst_loc_entry_t ALIGNED1;
c906108c
SS
1669
1670#undef ALIGNED1
c5aa993b 1671#endif /* apollo_dst_h */