]>
Commit | Line | Data |
---|---|---|
835fe6e6 JK |
1 | /* <apollo/dst.h> */ |
2 | /* Apollo object module DST (debug symbol table) description */ | |
3 | ||
4 | #ifndef apollo_dst_h | |
5 | #define apollo_dst_h | |
6 | ||
7 | #if defined(apollo) && !defined(__GNUC__) | |
8 | #define ALIGNED1 __attribute( (aligned(1)) ) | |
9 | #else | |
10 | /* Remove attribute directives from non-Apollo code: */ | |
11 | #define ALIGNED1 /* nil */ | |
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 . | |
19 | */ | |
20 | #define dst_version_major 1 | |
21 | #define dst_version_minor 3 | |
22 | ||
23 | ||
24 | /* | |
25 | ** Enumeration of debug record types appearing in .blocks and .symbols ... | |
26 | */ | |
27 | typedef enum | |
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 */ | |
34 | dst_typ_5, | |
35 | dst_typ_var, | |
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 */ | |
43 | dst_typ_old_record, | |
44 | dst_typ_short_union, /* 15 */ | |
45 | dst_typ_old_union, | |
46 | dst_typ_file, /* 17 */ | |
47 | dst_typ_offset, /* 18 */ | |
48 | dst_typ_alias, /* 19 */ | |
49 | dst_typ_signature, /* 20 */ | |
50 | dst_typ_21, | |
51 | dst_typ_old_label, /* 22 */ | |
52 | dst_typ_scope, /* 23 */ | |
53 | dst_typ_end_scope, /* 24 */ | |
54 | dst_typ_25, | |
55 | dst_typ_26, | |
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 */ | |
68 | dst_typ_old_entry, | |
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 */ | |
84 | dst_typ_END_OF_ENUM | |
85 | } | |
86 | dst_rec_type_t; | |
87 | ||
88 | ||
89 | /* | |
90 | ** Dummy bounds for variably dimensioned arrays: | |
91 | */ | |
92 | #define dst_dummy_array_size 100 | |
93 | ||
94 | ||
95 | /* | |
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 | */ | |
103 | ||
104 | typedef long dst_rel_offset_t ALIGNED1; | |
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 | /* | |
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 | */ | |
123 | ||
124 | typedef struct | |
125 | { | |
126 | unsigned short sect_index; | |
127 | unsigned long sect_offset ALIGNED1; | |
128 | } | |
129 | dst_sect_ref_t; | |
130 | ||
131 | #define dst_sect_index_nil 0 | |
132 | #define dst_sect_index_origin 1 | |
133 | ||
134 | ||
135 | /* | |
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 | */ | |
144 | ||
145 | typedef struct | |
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 | } | |
151 | dst_src_loc_t; | |
152 | ||
153 | #define dst_file_index_nil 0 | |
154 | #define dst_file_index_origin 1 | |
155 | ||
156 | ||
157 | /* | |
158 | ** Standard (primitive) type codes. | |
159 | */ | |
160 | ||
161 | typedef enum | |
162 | { | |
163 | dst_non_std_type, | |
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 | |
186 | } | |
187 | dst_std_type_t; | |
188 | ||
189 | ||
190 | /* | |
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 | */ | |
198 | ||
199 | typedef union | |
200 | { | |
201 | struct | |
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 | ||
209 | struct | |
210 | { | |
211 | boolean user_defined_type : 1; /* tag field */ | |
212 | int doffset : 31; /* offset to type record */ | |
213 | } | |
214 | user_type; | |
215 | } | |
216 | dst_type_t ALIGNED1; | |
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: | |
221 | */ | |
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 | ||
238 | typedef enum | |
239 | { | |
240 | dst_pc_code_locs, /* ranges in loc strings are pc ranges */ | |
241 | dst_comp_unit_END_OF_ENUM | |
242 | } | |
243 | dst_comp_unit_flag_t; | |
244 | ||
245 | typedef enum | |
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++ */ | |
256 | dst_lang_END_OF_ENUM | |
257 | } | |
258 | dst_lang_type_t; | |
259 | ||
260 | typedef struct | |
261 | { | |
262 | struct | |
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 | } | |
276 | dst_rec_comp_unit_t ALIGNED1; | |
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 | ||
288 | typedef struct | |
289 | { | |
290 | unsigned short number_of_sections; /* size of array: */ | |
291 | unsigned long section_base[dst_dummy_array_size] ALIGNED1; | |
292 | } | |
293 | dst_rec_section_tab_t ALIGNED1; | |
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 | ||
305 | typedef struct | |
306 | { | |
307 | long dtm; /* time last modified (time_$clock_t) */ | |
308 | dst_rel_offset_t noffset; /* offset to name string for source file */ | |
309 | } | |
310 | dst_file_desc_t; | |
311 | ||
312 | typedef struct | |
313 | { | |
314 | unsigned short number_of_files; /* size of array: */ | |
315 | dst_file_desc_t files[dst_dummy_array_size] ALIGNED1; | |
316 | } | |
317 | dst_rec_file_tab_t ALIGNED1; | |
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 | ||
329 | typedef struct | |
330 | { | |
331 | unsigned short number_of_names; /* size of array: */ | |
332 | dst_rel_offset_t names[dst_dummy_array_size] ALIGNED1; | |
333 | } | |
334 | dst_rec_name_tab_t ALIGNED1; | |
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. | |
349 | */ | |
350 | typedef enum | |
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 */ | |
365 | dst_block_END_OF_ENUM | |
366 | } | |
367 | dst_block_type_t; | |
368 | ||
369 | /* Block attributes. This is the information used by the debugger to represent | |
370 | the semantics of blocks. | |
371 | */ | |
372 | typedef enum | |
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 */ | |
377 | dst_block_attr_END_OF_ENUM | |
378 | } | |
379 | dst_block_attr_t; | |
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. | |
385 | */ | |
386 | typedef struct | |
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 | } | |
392 | dst_code_range_t; | |
393 | ||
394 | typedef struct | |
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 | } | |
405 | dst_rec_block_t ALIGNED1; | |
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 | ||
417 | typedef struct | |
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 | } | |
423 | dst_rec_sect_info_tab_t ALIGNED1; | |
424 | ||
425 | /*=================================================*/ | |
426 | /*========== RECORDS IN .symbols SECTION ==========*/ | |
427 | /*=================================================*/ | |
428 | ||
429 | /*----------------- | |
430 | CONSTANT record | |
431 | ----------------- | |
432 | Describes a symbolic constant. | |
433 | */ | |
434 | ||
435 | typedef struct | |
436 | { | |
437 | float r; /* real part */ | |
438 | float i; /* imaginary part */ | |
439 | } | |
440 | dst_complex_t; | |
441 | ||
442 | typedef struct | |
443 | { | |
444 | double dr; /* real part */ | |
445 | double di; /* imaginary part */ | |
446 | } | |
447 | dst_double_complex_t; | |
448 | ||
449 | /* The following record provides a way of describing constant values with | |
450 | non-standard type and no limit on size. | |
451 | */ | |
452 | typedef union | |
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 | } | |
458 | dst_big_kon_t; | |
459 | ||
460 | /* Representation of the value of a general constant. | |
461 | */ | |
462 | typedef struct | |
463 | { | |
464 | unsigned short length; /* size of constant value (bytes) */ | |
465 | ||
466 | union | |
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 | } | |
480 | dst_const_t ALIGNED1; | |
481 | ||
482 | typedef struct | |
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 | } | |
489 | dst_rec_const_t ALIGNED1; | |
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. | |
499 | */ | |
500 | typedef enum | |
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 */ | |
507 | dst_var_attr_END_OF_ENUM | |
508 | } | |
509 | dst_var_attr_t; | |
510 | ||
511 | typedef struct | |
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 | } | |
519 | dst_rec_variable_t ALIGNED1; | |
520 | ||
521 | ||
522 | /*---------------- | |
523 | old VAR record | |
524 | ----------------- | |
525 | Used by older compilers to describe a variable | |
526 | */ | |
527 | ||
528 | typedef enum | |
529 | { | |
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 | |
541 | } | |
542 | dst_var_loc_t; | |
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 | ||
551 | typedef 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 | } dst_var_loc_short_t; | |
559 | ||
560 | typedef struct | |
561 | { | |
562 | unsigned short loc_type; | |
563 | unsigned short loc_index; | |
564 | long location; | |
565 | short unknown; /* Always 0003 or 3b3c. Why? */ | |
566 | short start_statement; | |
567 | short start_line; | |
568 | short end_statement; | |
569 | short end_line; | |
570 | } dst_var_loc_long_t; | |
571 | ||
572 | ||
573 | typedef struct | |
574 | { | |
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. */ | |
581 | union | |
582 | { | |
583 | dst_var_loc_short_t shorts[dst_dummy_array_size]; | |
584 | dst_var_loc_long_t longs[dst_dummy_array_size]; | |
585 | } locs; | |
586 | } dst_rec_var_t; | |
587 | ||
588 | /*---------------- | |
589 | old LABEL record | |
590 | ----------------- | |
591 | Used by older compilers to describe a label | |
592 | */ | |
593 | ||
594 | typedef struct | |
595 | { | |
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 */ | |
599 | } | |
600 | dst_rec_old_label_t ALIGNED1; | |
601 | ||
602 | /*---------------- | |
603 | POINTER record | |
604 | ---------------- | |
605 | Describes a pointer type. | |
606 | */ | |
607 | ||
608 | typedef struct | |
609 | { | |
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 */ | |
613 | } | |
614 | dst_rec_pointer_t ALIGNED1; | |
615 | ||
616 | ||
617 | /*------------- | |
618 | ARRAY record | |
619 | ------------- | |
620 | Describes an array type. | |
621 | ||
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 | |
625 | set. | |
626 | ||
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). | |
630 | ||
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. | |
634 | ||
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. | |
642 | */ | |
643 | ||
644 | typedef enum | |
645 | { | |
646 | dst_use_span_field, | |
647 | dst_compute_from_prev, | |
648 | dst_compute_from_next, | |
649 | dst_span_comp_END_OF_ENUM | |
650 | } | |
651 | dst_span_comp_t; | |
652 | ||
653 | typedef struct | |
654 | { | |
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) */ | |
670 | } | |
671 | dst_rec_array_t ALIGNED1; | |
672 | ||
673 | ||
674 | /*----------------- | |
675 | SUBRANGE record | |
676 | ----------------- | |
677 | Describes a subrange type. | |
678 | */ | |
679 | ||
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. | |
683 | */ | |
684 | ||
685 | typedef struct | |
686 | { | |
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) */ | |
693 | } | |
694 | dst_rec_subrange_t ALIGNED1; | |
695 | ||
696 | ||
697 | /*--------------- | |
698 | STRING record | |
699 | --------------- | |
700 | Describes a string type. | |
701 | */ | |
702 | ||
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. | |
706 | */ | |
707 | ||
708 | typedef struct | |
709 | { | |
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 */ | |
717 | } | |
718 | dst_rec_string_t ALIGNED1; | |
719 | ||
720 | ||
721 | /*--------------- | |
722 | SET record | |
723 | --------------- | |
724 | Describes a set type. | |
725 | */ | |
726 | ||
727 | typedef struct | |
728 | { | |
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) */ | |
734 | } | |
735 | dst_rec_set_t ALIGNED1; | |
736 | ||
737 | ||
738 | /*----------------------------- | |
739 | IMPLICIT ENUMERATION record | |
740 | ----------------------------- | |
741 | Describes an enumeration type with implicit element values = 0, 1, 2, ... | |
742 | (Pascal-style). | |
743 | */ | |
744 | ||
745 | typedef struct | |
746 | { | |
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]; | |
753 | } | |
754 | dst_rec_implicit_enum_t ALIGNED1; | |
755 | ||
756 | ||
757 | /*----------------------------- | |
758 | EXPLICIT ENUMERATION record | |
759 | ----------------------------- | |
760 | Describes an enumeration type with explicitly assigned element values | |
761 | (C-style). | |
762 | */ | |
763 | ||
764 | typedef struct | |
765 | { | |
766 | dst_rel_offset_t noffset; /* offset to element name string */ | |
767 | long value; /* element value */ | |
768 | } | |
769 | dst_enum_elem_t; | |
770 | ||
771 | typedef struct | |
772 | { | |
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]; | |
779 | } | |
780 | dst_rec_explicit_enum_t ALIGNED1; | |
781 | ||
782 | ||
783 | /*----------------------- | |
784 | RECORD / UNION record | |
785 | ----------------------- | |
786 | Describes a record (struct) or union. | |
787 | ||
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. | |
791 | ||
792 | Whether the fields[] array or sfields[] array is used is selected by | |
793 | the dst_rec_type_t of the overall dst record. | |
794 | */ | |
795 | ||
796 | /* | |
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 | |
799 | start of the record. | |
800 | */ | |
801 | typedef struct | |
802 | { | |
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) */ | |
806 | } | |
807 | dst_short_field_t ALIGNED1; | |
808 | ||
809 | typedef struct | |
810 | { | |
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 */ | |
819 | } | |
820 | dst_old_field_t ALIGNED1; | |
821 | ||
822 | /* Tag enumeration for long record field descriptor: | |
823 | */ | |
824 | typedef enum | |
825 | { | |
826 | dst_field_byte, | |
827 | dst_field_bit, | |
828 | dst_field_loc, | |
829 | dst_field_END_OF_ENUM | |
830 | } | |
831 | dst_field_format_t; | |
832 | ||
833 | /* | |
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 | |
840 | string. | |
841 | */ | |
842 | typedef struct | |
843 | { | |
844 | dst_rel_offset_t noffset; /* offset to name of field */ | |
845 | dst_type_t type_desc; /* type of field */ | |
846 | union | |
847 | { | |
848 | struct { | |
849 | dst_field_format_t format_tag: 2; /* dst_field_byte */ | |
850 | unsigned long offset: 30; /* offset of field in bytes */ | |
851 | } | |
852 | field_byte ALIGNED1; | |
853 | struct { | |
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 */ | |
860 | } | |
861 | field_bit ALIGNED1; | |
862 | struct { | |
863 | dst_field_format_t format_tag: 2; /* dst_field_loc */ | |
864 | int loffset: 30; /* dst_rel_offset_t to loc string */ | |
865 | } | |
866 | field_loc ALIGNED1; | |
867 | } | |
868 | f ALIGNED1; | |
869 | } | |
870 | dst_field_t; | |
871 | ||
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 | |
874 | as a signed value: | |
875 | */ | |
876 | #define dst_field_loffset(field_rec) \ | |
877 | ( ((int) ((field_rec).f.field_loc.loffset << 2)) >> 2 ) | |
878 | ||
879 | ||
880 | typedef struct | |
881 | { | |
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 */ | |
886 | union | |
887 | { | |
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]; | |
891 | } | |
892 | f; /* array of fields */ | |
893 | } | |
894 | dst_rec_record_t ALIGNED1; | |
895 | ||
896 | ||
897 | /*------------- | |
898 | FILE record | |
899 | ------------- | |
900 | Describes a file type. | |
901 | */ | |
902 | ||
903 | typedef struct | |
904 | { | |
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 */ | |
908 | } | |
909 | dst_rec_file_t ALIGNED1; | |
910 | ||
911 | ||
912 | /*--------------- | |
913 | OFFSET record | |
914 | --------------- | |
915 | Describes a Pascal offset type. | |
916 | (This type, an undocumented Domain Pascal extension, is currently not | |
917 | supported by the debugger) | |
918 | */ | |
919 | ||
920 | typedef struct | |
921 | { | |
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) */ | |
931 | } | |
932 | dst_rec_offset_t ALIGNED1; | |
933 | ||
934 | ||
935 | /*-------------- | |
936 | ALIAS record | |
937 | -------------- | |
938 | Describes a type alias (e.g., typedef). | |
939 | */ | |
940 | ||
941 | typedef struct | |
942 | { | |
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 */ | |
946 | } | |
947 | dst_rec_alias_t ALIGNED1; | |
948 | ||
949 | ||
950 | /*------------------ | |
951 | SIGNATURE record | |
952 | ------------------ | |
953 | Describes a procedure/function type. | |
954 | */ | |
955 | ||
956 | /* Enumeration of argument semantics. Note that most are mutually | |
957 | exclusive. | |
958 | */ | |
959 | typedef enum | |
960 | { | |
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 | |
968 | } | |
969 | dst_arg_attr_t; | |
970 | ||
971 | /* Argument descriptor. Actually points to a variable record for most of the | |
972 | information. | |
973 | */ | |
974 | typedef struct | |
975 | { | |
976 | dst_rel_offset_t var_offset; /* offset to variable record */ | |
977 | unsigned short attributes; /* a mask of dst_arg_attr_t flags */ | |
978 | } | |
979 | dst_arg_t ALIGNED1; | |
980 | ||
981 | typedef struct | |
982 | { | |
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]; | |
988 | } | |
989 | dst_rec_signature_t ALIGNED1; | |
990 | ||
991 | /*-------------- | |
992 | SCOPE record | |
993 | -------------- | |
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. | |
997 | */ | |
998 | ||
999 | typedef struct | |
1000 | { | |
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 */ | |
1004 | } | |
1005 | dst_rec_scope_t ALIGNED1; | |
1006 | ||
1007 | /*-------------- | |
1008 | ENTRY record | |
1009 | -------------- | |
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. | |
1012 | ||
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. | |
1017 | */ | |
1018 | ||
1019 | typedef struct | |
1020 | { | |
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 */ | |
1027 | } | |
1028 | dst_rec_entry_t ALIGNED1; | |
1029 | ||
1030 | /*----------------------- | |
1031 | Old format ENTRY record | |
1032 | ----------------------- | |
1033 | Supposedly obsolete but still used by some compilers. | |
1034 | */ | |
1035 | ||
1036 | typedef struct | |
1037 | { | |
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 */ | |
1041 | char unknown[36]; | |
1042 | } | |
1043 | dst_rec_old_entry_t ALIGNED1; | |
1044 | ||
1045 | /*-------------- | |
1046 | LABEL record | |
1047 | -------------- | |
1048 | Describes a program label. | |
1049 | */ | |
1050 | ||
1051 | typedef struct | |
1052 | { | |
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 */ | |
1056 | } | |
1057 | dst_rec_label_t ALIGNED1; | |
1058 | ||
1059 | ||
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. | |
1065 | */ | |
1066 | ||
1067 | typedef struct | |
1068 | { | |
1069 | unsigned long size; /* size (bytes) */ | |
1070 | } | |
1071 | dst_rec_aux_size_t ALIGNED1; | |
1072 | ||
1073 | ||
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. | |
1079 | */ | |
1080 | ||
1081 | typedef struct | |
1082 | { | |
1083 | unsigned short alignment; /* # of low order zero bits */ | |
1084 | } | |
1085 | dst_rec_aux_align_t ALIGNED1; | |
1086 | ||
1087 | ||
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. | |
1093 | */ | |
1094 | ||
1095 | typedef struct | |
1096 | { | |
1097 | unsigned short field_no; /* field number */ | |
1098 | unsigned long size; /* size (bits) */ | |
1099 | } | |
1100 | dst_rec_aux_field_size_t ALIGNED1; | |
1101 | ||
1102 | ||
1103 | ||
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. | |
1109 | */ | |
1110 | ||
1111 | typedef struct | |
1112 | { | |
1113 | unsigned short field_no; /* field number */ | |
1114 | unsigned long foffset; /* offset */ | |
1115 | } | |
1116 | dst_rec_aux_field_off_t ALIGNED1; | |
1117 | ||
1118 | ||
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. | |
1124 | */ | |
1125 | ||
1126 | typedef struct | |
1127 | { | |
1128 | unsigned short field_no; /* field number */ | |
1129 | unsigned short alignment; /* number of low order zero bits */ | |
1130 | } | |
1131 | dst_rec_aux_field_align_t ALIGNED1; | |
1132 | ||
1133 | ||
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. | |
1139 | */ | |
1140 | ||
1141 | typedef enum | |
1142 | { | |
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 | |
1146 | } | |
1147 | dst_var_bound_t; | |
1148 | ||
1149 | typedef struct | |
1150 | { | |
1151 | unsigned short which; /* which bound */ | |
1152 | dst_rel_offset_t voffset ALIGNED1; /* variable that defines bound */ | |
1153 | } | |
1154 | dst_rec_aux_var_bound_t ALIGNED1; | |
1155 | ||
1156 | ||
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. | |
1162 | ||
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). | |
1170 | */ | |
1171 | ||
1172 | typedef struct | |
1173 | { | |
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 */ | |
1178 | } | |
1179 | dst_rec_aux_type_deriv_t ALIGNED1; | |
1180 | ||
1181 | ||
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. | |
1187 | */ | |
1188 | ||
1189 | typedef struct | |
1190 | { | |
1191 | dst_rel_offset_t loffset; | |
1192 | } | |
1193 | dst_rec_aux_lifetime_t ALIGNED1; | |
1194 | ||
1195 | ||
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. | |
1204 | ||
1205 | This is useful for representing FORTRAN pointer-based variables. | |
1206 | */ | |
1207 | ||
1208 | typedef struct | |
1209 | { | |
1210 | dst_rel_offset_t voffset; | |
1211 | } | |
1212 | dst_rec_aux_ptr_base_t ALIGNED1; | |
1213 | ||
1214 | ||
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. | |
1228 | */ | |
1229 | ||
1230 | typedef struct | |
1231 | { | |
1232 | unsigned short reg; /* identifies register to set (isp enum) */ | |
1233 | dst_rel_offset_t loffset; /* references a location string */ | |
1234 | } | |
1235 | dst_rec_aux_reg_val_t ALIGNED1; | |
1236 | ||
1237 | ||
1238 | /*==========================================================*/ | |
1239 | /*========== RECORDS USED IN .blocks AND .symbols ==========*/ | |
1240 | /*==========================================================*/ | |
1241 | ||
1242 | /*--------------------- | |
1243 | STRING TABLE record | |
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 | |
1247 | can be any size. | |
1248 | ||
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. | |
1252 | ||
1253 | The loc pool record shares this format as well. Loc strings are described | |
1254 | elsewhere. | |
1255 | */ | |
1256 | ||
1257 | typedef struct | |
1258 | { | |
1259 | unsigned long length; | |
1260 | char text[dst_dummy_array_size]; | |
1261 | } | |
1262 | dst_rec_string_tab_t ALIGNED1; | |
1263 | ||
1264 | ||
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. | |
1270 | */ | |
1271 | ||
1272 | typedef struct | |
1273 | { | |
1274 | dst_rel_offset_t lang_qual_name; | |
1275 | } | |
1276 | dst_rec_aux_qual_t ALIGNED1; | |
1277 | ||
1278 | ||
1279 | /*---------------- | |
1280 | FORWARD record | |
1281 | ---------------- | |
1282 | Reference to a record somewhere else. This allows identical definitions in | |
1283 | different scopes to share data. | |
1284 | */ | |
1285 | ||
1286 | typedef struct | |
1287 | { | |
1288 | dst_rel_offset_t rec_off; | |
1289 | } | |
1290 | dst_rec_forward_t ALIGNED1; | |
1291 | ||
1292 | ||
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. | |
1298 | */ | |
1299 | ||
1300 | typedef struct | |
1301 | { | |
1302 | dst_src_loc_t first_line; /* first source line */ | |
1303 | dst_src_loc_t last_line; /* last source line */ | |
1304 | } | |
1305 | dst_rec_aux_src_range_t ALIGNED1; | |
1306 | ||
1307 | ||
1308 | /*------------------ | |
1309 | EXTENSION record | |
1310 | ------------------ | |
1311 | Provision for "foreign" records, such as might be generated by a non-Apollo | |
1312 | compiler. Apollo software will ignore these. | |
1313 | */ | |
1314 | ||
1315 | typedef struct | |
1316 | { | |
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 */ | |
1320 | } | |
1321 | dst_rec_extension_t ALIGNED1; | |
1322 | ||
1323 | ||
1324 | /* | |
1325 | ** DEBUG SYMBOL record -- The wrapper for all .blocks and .symbols records. | |
1326 | ** | |
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. | |
1331 | ** | |
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. | |
1337 | */ | |
1338 | ||
1339 | typedef enum | |
1340 | { | |
1341 | dst_flag_has_aux_recs, | |
1342 | dst_flag_last_aux_rec, | |
1343 | dst_rec_flag_END_OF_ENUM | |
1344 | } | |
1345 | dst_rec_flags_t; | |
1346 | ||
1347 | typedef struct | |
1348 | { | |
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 */ | |
1352 | { | |
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_; | |
1358 | dst_rec_var_t var_; | |
1359 | dst_rec_pointer_t pointer_; | |
1360 | dst_rec_array_t array_; | |
1361 | dst_rec_subrange_t subrange_; | |
1362 | dst_rec_set_t set_; | |
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_; | |
1400 | } | |
1401 | rec_data ALIGNED1; | |
1402 | } | |
1403 | dst_rec_t, *dst_rec_ptr_t; | |
1404 | ||
1405 | ||
1406 | /*===============================================*/ | |
1407 | /*========== .lines SECTION DEFINITIONS =========*/ | |
1408 | /*===============================================*/ | |
1409 | /* | |
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 | |
1413 | an escape code. | |
1414 | ||
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 | |
1422 | not aligned. | |
1423 | ||
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. | |
1430 | ||
1431 | Escape Semantic | |
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. | |
1437 | ||
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. | |
1441 | ||
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. | |
1447 | ||
1448 | exit Identifies the next table entry as the last position within | |
1449 | the current block before a procedure epiloge and subsequent | |
1450 | procedure exit. | |
1451 | ||
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. | |
1457 | */ | |
1458 | ||
1459 | #define dst_ln_escape_flag -8 | |
1460 | ||
1461 | /* | |
1462 | Escape function codes: | |
1463 | */ | |
1464 | typedef enum | |
1465 | { | |
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 | |
1483 | } | |
1484 | dst_ln_escape_t; | |
1485 | ||
1486 | /* | |
1487 | Line number table entry | |
1488 | */ | |
1489 | typedef union | |
1490 | { | |
1491 | struct | |
1492 | { | |
1493 | unsigned int ln_delta : 4; /* 4 bit line number delta */ | |
1494 | unsigned int pc_delta : 4; /* 4 bit pc delta */ | |
1495 | } | |
1496 | delta; | |
1497 | ||
1498 | struct | |
1499 | { | |
1500 | unsigned int esc_flag : 4; /* alias for ln_delta */ | |
1501 | dst_ln_escape_t esc_code : 4; /* escape function code */ | |
1502 | } | |
1503 | esc; | |
1504 | ||
1505 | char sdata; /* signed data byte */ | |
1506 | unsigned char udata; /* unsigned data byte */ | |
1507 | } | |
1508 | dst_ln_entry_t, | |
1509 | *dst_ln_entry_ptr_t, | |
1510 | dst_ln_table_t[dst_dummy_array_size]; | |
1511 | ||
1512 | /* The following macro will extract the ln_delta field as a signed value: | |
1513 | */ | |
1514 | #define dst_ln_ln_delta(ln_rec) \ | |
1515 | ( ((short) ((ln_rec).delta.ln_delta << 12)) >> 12 ) | |
1516 | ||
1517 | ||
1518 | ||
1519 | ||
1520 | typedef struct dst_sec_struct { | |
1521 | char *buffer; | |
1522 | long position; | |
1523 | long size; | |
1524 | long base; | |
1525 | } dst_sec; | |
1526 | ||
1527 | ||
1528 | /* Macros for access to the data */ | |
1529 | ||
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_) | |
1576 | ||
1577 | ||
1578 | /* | |
1579 | * Type codes for loc strings. I'm not entirely certain about all of | |
1580 | * these, but they seem to work. | |
1581 | * [email protected] | |
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 | |
1591 | * dstread.c | |
1592 | * | |
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 | |
1596 | * occur. | |
1597 | */ | |
1598 | typedef enum | |
1599 | { | |
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) */ | |
1604 | dst_lsc_03, | |
1605 | dst_lsc_section, /* Section (arg+1) */ | |
1606 | dst_lsc_05, | |
1607 | dst_lsc_06, | |
1608 | dst_lsc_add, /* Add (arg+1)*2 */ | |
1609 | dst_lsc_sub, /* Subtract (arg+1)*2 */ | |
1610 | dst_lsc_09, | |
1611 | dst_lsc_0a, | |
1612 | dst_lsc_sec_byte, /* Section of next byte+1 */ | |
1613 | dst_lsc_add_byte, /* Add next byte (arg == 5) or next word | |
1614 | * (arg == 6) | |
1615 | */ | |
1616 | dst_lsc_sub_byte, /* Subtract next byte. (arg == 1) or next | |
1617 | * word (arg == 6 ?) | |
1618 | */ | |
1619 | dst_lsc_sbreg, /* Stack base register (frame pointer). Arg==0*/ | |
1620 | dst_lsc_0f, | |
1621 | dst_lsc_ranged, /* location is pc dependent */ | |
1622 | dst_lsc_11, | |
1623 | dst_lsc_12, | |
1624 | dst_lsc_13, | |
1625 | dst_lsc_14, | |
1626 | dst_lsc_15, | |
1627 | dst_lsc_16, | |
1628 | dst_lsc_17, | |
1629 | dst_lsc_18, | |
1630 | dst_lsc_19, | |
1631 | dst_lsc_1a, | |
1632 | dst_lsc_1b, | |
1633 | dst_lsc_1c, | |
1634 | dst_lsc_1d, | |
1635 | dst_lsc_1e, | |
1636 | dst_lsc_1f | |
1637 | } dst_loc_string_code_t; | |
1638 | ||
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 | |
1641 | * a code. | |
1642 | */ | |
1643 | ||
1644 | #define dst_multiply_256 ((char) 0x73) | |
1645 | ||
1646 | typedef struct | |
1647 | { | |
1648 | char code : 5; | |
1649 | char arg : 3; | |
1650 | } dst_loc_header_t ALIGNED1; | |
1651 | ||
1652 | typedef union | |
1653 | { | |
1654 | dst_loc_header_t header; | |
1655 | char data; | |
1656 | } dst_loc_entry_t ALIGNED1; | |
1657 | ||
1658 | #undef ALIGNED1 | |
1659 | #endif /* apollo_dst_h */ |