Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 * Copyright 2003, 2004 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2 of the GNU General Public License as 00011 published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00029 Mountain View, CA 94043, or: 00030 00031 http://www.sgi.com 00032 00033 For further information regarding this notice, see: 00034 00035 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00036 00037 */ 00038 00039 00040 #ifndef dwarf_DST_INCLUDED 00041 #define dwarf_DST_INCLUDED 00042 00043 00044 #ifdef _KEEP_RCS_ID 00045 #endif /* _KEEP_RCS_ID */ 00046 00047 /* The version number will be accessible through the routines in 00048 * dwarf_DST_mem.c and is passed through the .B file. This will 00049 * permit a compatibility check on the consumer side in the compiler 00050 * back-end. 00051 * 00052 * Version 0 : Initial version of the DST data structure! 00053 */ 00054 #define dwarf_DST_version 0x0 00055 00056 00057 #include "dwarf.h" 00058 #include "dwarf_DST_mem.h" 00059 #include "symtab_idx.h" /* defines ST_IDX */ 00060 #include "srcpos.h" /* defines USRCPOS */ 00061 00062 #ifdef __cplusplus 00063 extern "C" { 00064 #endif 00065 00066 /*----------------------------* 00067 * Basic types and definitions * 00068 *-----------------------------*/ 00069 00070 00071 /* General purpose flags, both representing explicit and implicit 00072 * attributes of DST_info objects. 00073 */ 00074 #define DST_no_flag 0x00000000 /* No flag values are set */ 00075 #define DST_flag_external 0x00000001 /* AT_external = TRUE */ 00076 #define DST_flag_declaration 0x00000002 /* AT_declaration = TRUE */ 00077 #define DST_flag_prototyped 0x00000008 /* AT_prototyped = TRUE */ 00078 #define DST_flag_memdef 0x00000010 /* Has an AT_specification */ 00079 #define DST_flag_const 0x00000020 /* Has an AT_const_value */ 00080 #define DST_flag_automatic 0x00000040 /* Is a local variable */ 00081 #define DST_flag_optional_parm 0x00000080 /* AT_is_optional = TRUE */ 00082 #define DST_flag_variable_parm 0x00000100 /* AT_variable_parameter=TRUE */ 00083 #define DST_flag_bitfield 0x00000200 /* TRUE when a bitfield member */ 00084 #define DST_flag_comm 0x00000400 /* TRUE if variable is part of a common block */ 00085 #define DST_flag_lb_cval 0x00000800 /* true if lower bound of subrange is constant */ 00086 #define DST_flag_ub_cval 0x00001000 /* true if upper bound of subrange is constant */ 00087 #define DST_flag_cval 0x00002000 /* true if it is a constant */ 00088 #define DST_flag_artificial 0x00004000 /* true if it is an artificial entity */ 00089 #define DST_flag_deref 0x00008000 /* true if symbol should be dereferenced */ 00090 #define DST_flag_base_deref 0x00010000 /* true if symbol's base should be dereferenced */ 00091 #define DST_flag_count 0x00020000 /* true if subrange contains extent(ie: !upper bound) */ 00092 #define DST_flag_stride_1byte 0x00040000 /* true if DW_AT_stride is in byte increments */ 00093 #define DST_flag_stride_2byte 0x00080000 /* true if DW_AT_stride is in 2 byte increments */ 00094 #define DST_flag_f90_pointer 0x00100000 /* true if symbol is a pointer */ 00095 #define DST_flag_allocatable 0x00200000 /* true if symbol is allocatable*/ 00096 #define DST_flag_assumed_shape 0x00400000 /* true if symbol is assumed shape*/ 00097 #define DST_flag_assumed_size 0x00800000 /* true if symbol is assumed size*/ 00098 #define DST_flag_assoc_fe 0x10000000 /* pointer to front-end entity */ 00099 #define DST_flag_assoc_be 0x20000000 /* pointer to back-end entity */ 00100 #define DST_flag_assoc_idx 0x40000000 /* index to back-end entity */ 00101 00102 #define DST_flag_info_mark 0x80000000 /* DST_info mark for traversal */ 00103 #define DST_flag_static 0x100000000LL /* Has no AT_data_member_location */ 00104 #define DST_flag_mask 0xffffffff 00105 00106 #define DST_SET_external(flag) (flag |= DST_flag_external) 00107 #define DST_SET_declaration(flag) (flag |= DST_flag_declaration) 00108 #define DST_SET_prototyped(flag) (flag |= DST_flag_prototyped) 00109 #define DST_SET_memdef(flag) (flag |= DST_flag_memdef) 00110 #define DST_SET_const(flag) (flag |= DST_flag_const) 00111 #define DST_SET_comm(flag) (flag |= DST_flag_comm) 00112 #define DST_SET_lb_cval(flag) (flag |= DST_flag_lb_cval) 00113 #define DST_SET_ub_cval(flag) (flag |= DST_flag_ub_cval) 00114 #define DST_SET_cval(flag) (flag |= DST_flag_cval) 00115 #define DST_SET_count(flag) (flag |= DST_flag_count) 00116 #define DST_SET_stride_1byte(flag) (flag |= DST_flag_stride_1byte) 00117 #define DST_SET_stride_2byte(flag) (flag |= DST_flag_stride_2byte) 00118 #define DST_SET_artificial(flag) (flag |= DST_flag_artificial) 00119 #define DST_SET_deref(flag) (flag |= DST_flag_deref) 00120 #define DST_SET_base_deref(flag) (flag |= DST_flag_base_deref) 00121 #define DST_SET_automatic(flag) (flag |= DST_flag_automatic) 00122 #define DST_SET_optional_parm(flag) (flag |= DST_flag_optional_parm) 00123 #define DST_SET_variable_parm(flag) (flag |= DST_flag_variable_parm) 00124 #define DST_SET_bitfield(flag) (flag |= DST_flag_bitfield) 00125 #define DST_SET_f90_pointer(flag) (flag |= DST_flag_f90_pointer) 00126 #define DST_SET_allocatable(flag) (flag |= DST_flag_allocatable) 00127 #define DST_SET_assumed_shape(flag) (flag |= DST_flag_assumed_shape) 00128 #define DST_SET_assumed_size(flag) (flag |= DST_flag_assumed_size) 00129 #define DST_SET_assoc_fe(flag) (flag |= DST_flag_assoc_fe) 00130 #define DST_SET_assoc_be(flag) (flag |= DST_flag_assoc_be) 00131 #define DST_SET_assoc_idx(flag) (flag |= DST_flag_assoc_idx) 00132 #define DST_SET_info_mark(flag) (flag |= DST_flag_info_mark) 00133 #define DST_SET_static(flag) (flag |= DST_flag_static) 00134 00135 #define DST_RESET_all(flag) (flag &= ~DST_flag_mask) 00136 #define DST_RESET_external(flag) (flag &= ~DST_flag_external) 00137 #define DST_RESET_declaration(flag) (flag &= ~DST_flag_declaration) 00138 #define DST_RESET_prototyped(flag) (flag &= ~DST_flag_prototyped) 00139 #define DST_RESET_memdef(flag) (flag &= ~DST_flag_memdef) 00140 #define DST_RESET_const(flag) (flag &= ~DST_flag_const) 00141 #define DST_RESET_comm(flag) (flag &= ~DST_flag_comm) 00142 #define DST_RESET_lb_cval(flag) (flag &= ~DST_flag_lb_cval) 00143 #define DST_RESET_ub_cval(flag) (flag &= ~DST_flag_ub_cval) 00144 #define DST_RESET_cval(flag) (flag &= ~DST_flag_cval) 00145 #define DST_RESET_count(flag) (flag &= ~DST_flag_count) 00146 #define DST_RESET_stride_1byte(flag) (flag &= ~DST_flag_stride_1byte) 00147 #define DST_RESET_stride_2byte(flag) (flag &= ~DST_flag_stride_2byte) 00148 #define DST_RESET_artificial(flag) (flag &= ~DST_flag_artificial) 00149 #define DST_RESET_deref(flag) (flag &= ~DST_flag_deref) 00150 #define DST_RESET_base_deref(flag) (flag &= ~DST_flag_base_deref) 00151 #define DST_RESET_automatic(flag) (flag &= ~DST_flag_automatic) 00152 #define DST_RESET_optional_parm(flag) (flag &= ~DST_flag_optional_parm) 00153 #define DST_RESET_variable_parm(flag) (flag &= ~DST_flag_variable_parm) 00154 #define DST_RESET_bitfield(flag) (flag &= ~DST_flag_bitfield) 00155 #define DST_RESET_f90_pointer(flag) (flag &= ~DST_flag_f90_pointer) 00156 #define DST_RESET_allocatable(flag) (flag &= ~DST_flag_allocatable) 00157 #define DST_RESET_assumed_shape(flag) (flag &= ~DST_flag_assumed_shape) 00158 #define DST_RESET_assumed_size(flag) (flag &= ~DST_flag_assumed_size) 00159 #define DST_RESET_assoc_fe(flag) (flag &= ~DST_flag_assoc_fe) 00160 #define DST_RESET_assoc_be(flag) (flag &= ~DST_flag_assoc_be) 00161 #define DST_RESET_assoc_idx(flag) (flag &= ~DST_flag_assoc_idx) 00162 #define DST_RESET_info_mark(flag) (flag &= ~DST_flag_info_mark) 00163 #define DST_RESET_static(flag) (flag &= ~DST_flag_static) 00164 00165 #define DST_IS_external(flag) (flag & DST_flag_external) 00166 #define DST_IS_declaration(flag) (flag & DST_flag_declaration) 00167 #define DST_IS_prototyped(flag) (flag & DST_flag_prototyped) 00168 #define DST_IS_memdef(flag) (flag & DST_flag_memdef) 00169 #define DST_IS_const(flag) (flag & DST_flag_const) 00170 #define DST_IS_comm(flag) (flag & DST_flag_comm) 00171 #define DST_IS_lb_cval(flag) (flag & DST_flag_lb_cval) 00172 #define DST_IS_ub_cval(flag) (flag & DST_flag_ub_cval) 00173 #define DST_IS_cval(flag) (flag & DST_flag_cval) 00174 #define DST_IS_count(flag) (flag & DST_flag_count) 00175 #define DST_IS_stride_1byte(flag) (flag & DST_flag_stride_1byte) 00176 #define DST_IS_stride_2byte(flag) (flag & DST_flag_stride_2byte) 00177 #define DST_IS_artificial(flag) (flag & DST_flag_artificial) 00178 #define DST_IS_deref(flag) (flag & DST_flag_deref) 00179 #define DST_IS_base_deref(flag) (flag & DST_flag_base_deref) 00180 #define DST_IS_automatic(flag) (flag & DST_flag_automatic) 00181 #define DST_IS_optional_parm(flag) (flag & DST_flag_optional_parm) 00182 #define DST_IS_variable_parm(flag) (flag & DST_flag_variable_parm) 00183 #define DST_IS_bitfield(flag) (flag & DST_flag_bitfield) 00184 #define DST_IS_f90_pointer(flag) (flag & DST_flag_f90_pointer) 00185 #define DST_IS_allocatable(flag) (flag & DST_flag_allocatable) 00186 #define DST_IS_assumed_shape(flag) (flag & DST_flag_assumed_shape) 00187 #define DST_IS_assumed_size(flag) (flag & DST_flag_assumed_size) 00188 #define DST_IS_assoc_fe(flag) (flag & DST_flag_assoc_fe) 00189 #define DST_IS_assoc_be(flag) (flag & DST_flag_assoc_be) 00190 #define DST_IS_assoc_idx(flag) (flag & DST_flag_assoc_idx) 00191 #define DST_IS_info_mark(flag) (flag & DST_flag_info_mark) 00192 #define DST_IS_static(flag) (flag & DST_flag_static) 00193 00194 00195 /* Attribute types, used to hold the values defined in "dwarf.h" 00196 */ 00197 typedef UINT64 DST_flag; /* DST_flag value (see above definitions) */ 00198 typedef UINT16 DST_DW_tag; /* DW_TAG value */ 00199 typedef UINT8 DST_ATE_encoding; /* AT_encoding codes (basetypes) */ 00200 typedef UINT8 DST_addr_class; /* AT_address_class codes. */ 00201 typedef UINT16 DST_language; /* AT_language codes */ 00202 typedef UINT16 DST_identifier_case; /* AT_identifier codes */ 00203 typedef UINT8 DST_inline; /* AT_inline (INL_not_inlined if absent) */ 00204 typedef UINT8 DST_virtuality; /* AT_virtuality (member functions and bases */ 00205 typedef UINT16 DST_vtable_elem_location; 00206 /* Used for index of function in vtable */ 00207 typedef UINT8 DST_bitsize; /* Used for bit_offset and bit_size */ 00208 typedef UINT64 DST_size_t; /* Used for byte_size of types */ 00209 typedef INT64 DST_bounds_t; /* Used to hold array bounds */ 00210 typedef void *DST_die_ptr; /* Used in backend for die ptr. */ 00211 00212 00213 /* Different types of indices to DST entries. Note that when accessing 00214 * an entry through DST_IDX_TO_PTR(), the second argument must be of a 00215 * type as reflected by the form of index. 00216 */ 00217 typedef DST_IDX DST_INFO_IDX; /* Index to a DST_INFO entry */ 00218 typedef DST_IDX DST_ATTR_IDX; /* Index to an attribute struct */ 00219 typedef DST_IDX DST_FILE_IDX; /* Index to a DST_FILE_NAME entry */ 00220 typedef DST_IDX DST_DIR_IDX; /* Index to a DST_INCLUDE_DIR entry */ 00221 typedef DST_IDX DST_MACR_IDX; /* Index to macro info (not yet defined) */ 00222 typedef DST_IDX DST_STR_IDX; /* Index to a string (char*) */ 00223 00224 00225 /*-------------------------------* 00226 * Pointers to back-end entities * 00227 *-------------------------------*/ 00228 00229 class ST; 00230 00231 typedef union DST_assoc_info 00232 { 00233 ST_IDX st_idx; /* idx to symbol table */ 00234 ST *st_ptr; /* A temporary ptr used by fe */ 00235 union 00236 { 00237 void *fe_ptr; 00238 UINTPS fe_uint; 00239 } st_u; 00240 } DST_ASSOC_INFO; 00241 #define DST_ASSOC_INFO_st_idx(p) ((p).st_idx) 00242 #define DST_ASSOC_INFO_st_level(p) (ST_IDX_level((p).st_idx)) 00243 #define DST_ASSOC_INFO_st_index(p) (ST_IDX_index((p).st_idx)) 00244 #define DST_ASSOC_INFO_st_ptr(p) ((p).st_ptr) 00245 #define DST_ASSOC_INFO_fe_ptr(p) ((p).st_u.fe_ptr) 00246 00247 #define pDST_ASSOC_INFO_st_idx(p) ((p)->st_idx) 00248 #define pDST_ASSOC_INFO_st_level(p) (ST_IDX_level((p)->st_idx)) 00249 #define pDST_ASSOC_INFO_st_index(p) (ST_IDX_index((p)->st_idx)) 00250 #define pDST_ASSOC_INFO_st_ptr(p) ((p)->st_ptr) 00251 #define pDST_ASSOC_INFO_fe_ptr(p) ((p)->st_u.fe_ptr) 00252 00253 00254 /*--------------------* 00255 * Data Representation * 00256 *---------------------*/ 00257 00258 00259 /* Forms of constant values. 00260 */ 00261 typedef enum DST_const_form 00262 { 00263 DST_FORM_STRING, 00264 DST_FORM_DATA1, 00265 DST_FORM_DATA2, 00266 DST_FORM_DATA4, 00267 DST_FORM_DATA8, 00268 DST_FORM_DATAC4, 00269 DST_FORM_DATAC8 00270 } DST_CONST_FORM; 00271 00272 typedef struct DST_const_value 00273 { 00274 DST_CONST_FORM form; 00275 union 00276 { 00277 DST_IDX form_string; 00278 UINT8 form_data1; 00279 UINT16 form_data2; 00280 UINT32 form_data4; 00281 UINT64 form_data8; 00282 struct { 00283 UINT32 form_crdata4; 00284 UINT32 form_cidata4; 00285 } cdata4; 00286 struct { 00287 UINT64 form_crdata8; 00288 UINT64 form_cidata8; 00289 } cdata8; 00290 } value; 00291 } DST_CONST_VALUE; 00292 00293 #define DST_CONST_VALUE_form(c) ((c).form) 00294 #define DST_CONST_VALUE_form_string(c) ((c).value.form_string) 00295 #define DST_CONST_VALUE_form_data1(c) ((c).value.form_data1) 00296 #define DST_CONST_VALUE_form_data2(c) ((c).value.form_data2) 00297 #define DST_CONST_VALUE_form_data4(c) ((c).value.form_data4) 00298 #define DST_CONST_VALUE_form_data8(c) ((c).value.form_data8) 00299 #define DST_CONST_VALUE_form_crdata4(c) ((c).value.cdata4.form_crdata4) 00300 #define DST_CONST_VALUE_form_cidata4(c) ((c).value.cdata4.form_cidata4) 00301 #define DST_CONST_VALUE_form_crdata8(c) ((c).value.cdata8.form_crdata8) 00302 #define DST_CONST_VALUE_form_cidata8(c) ((c).value.cdata8.form_cidata8) 00303 00304 00305 00306 /* Holds info necessary for the "include_directories" part of the 00307 * .debug_line section as a list of DST_INCLUDE_DIR records. 00308 */ 00309 typedef struct DST_include_dir 00310 { 00311 DST_STR_IDX path; /* a string */ 00312 DST_DIR_IDX next; /* next include dir */ 00313 } DST_INCLUDE_DIR; 00314 00315 #define DST_INCLUDE_DIR_path(dir) ((dir)->path) 00316 #define DST_INCLUDE_DIR_next(dir) ((dir)->next) 00317 00318 00319 /* Holds info necessary for the "file_names" part of the 00320 * .debug_line section as a list of DST_FILE_NAME records. 00321 */ 00322 typedef struct DST_file_name 00323 { 00324 DST_STR_IDX name; /* a string */ 00325 UINT16 dir; /* Ordinal number of DST_INCLUDE_DIR (0 if none) */ 00326 UINT64 size; /* size in bytes; zero if unknown */ 00327 UINT64 modt; /* last mod time_t (<sys/time.h>); zero if unknown */ 00328 DST_FILE_IDX next; /* next file name */ 00329 } DST_FILE_NAME; 00330 00331 #define DST_FILE_NAME_name(f) ((f)->name) 00332 #define DST_FILE_NAME_dir(f) ((f)->dir) 00333 #define DST_FILE_NAME_size(f) ((f)->size) 00334 #define DST_FILE_NAME_modt(f) ((f)->modt) 00335 #define DST_FILE_NAME_next(f) ((f)->next) 00336 00337 00338 00339 /* This structure definition encapsulates the information kept for each 00340 * type of .debug_info entry. The "attributes" can be any of the records 00341 * defined below, while the tag determines the form of entry and, hence, 00342 * which attribute record pointed to. Most entries can have siblings. 00343 * The flag values that apply to each form of DW_TAG are indicated in a 00344 * comment for each form of attribute struct (no comment when no flag value 00345 * applies). 00346 */ 00347 typedef struct DST_info 00348 { 00349 DST_DW_tag tag; /* DW_TAG value */ 00350 DST_flag flag; /* A set of flags */ 00351 DST_INFO_IDX sibling; /* dwarf sibling ptr */ 00352 DST_ATTR_IDX attributes; /* Ptr to attribute struct */ 00353 DST_die_ptr dieptr; /* ptr to the die for this DST (used in be) */ 00354 } DST_INFO; 00355 00356 #define DST_INFO_tag(info) ((info)->tag) 00357 #define DST_INFO_flag(info) ((info)->flag) 00358 #define DST_INFO_sibling(info) ((info)->sibling) 00359 #define DST_INFO_attributes(info) ((info)->attributes) 00360 #define DST_INFO_dieptr(info) ((info)->dieptr) 00361 00362 00363 /* The children of a DST entry are linked through the "sibling" indices 00364 * in DST_INFO, and the parent will have indices to the first and last 00365 * child in the list. 00366 */ 00367 typedef struct DST_CHILDREN 00368 { 00369 DST_INFO_IDX first; 00370 DST_INFO_IDX last; 00371 } DST_CHILDREN; 00372 00373 00374 /* [tag==DW_TAG_compile_unit]: Back-end must supply low/high pc, 00375 * as well as relocation info for the low/high pc, statement list 00376 * and macro information. 00377 */ 00378 typedef struct DST_compile_unit 00379 { 00380 DST_STR_IDX name; /* Relative path of first source file */ 00381 DST_STR_IDX comp_dir; /* cwd when issuing compilation command */ 00382 DST_STR_IDX producer; /* Info about compiler */ 00383 DST_language language; /* The DW_LANG code */ 00384 DST_identifier_case identifier_case; /* The DW_ID code */ 00385 DST_CHILDREN child; /* The file-scope decls/defs */ 00386 } DST_COMPILE_UNIT; 00387 00388 #define DST_COMPILE_UNIT_name(attr) ((attr)->name) 00389 #define DST_COMPILE_UNIT_comp_dir(attr) ((attr)->comp_dir) 00390 #define DST_COMPILE_UNIT_producer(attr) ((attr)->producer) 00391 #define DST_COMPILE_UNIT_language(attr) ((attr)->language) 00392 #define DST_COMPILE_UNIT_identifier_case(attr) ((attr)->identifier_case) 00393 #define DST_COMPILE_UNIT_first_child(attr) ((attr)->child.first) 00394 #define DST_COMPILE_UNIT_last_child(attr) ((attr)->child.last) 00395 00396 00397 00398 /* [tag==DW_TAG_inlined_subroutine]: Back-end must supply 00399 * low/high pc (and their reloc info ) and AT_address_class (2.10). 00400 */ 00401 typedef struct DST_inlined_subroutine 00402 { 00403 DST_ASSOC_INFO low_pc; /* Get pc value through back-end LABEL */ 00404 DST_ASSOC_INFO high_pc; /* Get pc value through back-end LABEL */ 00405 DST_INFO_IDX abstract_origin; /* The abstract version of this instance */ 00406 DST_CHILDREN child; /* Formal parameters, and local scope*/ 00407 USRCPOS decl; /* so can check if cross-file */ 00408 DST_STR_IDX abstract_name; /* "name" for cross-file matching */ 00409 } DST_INLINED_SUBROUTINE; 00410 00411 #define DST_INLINED_SUBROUTINE_low_pc(attr) ((attr)->low_pc) 00412 #define DST_INLINED_SUBROUTINE_high_pc(attr) ((attr)->high_pc) 00413 #define DST_INLINED_SUBROUTINE_abstract_origin(attr)\ 00414 ((attr)->abstract_origin) 00415 #define DST_INLINED_SUBROUTINE_first_child(attr) ((attr)->child.first) 00416 #define DST_INLINED_SUBROUTINE_last_child(attr) ((attr)->child.last) 00417 #define DST_INLINED_SUBROUTINE_decl(attr) ((attr)->decl) 00418 #define DST_INLINED_SUBROUTINE_abstract_name(attr) ((attr)->abstract_name) 00419 00420 00421 00422 /* [tag==DW_TAG_subprogram]: We here explicitly distinguish between four 00423 * types of subprogram symbol-table entries. Back-end must supply 00424 * low/high pc (and their reloc info ) and AT_address_class (2.10) for 00425 * all forms of subprogram, except decls, and AT_calling_convention for 00426 * defs. 00427 */ 00428 00429 typedef struct DST_subpr_decl 00430 { 00431 USRCPOS decl; /* Source location */ 00432 DST_STR_IDX name; /* Unmangled name of subroutine */ 00433 DST_STR_IDX linkage_name; /* Mangled name of subroutine */ 00434 DST_INFO_IDX type; /* Return type, DST_INVALID_IDX if void */ 00435 DST_inline inlin; /* AT_inline codes (page 24 in V2, Draft 5) */ 00436 DST_virtuality virtuality; /* AT_virtuality codes (page 17 in V2, Draft 5) */ 00437 DST_vtable_elem_location vtable_elem_location; /* index into virtual table */ 00438 DST_CHILDREN child; /* Formal parameter types */ 00439 DST_INFO_IDX origin; /* if weak name, point to original dst */ 00440 } DST_SUBPR_DECL; 00441 00442 typedef struct DST_subpr_def 00443 { 00444 USRCPOS decl; /* Source location */ 00445 DST_STR_IDX name; /* Name of subroutine */ 00446 DST_STR_IDX linkage_name; /* Mangled name of subroutine */ 00447 DST_STR_IDX pubname; /* pubnames name of subroutine (for member fns) */ 00448 DST_INFO_IDX type; /* Return type, DST_INVALID_IDX if void */ 00449 DST_ASSOC_INFO st; /* low/high pc values through ST entry */ 00450 DST_inline inlin; /* AT_inline codes (page 24 in V2, Draft 5) */ 00451 DST_virtuality virtuality; /* AT_virtuality code (page 27 in V2, Draft 5) */ 00452 DST_vtable_elem_location vtable_elem_location; /* index into virtual table */ 00453 DST_INFO_IDX specification; /* for member function, pointer from def to 00454 * decl */ 00455 DST_CHILDREN child; /* Formal parameter types */ 00456 DST_INFO_IDX origin; /* for clone origin */ 00457 } DST_SUBPR_DEF; 00458 00459 typedef struct DST_subpr_memdef 00460 { 00461 USRCPOS decl; /* Source location */ 00462 DST_INFO_IDX spec; /* Ptr to class/struct member */ 00463 DST_ASSOC_INFO st; /* low/high pc values through ST entry */ 00464 DST_CHILDREN child; /* Formal parameters, and local scope */ 00465 } DST_SUBPR_MEMDEF; 00466 00467 /* "flag" is subset of 00468 * [external, declaration, memdef, prototyped] 00469 */ 00470 typedef union DST_subprogram 00471 { 00472 DST_SUBPR_MEMDEF memdef; /* DST_IS_memdef(flag) */ 00473 DST_SUBPR_DECL decl; /* DST_IS_declaration(flag) */ 00474 DST_SUBPR_DEF def; /* !DST_IS_declaration(flag) */ 00475 } DST_SUBPROGRAM; 00476 00477 #define DST_SUBPROGRAM_memdef_decl(attr) ((attr)->memdef.decl) 00478 #define DST_SUBPROGRAM_memdef_spec(attr) ((attr)->memdef.spec) 00479 #define DST_SUBPROGRAM_memdef_st(attr) ((attr)->memdef.st) 00480 #define DST_SUBPROGRAM_memdef_first_child(attr) ((attr)->memdef.child.first) 00481 #define DST_SUBPROGRAM_memdef_last_child(attr) ((attr)->memdef.child.last) 00482 00483 #define DST_SUBPROGRAM_decl_decl(attr) ((attr)->decl.decl) 00484 #define DST_SUBPROGRAM_decl_name(attr) ((attr)->decl.name) 00485 #define DST_SUBPROGRAM_decl_linkage_name(attr) ((attr)->decl.linkage_name) 00486 #define DST_SUBPROGRAM_decl_type(attr) ((attr)->decl.type) 00487 #define DST_SUBPROGRAM_decl_inline(attr) ((attr)->decl.inlin) 00488 #define DST_SUBPROGRAM_decl_virtuality(attr) ((attr)->decl.virtuality) 00489 #define DST_SUBPROGRAM_decl_vtable_elem_location(attr) \ 00490 ((attr)->decl.vtable_elem_location) 00491 #define DST_SUBPROGRAM_decl_first_child(attr) ((attr)->decl.child.first) 00492 #define DST_SUBPROGRAM_decl_last_child(attr) ((attr)->decl.child.last) 00493 #define DST_SUBPROGRAM_decl_origin(attr) ((attr)->decl.origin) 00494 00495 #define DST_SUBPROGRAM_def_decl(attr) ((attr)->def.decl) 00496 #define DST_SUBPROGRAM_def_name(attr) ((attr)->def.name) 00497 #define DST_SUBPROGRAM_def_linkage_name(attr) ((attr)->def.linkage_name) 00498 #define DST_SUBPROGRAM_def_pubname(attr) ((attr)->def.pubname) 00499 #define DST_SUBPROGRAM_def_type(attr) ((attr)->def.type) 00500 #define DST_SUBPROGRAM_def_st(attr) ((attr)->def.st) 00501 #define DST_SUBPROGRAM_def_inline(attr) ((attr)->def.inlin) 00502 #define DST_SUBPROGRAM_def_virtuality(attr) ((attr)->def.virtuality) 00503 #define DST_SUBPROGRAM_def_vtable_elem_location(attr) \ 00504 ((attr)->def.vtable_elem_location) 00505 #define DST_SUBPROGRAM_def_specification(attr) ((attr)->def.specification) 00506 #define DST_SUBPROGRAM_def_first_child(attr) ((attr)->def.child.first) 00507 #define DST_SUBPROGRAM_def_last_child(attr) ((attr)->def.child.last) 00508 #define DST_SUBPROGRAM_def_clone_origin(attr) ((attr)->def.origin) 00509 00510 00511 /* [tag==DW_TAG_entry_point]: Back-end must supply 00512 * low pc (and their reloc info ) 00513 */ 00514 typedef struct DST_entry_point 00515 { 00516 USRCPOS decl; /* Source location */ 00517 DST_STR_IDX name; /* Name of subroutine */ 00518 DST_INFO_IDX type; /* Return type, DST_INVALID_IDX if void */ 00519 DST_ASSOC_INFO st; /* low pc values through ST entry */ 00520 DST_CHILDREN child; /* Formal parameter types */ 00521 } DST_ENTRY_POINT; 00522 00523 #define DST_ENTRY_POINT_decl(attr) ((attr)->decl) 00524 #define DST_ENTRY_POINT_name(attr) ((attr)->name) 00525 #define DST_ENTRY_POINT_type(attr) ((attr)->type) 00526 #define DST_ENTRY_POINT_st(attr) ((attr)->st) 00527 #define DST_ENTRY_POINT_first_child(attr) ((attr)->child.first) 00528 #define DST_ENTRY_POINT_last_child(attr) ((attr)->child.last) 00529 00530 /* [tag==DW_TAG_common_block]: back end supplies location 00531 * 00532 */ 00533 typedef struct DST_common_block 00534 { 00535 DST_STR_IDX name; /* name of common block */ 00536 DST_ASSOC_INFO st; /* for getting at_location attribute */ 00537 DST_CHILDREN child; /* children within common block */ 00538 } DST_COMMON_BLOCK; 00539 00540 #define DST_COMMON_BLOCK_name(attr) ((attr)->name) 00541 #define DST_COMMON_BLOCK_st(attr) ((attr)->st) 00542 #define DST_COMMON_BLOCK_first_child(attr) ((attr)->child.first) 00543 #define DST_COMMON_BLOCK_last_child(attr) ((attr)->child.last) 00544 00545 00546 /* [tag=DW_TAG_common_inclusion]: back end supplies location 00547 * 00548 */ 00549 typedef struct DST_common_incl 00550 { 00551 USRCPOS decl; /* Source decl location */ 00552 DST_INFO_IDX com_blk; /* reference to common block die */ 00553 } DST_COMMON_INCL; 00554 00555 #define DST_COMMON_INCL_decl(attr) ((attr)->decl) 00556 #define DST_COMMON_INCL_com_blk(attr) ((attr)->com_blk) 00557 00558 00559 /* [tag==DW_TAG_lexical_block]: Back-end must supply low/high pc and 00560 * pc reloc info. 00561 */ 00562 typedef struct DST_lexical_block 00563 { 00564 DST_STR_IDX name; /* For named blocks */ 00565 DST_ASSOC_INFO low_pc; /* Get pc value through back-end LABEL */ 00566 DST_ASSOC_INFO high_pc; /* Get pc value through back-end LABEL */ 00567 DST_INFO_IDX abstract_origin; /* When part of an inlined subroutine */ 00568 DST_CHILDREN child; /* Local decls and inner blocks */ 00569 } DST_LEXICAL_BLOCK; 00570 00571 #define DST_LEXICAL_BLOCK_name(attr) ((attr)->name) 00572 #define DST_LEXICAL_BLOCK_low_pc(attr) ((attr)->low_pc) 00573 #define DST_LEXICAL_BLOCK_high_pc(attr) ((attr)->high_pc) 00574 #define DST_LEXICAL_BLOCK_abstract_origin(attr) ((attr)->abstract_origin) 00575 #define DST_LEXICAL_BLOCK_first_child(attr) ((attr)->child.first) 00576 #define DST_LEXICAL_BLOCK_last_child(attr) ((attr)->child.last) 00577 00578 00579 00580 /* [tag==DW_TAG_label]: Back-end must supply low pc and 00581 * pc reloc info. 00582 */ 00583 typedef struct DST_label 00584 { 00585 DST_STR_IDX name; /* For named blocks */ 00586 DST_ASSOC_INFO low_pc; /* Get pc value through back-end LABEL */ 00587 DST_INFO_IDX abstract_origin; /* When part of an inlined subroutine */ 00588 } DST_LABEL; 00589 00590 #define DST_LABEL_name(attr) ((attr)->name) 00591 #define DST_LABEL_low_pc(attr) ((attr)->low_pc) 00592 #define DST_LABEL_abstract_origin(attr) ((attr)->abstract_origin) 00593 00594 00595 00596 /* [tag==DW_TAG_variable]: Back-end must supply start_scope offset and 00597 * location of variable (BLOCKn, REF) for automatic or defining non-const 00598 * declarations. We distinguish between four types of variables. 00599 */ 00600 typedef struct DST_var_decl 00601 { 00602 USRCPOS decl; /* Source location */ 00603 DST_STR_IDX name; /* Name of variable */ 00604 DST_INFO_IDX type; /* Type of variable */ 00605 DST_STR_IDX linkage_name; /* Mangled name of variable */ 00606 } DST_VAR_DECL; 00607 00608 typedef struct DST_var_def 00609 { 00610 USRCPOS decl; /* Source location */ 00611 DST_STR_IDX name; /* Name of variable */ 00612 DST_INFO_IDX type; /* Type of variable */ 00613 DST_ASSOC_INFO st; /* Location of variable (through back-end ST) */ 00614 UINT64 offs; /* offset of variable from st */ 00615 DST_INFO_IDX specification; /* for data member, pointer from def to 00616 * field decl */ 00617 DST_INFO_IDX abstract_origin; 00618 DST_INFO_IDX dopetype; /* Type of dope vector */ 00619 DST_STR_IDX linkage_name; /* Mangled name of variable */ 00620 } DST_VAR_DEF; 00621 00622 typedef struct DST_var_const 00623 { 00624 USRCPOS decl; /* Source location */ 00625 DST_STR_IDX name; /* Name of const variable */ 00626 DST_INFO_IDX type; /* Type of const variable */ 00627 DST_CONST_VALUE cval; /* Constant value */ 00628 } DST_VAR_CONST; 00629 00630 typedef struct DST_var_comm 00631 { 00632 USRCPOS decl; /* Source location */ 00633 DST_STR_IDX name; /* name of variable in common block */ 00634 DST_INFO_IDX type; /* Type of variable */ 00635 DST_ASSOC_INFO st; /* Location of enclosing common block */ 00636 UINT64 offs; /* Constant offset from base of common block */ 00637 DST_INFO_IDX dopetype; /* Type of dope vector */ 00638 } DST_VAR_COMM; 00639 00640 00641 typedef struct DST_var_memdef 00642 { 00643 USRCPOS decl; /* Source location */ 00644 DST_ASSOC_INFO st; /* Location of variable (through back-end ST) */ 00645 DST_INFO_IDX spec; /* Ptr to C++ class member decl */ 00646 } DST_VAR_MEMDEF; 00647 00648 00649 /* "flag" is subset of [automatic, external, declaration, const, memdef] 00650 */ 00651 typedef union DST_variable 00652 { 00653 DST_VAR_DECL decl; /* DST_IS_declaration(flag) */ 00654 DST_VAR_DEF def; /* !DST_IS_declaration(flag) */ 00655 DST_VAR_CONST constant; /* DST_IS_const(flag) */ 00656 DST_VAR_COMM comm; /* DST_IS_comm(flag) */ 00657 DST_VAR_MEMDEF memdef; /* DST_IS_memdef(flag) */ 00658 } DST_VARIABLE; 00659 00660 #define DST_VARIABLE_decl_decl(attr) ((attr)->decl.decl) 00661 #define DST_VARIABLE_decl_name(attr) ((attr)->decl.name) 00662 #define DST_VARIABLE_decl_type(attr) ((attr)->decl.type) 00663 #define DST_VARIABLE_decl_linkage_name(attr) ((attr)->decl.linkage_name) 00664 00665 #define DST_VARIABLE_def_decl(attr) ((attr)->def.decl) 00666 #define DST_VARIABLE_def_name(attr) ((attr)->def.name) 00667 #define DST_VARIABLE_def_type(attr) ((attr)->def.type) 00668 #define DST_VARIABLE_def_st(attr) ((attr)->def.st) 00669 #define DST_VARIABLE_def_offs(attr) ((attr)->def.offs) 00670 #define DST_VARIABLE_def_specification(attr) ((attr)->def.specification) 00671 #define DST_VARIABLE_def_linkage_name(attr) ((attr)->def.linkage_name) 00672 #define DST_VARIABLE_def_abstract_origin(attr) ((attr)->def.abstract_origin) 00673 #define DST_VARIABLE_def_dopetype(attr) ((attr)->def.dopetype) 00674 00675 #define DST_VARIABLE_constant_decl(attr) ((attr)->constant.decl) 00676 #define DST_VARIABLE_constant_name(attr) ((attr)->constant.name) 00677 #define DST_VARIABLE_constant_type(attr) ((attr)->constant.type) 00678 #define DST_VARIABLE_constant_cval(attr) ((attr)->constant.cval) 00679 00680 #define DST_VARIABLE_comm_decl(attr) ((attr)->comm.decl) 00681 #define DST_VARIABLE_comm_name(attr) ((attr)->comm.name) 00682 #define DST_VARIABLE_comm_type(attr) ((attr)->comm.type) 00683 #define DST_VARIABLE_comm_st(attr) ((attr)->comm.st) 00684 #define DST_VARIABLE_comm_offs(attr) ((attr)->comm.offs) 00685 #define DST_VARIABLE_comm_dopetype(attr) ((attr)->comm.dopetype) 00686 00687 #define DST_VARIABLE_memdef_decl(attr) ((attr)->memdef.decl) 00688 #define DST_VARIABLE_memdef_st(attr) ((attr)->memdef.st) 00689 #define DST_VARIABLE_memdef_spec(attr) ((attr)->memdef.spec) 00690 00691 00692 00693 /* [tag==DW_TAG_formal_parameter]: Back-end must supply run-time 00694 * location of variable (BLOCKn, REF) if belonging to a definition. 00695 * 00696 * "flag" is subset of [optional, variable_parameter] 00697 */ 00698 typedef struct DST_formal_parameter 00699 { 00700 USRCPOS decl; /* Source location */ 00701 DST_STR_IDX name; /* Name of parameter */ 00702 DST_INFO_IDX type; /* Type of parameter */ 00703 DST_ASSOC_INFO st; /* Location of variable (through back-end ST) */ 00704 DST_INFO_IDX abstract_origin; /* When part of an inlined subroutine */ 00705 DST_INFO_IDX default_val; /* Default value of (C++) parameter */ 00706 DST_INFO_IDX dopetype; /* Type of dope vector */ 00707 } DST_FORMAL_PARAMETER; 00708 00709 #define DST_FORMAL_PARAMETER_decl(attr) ((attr)->decl) 00710 #define DST_FORMAL_PARAMETER_name(attr) ((attr)->name) 00711 #define DST_FORMAL_PARAMETER_type(attr) ((attr)->type) 00712 #define DST_FORMAL_PARAMETER_st(attr) ((attr)->st) 00713 #define DST_FORMAL_PARAMETER_abstract_origin(attr) ((attr)->abstract_origin) 00714 #define DST_FORMAL_PARAMETER_default_val(attr) ((attr)->default_val) 00715 #define DST_FORMAL_PARAMETER_dopetype(attr) ((attr)->dopetype) 00716 00717 00718 00719 /* [tag==DW_TAG_unspecified_parameters] 00720 */ 00721 typedef struct DST_unspecified_parameters 00722 { 00723 USRCPOS decl; /* Source location */ 00724 DST_INFO_IDX abstract_origin; /* When part of an inlined subroutine */ 00725 } DST_UNSPECIFIED_PARAMETERS; 00726 00727 #define DST_UNSPECIFIED_PARAMETERS_decl(attr) ((attr)->decl) 00728 #define DST_UNSPECIFIED_PARAMETERS_abstract_origin(attr)\ 00729 ((attr)->abstract_origin) 00730 00731 00732 00733 /* [tag==DW_TAG_constant] 00734 * "flag" is subset of [declaration, external] 00735 */ 00736 typedef struct DST_const_def 00737 { 00738 USRCPOS decl; /* Source location */ 00739 DST_STR_IDX name; /* Name of constant */ 00740 DST_INFO_IDX type; /* Type of constant */ 00741 DST_CONST_VALUE cval; /* Constant value, only if not declaration */ 00742 } DST_CONST_DEF; 00743 00744 typedef struct DST_const_decl 00745 { 00746 USRCPOS decl; /* Source location */ 00747 DST_INFO_IDX name; /* Name of constant */ 00748 DST_INFO_IDX type; /* Type of constant */ 00749 } DST_CONST_DECL; 00750 00751 typedef union DST_constant 00752 { 00753 DST_CONST_DECL decl; /* Non-defining declaration */ 00754 DST_CONST_DEF def; /* Defining declaration */ 00755 } DST_CONSTANT; 00756 00757 #define DST_CONSTANT_decl_decl(attr) ((attr)->decl.decl) 00758 #define DST_CONSTANT_decl_name(attr) ((attr)->decl.name) 00759 #define DST_CONSTANT_decl_type(attr) ((attr)->decl.type) 00760 00761 #define DST_CONSTANT_def_decl(attr) ((attr)->def.decl) 00762 #define DST_CONSTANT_def_name(attr) ((attr)->def.name) 00763 #define DST_CONSTANT_def_type(attr) ((attr)->def.type) 00764 #define DST_CONSTANT_def_cval(attr) ((attr)->def.cval) 00765 00766 00767 00768 /* [tag==DW_TAG_base_type] 00769 */ 00770 typedef struct DST_basetype 00771 { 00772 DST_STR_IDX name; /* Name of type */ 00773 DST_ATE_encoding encoding; /* How to encode/interpret these objects */ 00774 DST_size_t byte_size; /* Size of object of this type */ 00775 } DST_BASETYPE; 00776 00777 #define DST_BASETYPE_name(attr) ((attr)->name) 00778 #define DST_BASETYPE_encoding(attr) ((attr)->encoding) 00779 #define DST_BASETYPE_byte_size(attr) ((attr)->byte_size) 00780 00781 00782 00783 /* [tag==DW_TAG_const_type]: The back-end must supply the AT_start_scope 00784 * attribute. 00785 */ 00786 typedef struct DST_qualified_type 00787 { 00788 DST_INFO_IDX type; /* Type that is qualified */ 00789 } DST_QUALIFIED_TYPE; 00790 00791 typedef DST_QUALIFIED_TYPE DST_CONST_TYPE; 00792 #define DST_CONST_TYPE_type(attr) ((attr)->type) 00793 00794 00795 00796 /* [tag==DW_TAG_volatile_type]: The back-end must supply the AT_start_scope 00797 * attribute. 00798 */ 00799 typedef DST_QUALIFIED_TYPE DST_VOLATILE_TYPE; 00800 #define DST_VOLATILE_TYPE_type(attr) ((attr)->type) 00801 00802 00803 00804 /* [tag==DW_TAG_pointer_type]: The back-end must supply the AT_start_scope 00805 * attribute. The AT_address_class attribute would normally be DW_ADDR_none! 00806 */ 00807 typedef struct DST_pointer_type 00808 { 00809 DST_INFO_IDX type; 00810 /* Type that is pointed to, DST_INVALID_IDX if void */ 00811 00812 DST_addr_class address_class; 00813 /* How to dereference objects of this type */ 00814 00815 DST_size_t byte_size; 00816 /* Size of pointer type (4 or 8 bytes) */ 00817 } DST_POINTER_TYPE; 00818 00819 #define DST_POINTER_TYPE_type(attr) ((attr)->type) 00820 #define DST_POINTER_TYPE_address_class(attr) ((attr)->address_class) 00821 #define DST_POINTER_TYPE_byte_size(attr) ((attr)->byte_size) 00822 00823 00824 00825 /* [tag==DW_TAG_reference_type]: The back-end must supply the AT_start_scope 00826 * attribute. The AT_address_class attribute would normally be DW_ADDR_none! 00827 */ 00828 typedef DST_POINTER_TYPE DST_REFERENCE_TYPE; 00829 00830 #define DST_REFERENCE_TYPE_type(attr) ((attr)->type) 00831 #define DST_REFERENCE_TYPE_address_class(attr) ((attr)->address_class) 00832 #define DST_REFERENCE_TYPE_byte_size(attr) ((attr)->byte_size) 00833 00834 00835 00836 /* [tag==DW_TAG_typedef]: The back-end must supply the AT_start_scope 00837 * attribute. 00838 */ 00839 typedef struct DST_typedef 00840 { 00841 USRCPOS decl; /* Source location */ 00842 DST_STR_IDX name; /* Name of type */ 00843 DST_INFO_IDX type; /* Defining type, NULL for incomplete declaration */ 00844 DST_INFO_IDX abstract_origin; /* Defined inside inlined proc */ 00845 } DST_TYPEDEF; 00846 00847 #define DST_TYPEDEF_decl(attr) ((attr)->decl) 00848 #define DST_TYPEDEF_name(attr) ((attr)->name) 00849 #define DST_TYPEDEF_type(attr) ((attr)->type) 00850 #define DST_TYPEDEF_abstract_origin(attr) ((attr)->abstract_origin) 00851 00852 00853 00854 /* [tag==DW_TAG_array_type]: The back-end must supply the AT_start_scope 00855 * attribute. "flags" in [declaration]. 00856 */ 00857 typedef struct DST_array_type /* Assume row-major order for multi-dim. */ 00858 { 00859 USRCPOS decl; /* Source location */ 00860 DST_STR_IDX name; /* Name of type */ 00861 DST_INFO_IDX type; /* Element type */ 00862 DST_size_t byte_size; /* Size of array, if known at compile time */ 00863 DST_INFO_IDX abstract_origin; /* Defined inside inlined proc */ 00864 DST_CHILDREN child; /* Bounds for each dimension (DST_subrange_type) */ 00865 } DST_ARRAY_TYPE; 00866 00867 #define DST_ARRAY_TYPE_decl(attr) ((attr)->decl) 00868 #define DST_ARRAY_TYPE_name(attr) ((attr)->name) 00869 #define DST_ARRAY_TYPE_type(attr) ((attr)->type) 00870 #define DST_ARRAY_TYPE_byte_size(attr) ((attr)->byte_size) 00871 #define DST_ARRAY_TYPE_abstract_origin(attr) ((attr)->abstract_origin) 00872 #define DST_ARRAY_TYPE_first_child(attr) ((attr)->child.first) 00873 #define DST_ARRAY_TYPE_last_child(attr) ((attr)->child.last) 00874 00875 00876 00877 /* [tag==DW_TAG_subrange_type]: Represents array bounds (child of 00878 * array_type). 00879 */ 00880 typedef union 00881 { 00882 DST_bounds_t cval; 00883 DST_INFO_IDX ref; 00884 } DST_cval_ref; 00885 00886 typedef struct DST_subrange_type 00887 { 00888 DST_cval_ref lower; /* lower bound */ 00889 DST_cval_ref upper; /* upper bound */ 00890 DST_cval_ref stride; /* stride - for non-contiguous sections (F90) */ 00891 } DST_SUBRANGE_TYPE; 00892 00893 #define DST_SUBRANGE_TYPE_count(attr) ((attr)->upper.cval - (attr)->lower.cval + 1) 00894 #define DST_SUBRANGE_TYPE_lower_cval(attr) ((attr)->lower.cval) 00895 #define DST_SUBRANGE_TYPE_upper_cval(attr) ((attr)->upper.cval) 00896 #define DST_SUBRANGE_TYPE_lower_ref(attr) ((attr)->lower.ref) 00897 #define DST_SUBRANGE_TYPE_upper_ref(attr) ((attr)->upper.ref) 00898 #define DST_SUBRANGE_TYPE_stride_ref(attr) ((attr)->stride.ref) 00899 00900 00901 /* [tag==DW_TAG_string_type]: Represents FORTRAN or pascal string 00902 * type. 00903 */ 00904 typedef struct DST_string_type 00905 { 00906 USRCPOS decl; /* Source location */ 00907 DST_STR_IDX name; /* Name of type */ 00908 DST_cval_ref len; /* length of string */ 00909 } DST_STRING_TYPE; 00910 00911 #define DST_STRING_TYPE_decl(attr) ((attr)->decl) 00912 #define DST_STRING_TYPE_name(attr) ((attr)->name) 00913 #define DST_STRING_TYPE_len_cval(attr) ((attr)->len.cval) 00914 #define DST_STRING_TYPE_len_ref(attr) ((attr)->len.ref) 00915 00916 00917 /* [tag==DW_TAG_structure_type]: The back-end must supply the AT_start_scope 00918 * attribute. "flag" is subset of [declaration] 00919 */ 00920 typedef struct DST_structure_type 00921 { 00922 USRCPOS decl; /* Source location */ 00923 DST_STR_IDX name; /* Name of type */ 00924 DST_size_t byte_size; /* Size of struct, if known at compile time */ 00925 DST_INFO_IDX abstract_origin; /* Inside inlined instance of proc. */ 00926 DST_INFO_IDX inheritance; /* Inheritance entries (DW_TAG_inheritance) */ 00927 DST_CHILDREN child; /* Struct members (DW_TAG_member) */ 00928 } DST_STRUCTURE_TYPE; 00929 00930 #define DST_STRUCTURE_TYPE_decl(attr) ((attr)->decl) 00931 #define DST_STRUCTURE_TYPE_name(attr) ((attr)->name) 00932 #define DST_STRUCTURE_TYPE_byte_size(attr) ((attr)->byte_size) 00933 #define DST_STRUCTURE_TYPE_abstract_origin(attr) ((attr)->abstract_origin) 00934 #define DST_STRUCTURE_TYPE_inheritance(attr) ((attr)->inheritance) 00935 #define DST_STRUCTURE_TYPE_first_child(attr) ((attr)->child.first) 00936 #define DST_STRUCTURE_TYPE_last_child(attr) ((attr)->child.last) 00937 00938 00939 00940 /* [tag==DW_TAG_union_type]: The back-end must supply the AT_start_scope 00941 * attribute. 00942 */ 00943 typedef DST_STRUCTURE_TYPE DST_UNION_TYPE; 00944 00945 #define DST_UNION_TYPE_decl(attr) ((attr)->decl) 00946 #define DST_UNION_TYPE_name(attr) ((attr)->name) 00947 #define DST_UNION_TYPE_byte_size(attr) ((attr)->byte_size) 00948 #define DST_UNION_TYPE_abstract_origin(attr) ((attr)->abstract_origin) 00949 #define DST_UNION_TYPE_inheritance(attr) ((attr)->inheritance) 00950 #define DST_UNION_TYPE_first_child(attr) ((attr)->child.first) 00951 #define DST_UNION_TYPE_last_child(attr) ((attr)->child.last) 00952 00953 00954 00955 /* [tag==DW_TAG_class_type]: The back-end must supply the AT_start_scope 00956 * attribute. 00957 */ 00958 typedef DST_STRUCTURE_TYPE DST_CLASS_TYPE; 00959 00960 #define DST_CLASS_TYPE_decl(attr) ((attr)->decl) 00961 #define DST_CLASS_TYPE_name(attr) ((attr)->name) 00962 #define DST_CLASS_TYPE_byte_size(attr) ((attr)->byte_size) 00963 #define DST_CLASS_TYPE_abstract_origin(attr) ((attr)->abstract_origin) 00964 #define DST_CLASS_TYPE_inheritance(attr) ((attr)->inheritance) 00965 #define DST_CLASS_TYPE_first_child(attr) ((attr)->child.first) 00966 #define DST_CLASS_TYPE_last_child(attr) ((attr)->child.last) 00967 00968 00969 /* [tag==DW_TAG_member] 00970 * 00971 * "flag" is subset of [declaration bitfield] 00972 */ 00973 typedef struct DST_member 00974 { 00975 USRCPOS decl; /* Source location */ 00976 DST_STR_IDX name; /* Name of member */ 00977 DST_INFO_IDX type; /* Type of member */ 00978 DST_size_t memb_loc; /* Offset of member (data-block) within 00979 struct/class (0 for union) */ 00980 DST_size_t byte_size; /* Size of bitfield data-block */ 00981 DST_bitsize bit_offset; /* Offset of bitfield within block */ 00982 DST_bitsize bit_size; /* Size of bitfield */ 00983 DST_INFO_IDX dopetype; /* Type of dope vector */ 00984 } DST_MEMBER; 00985 00986 #define DST_MEMBER_decl(attr) ((attr)->decl) 00987 #define DST_MEMBER_name(attr) ((attr)->name) 00988 #define DST_MEMBER_type(attr) ((attr)->type) 00989 #define DST_MEMBER_memb_loc(attr) ((attr)->memb_loc) 00990 #define DST_MEMBER_byte_size(attr) ((attr)->byte_size) 00991 #define DST_MEMBER_bit_offset(attr) ((attr)->bit_offset) 00992 #define DST_MEMBER_bit_size(attr) ((attr)->bit_size) 00993 #define DST_MEMBER_dopetype(attr) ((attr)->dopetype) 00994 00995 00996 00997 /* [tag==DW_TAG_inheritance] 00998 * 00999 */ 01000 typedef struct DST_inheritance 01001 { 01002 USRCPOS decl; /* Source location */ 01003 DST_INFO_IDX type; /* Type of member */ 01004 DST_virtuality virtuality; /* AT_virtuality codes (Page 17, V2, Draft 5) */ 01005 DST_size_t memb_loc; /* Offset of member (data-block) within 01006 struct/class (0 for union) */ 01007 } DST_INHERITANCE; 01008 01009 #define DST_INHERITANCE_decl(attr) ((attr)->decl) 01010 #define DST_INHERITANCE_type(attr) ((attr)->type) 01011 #define DST_INHERITANCE_virtuality(attr) ((attr)->virtuality) 01012 #define DST_INHERITANCE_memb_loc(attr) ((attr)->memb_loc) 01013 01014 01015 01016 /* [tag==DW_TAG_template_type_parameter] 01017 * 01018 */ 01019 typedef struct DST_template_type_parameter 01020 { 01021 USRCPOS decl; /* Source location */ 01022 DST_STR_IDX name; /* Name of formal type parameter */ 01023 DST_INFO_IDX type; /* Actual parameter type */ 01024 } DST_TEMPLATE_TYPE_PARAMETER; 01025 01026 #define DST_TEMPLATE_TYPE_PARAMETER_decl(attr) ((attr)->decl) 01027 #define DST_TEMPLATE_TYPE_PARAMETER_name(attr) ((attr)->name) 01028 #define DST_TEMPLATE_TYPE_PARAMETER_type(attr) ((attr)->type) 01029 01030 01031 01032 /* [tag==DW_TAG_template_value_parameter] 01033 * 01034 */ 01035 typedef struct DST_template_value_parameter 01036 { 01037 USRCPOS decl; /* Source location */ 01038 DST_STR_IDX name; /* Name of formal type parameter */ 01039 DST_INFO_IDX type; /* Actual parameter type */ 01040 DST_CONST_VALUE cval; /* Constant value, only if not declaration */ 01041 } DST_TEMPLATE_VALUE_PARAMETER; 01042 01043 #define DST_TEMPLATE_VALUE_PARAMETER_decl(attr) ((attr)->decl) 01044 #define DST_TEMPLATE_VALUE_PARAMETER_name(attr) ((attr)->name) 01045 #define DST_TEMPLATE_VALUE_PARAMETER_type(attr) ((attr)->type) 01046 #define DST_TEMPLATE_VALUE_PARAMETER_cval(attr) ((attr)->cval) 01047 01048 01049 01050 /* [tag==DW_TAG_enumeration_type]: The back-end must supply the 01051 * AT_start_scope attribute. 01052 * 01053 * "flag" is subset of [declaration] 01054 */ 01055 typedef struct DST_enumeration_type 01056 { 01057 USRCPOS decl; /* Source location */ 01058 DST_STR_IDX name; /* Name of type */ 01059 DST_size_t byte_size; /* Size of enumeration objects */ 01060 DST_INFO_IDX abstract_origin; /* Declared in inlined instance of proc. */ 01061 DST_CHILDREN child; /* enumerators (DW_TAG_enumerator entries) */ 01062 } DST_ENUMERATION_TYPE; 01063 01064 #define DST_ENUMERATION_TYPE_decl(attr) ((attr)->decl) 01065 #define DST_ENUMERATION_TYPE_name(attr) ((attr)->name) 01066 #define DST_ENUMERATION_TYPE_byte_size(attr) ((attr)->byte_size) 01067 #define DST_ENUMERATION_TYPE_abstract_origin(attr) ((attr)->abstract_origin) 01068 #define DST_ENUMERATION_TYPE_first_child(attr) ((attr)->child.first) 01069 #define DST_ENUMERATION_TYPE_last_child(attr) ((attr)->child.last) 01070 01071 01072 01073 /* [tag==DW_TAG_enumerator] 01074 */ 01075 typedef struct DST_enumerator 01076 { 01077 USRCPOS decl; /* Source location */ 01078 DST_STR_IDX name; /* Name of type */ 01079 DST_CONST_VALUE cval; /* Enumeration value */ 01080 } DST_ENUMERATOR; 01081 01082 #define DST_ENUMERATOR_decl(attr) ((attr)->decl) 01083 #define DST_ENUMERATOR_name(attr) ((attr)->name) 01084 #define DST_ENUMERATOR_cval(attr) ((attr)->cval) 01085 01086 01087 01088 /* [tag==DW_TAG_subroutine_type] 01089 * 01090 * "flag" is subset of [prototyped] 01091 */ 01092 typedef struct DST_subroutine_type 01093 { 01094 USRCPOS decl; /* Source location */ 01095 DST_STR_IDX name; /* Name of type */ 01096 DST_INFO_IDX type; /* Return type, DST_INVALID_IDX if void */ 01097 DST_INFO_IDX abstract_origin; /* In inlined proc. instance */ 01098 DST_CHILDREN child; /* Parameters (may have unspecified param) */ 01099 } DST_SUBROUTINE_TYPE; 01100 01101 #define DST_SUBROUTINE_TYPE_decl(attr) ((attr)->decl) 01102 #define DST_SUBROUTINE_TYPE_name(attr) ((attr)->name) 01103 #define DST_SUBROUTINE_TYPE_type(attr) ((attr)->type) 01104 #define DST_SUBROUTINE_TYPE_abstract_origin(attr) ((attr)->abstract_origin) 01105 #define DST_SUBROUTINE_TYPE_first_child(attr) ((attr)->child.first) 01106 #define DST_SUBROUTINE_TYPE_last_child(attr) ((attr)->child.last) 01107 01108 01109 /* [tag==DW_TAG_ptr_to_member_type]: Back-end must supply run-time location 01110 * of member pointed to (.debug_loc offset). 01111 */ 01112 typedef struct DST_ptr_to_member_type 01113 { 01114 DST_STR_IDX name; /* Name of member pointed to */ 01115 DST_INFO_IDX type; /* Type of member pointed to */ 01116 DST_INFO_IDX class_type; /* Type of class of member pointed to */ 01117 } DST_PTR_TO_MEMBER_TYPE; 01118 01119 #define DST_PTR_TO_MEMBER_TYPE_name(attr) ((attr)->name) 01120 #define DST_PTR_TO_MEMBER_TYPE_type(attr) ((attr)->type) 01121 #define DST_PTR_TO_MEMBER_TYPE_class_type(attr) ((attr)->class_type) 01122 01123 01124 01125 /*--------------------------------* 01126 * General purpose routines/macros * 01127 *--------------------------------*/ 01128 01129 01130 /* Converts an index to a pointer to an object of the given type. 01131 */ 01132 #define DST_IDX_TO_PTR(i, btype) ((btype *)DST_idx_to_string(i)) 01133 #define DST_INFO_IDX_TO_PTR(i) ((DST_INFO *)DST_idx_to_string(i)) 01134 #define DST_ATTR_IDX_TO_PTR(i, attr_struct) DST_IDX_TO_PTR(i, attr_struct) 01135 #define DST_FILE_IDX_TO_PTR(i) ((DST_FILE_NAME *)DST_idx_to_string(i)) 01136 #define DST_DIR_IDX_TO_PTR(i) ((DST_INCLUDE_DIR *)DST_idx_to_string(i)) 01137 #define DST_STR_IDX_TO_PTR(i) ((char *)DST_idx_to_string(i)) 01138 01139 01140 01141 /*----------------------------------------------------------------- 01142 * Routines for traversing the child/sibling structure of DST nodes 01143 *------------------------------------------------------------------*/ 01144 01145 01146 /* When the entry has no child attribute or the child attribute is null 01147 * (DST_IS_NULL) then an invalid idx is returned (DST_INVALID_IDX), 01148 * otherwise an index to the first child is returned. 01149 */ 01150 extern DST_INFO_IDX DST_first_child(DST_INFO_IDX parent); 01151 extern DST_INFO_IDX DST_last_child(DST_INFO_IDX parent); 01152 01153 01154 01155 /* Appends a child to the end of the list of children (linked by sibling 01156 * indices) of the "parent". The child may be the first child of the 01157 * parent. 01158 */ 01159 extern void 01160 DST_append_child(DST_INFO_IDX parent, DST_INFO_IDX child); 01161 01162 01163 01164 /* Used to traverse the DST subgraph rooted at "i". Note that we 01165 * only follow child/sibling pointers, and the graph will therefore 01166 * appear as a tree (a node can only be the child of at most one parent, 01167 * and the sibling of at most one predecessor). The parameters are the 01168 * root of the tree to be traversed ("i"), an initial value to be used in 01169 * visiting the root of the tree ("init_val"), and an action to be 01170 * performed on each tree-node encountered in the pre-order tree-walk 01171 * ("action"). The action takes the value returned from the action on the 01172 * parent, as well as the tag, flag, attribute, and index of the node 01173 * currently visited. 01174 */ 01175 extern void 01176 DST_preorder_visit( 01177 DST_INFO_IDX i, 01178 INT32 init_val, 01179 INT32 (*action)(INT32, DST_DW_tag, DST_flag, DST_ATTR_IDX, DST_INFO_IDX)); 01180 01181 01182 #ifdef __cplusplus 01183 } 01184 #endif 01185 #endif /* dwarf_DST_INCLUDED */ 01186