GCC Middle and Back End API Reference
|
Data Structures | |
struct | indirect_string_node |
struct | dwarf_file_data |
struct | deferred_locations_struct |
struct | addr_table_entry_struct |
union | addr_table_entry_struct::addr_table_entry_struct_union |
struct | dw_loc_list_struct |
struct | dw_line_info_struct |
struct | dw_line_info_table_struct |
struct | dw_attr_struct |
struct | die_struct |
union | die_struct::die_symbol_or_type_node |
struct | pubname_struct |
struct | dw_ranges_struct |
struct | macinfo_struct |
struct | dw_ranges_by_label_struct |
struct | comdat_type_struct |
struct | limbo_die_struct |
struct | skeleton_chain_struct |
struct | die_arg_entry_struct |
struct | var_loc_node |
struct | var_loc_list_def |
struct | call_arg_loc_node |
struct | cached_dw_loc_list_def |
struct | checksum_attributes |
struct | cu_hash_table_entry |
struct | cu_hash_table_entry_hasher |
struct | decl_table_entry |
struct | decl_table_entry_hasher |
struct | external_ref |
struct | external_ref_hasher |
struct | file_info |
struct | dir_info |
struct | file_name_acquire_data |
struct | macinfo_entry_hasher |
struct | comdat_type_hasher |
struct | loc_list_hasher |
Enumerations | |
enum | ate_kind { ate_kind_rtx, ate_kind_rtx_dtprel, ate_kind_label } |
enum | dw_line_info_opcode { LI_set_address, LI_set_line, LI_set_file, LI_set_column, LI_negate_stmt, LI_set_prologue_end, LI_set_epilogue_begin, LI_set_discriminator } |
enum | dtprel_bool { dtprel_false = 0, dtprel_true = 1 } |
typedef struct addr_table_entry_struct addr_table_entry |
typedef struct cached_dw_loc_list_def cached_dw_loc_list |
typedef struct comdat_type_struct comdat_type_node |
The comdat type node structure.
typedef struct comdat_type_struct* comdat_type_node_ref |
typedef const char* dchar_p |
typedef struct deferred_locations_struct deferred_locations |
typedef struct die_arg_entry_struct die_arg_entry |
typedef struct die_struct die_node |
The Debugging Information Entry (DIE) structure. DIEs form a tree. The children of each node form a circular list linked by die_sib. die_child points to the node *before* the "first" child node.
typedef struct dw_attr_struct dw_attr_node |
Each DIE attribute has a field specifying the attribute kind, a link to the next attribute in the chain, and an attribute value. Attributes are typically linked below the DIE they modify.
typedef struct dw_attr_struct* dw_attr_ref |
Define typedefs here to avoid circular dependencies.
typedef struct dw_line_info_struct dw_line_info_entry |
typedef struct dw_line_info_struct* dw_line_info_ref |
typedef struct dw_line_info_table_struct dw_line_info_table |
typedef dw_line_info_table* dw_line_info_table_p |
typedef struct dw_loc_list_struct dw_loc_list_node |
Location lists are ranges + location descriptions for that range, so you can track variables that are in different places over their entire life.
typedef long int dw_offset |
Various DIE's use offsets relative to the beginning of the .debug_info section to refer to each other.
typedef struct dw_ranges_by_label_struct* dw_ranges_by_label_ref |
typedef struct dw_ranges_struct* dw_ranges_ref |
typedef struct limbo_die_struct limbo_die_node |
The limbo die list structure.
typedef hash_table<loc_list_hasher> loc_list_hash_type |
typedef struct macinfo_struct macinfo_entry |
A structure to hold a macinfo entry.
typedef struct pubname_struct pubname_entry |
The pubname structure
typedef struct pubname_struct* pubname_ref |
typedef struct skeleton_chain_struct skeleton_chain_node |
typedef struct var_loc_list_def var_loc_list |
enum ate_kind |
enum dtprel_bool |
enum dw_line_info_opcode |
The entries in the line_info table more-or-less mirror the opcodes that are used in the real dwarf line table. Arrays of these entries are collected per section when DWARF2_ASM_LINE_DEBUG_INFO is not supported.
|
static |
Referenced by add_abstract_origin_attribute(), and gen_array_type_die().
|
inlinestatic |
Add an 'abstract_origin' attribute below a given DIE. The DIE is found by looking in either the type declaration or object declaration equate table.
We may have gotten separated from the block for the inlined function, if we're in an exception handler or some such; make sure that the abstract function has been written out. Doing this for nested functions is wrong, however; functions are distinct units, and our context might not even be inline.
XXX: Functions that are never lowered don't always have correct block trees (in the case of java, they simply have no block tree, in some other languages). For these functions, there is nothing we can really do to output correct debug info for inlined functions in all cases. Rather than die, we'll just produce deficient debug info now, in that we will have variables without a proper abstract origin. In the future, when all functions are lowered, we should re-add a gcc_assert (origin_die) here.
References add_abstract_origin_attribute(), add_AT_flag(), add_location_or_const_value_attribute(), add_name_and_src_coords_attributes(), add_type_attribute(), decl_by_reference_p(), decl_function_context(), decl_ultimate_origin(), equate_decl_number_to_die(), new_die(), tcc_declaration, tcc_type, and variably_modified_type_p().
|
static |
Add DW_AT_accessibility attribute to DIE if needed.
In DWARF3+ the default is DW_ACCESS_private only in DW_TAG_class_type children, otherwise the default is DW_ACCESS_public. In DWARF2 the default has always been DW_ACCESS_public.
Referenced by add_bit_offset_attribute().
|
static |
|
static |
Add attr to the address table entry to the table. Defer setting an index until output time.
References AT_ref(), die_struct::die_attr, dw_attr_struct::dw_attr, and get_AT().
|
inlinestatic |
Add an address constant attribute value to a DIE. When using dwarf_split_debug_info, address attributes in dies destined for the final executable should be direct references--setting the parameter force_direct ensures this behavior.
References AT_unsigned(), and get_AT().
|
static |
|
inlinestatic |
Add an 8-byte data attribute value to a DIE.
References AT_class(), dw_attr_struct::dw_attr_val, dw_val_class_die_ref, dw_val_struct::dw_val_struct_union::dw_val_die_union::external, dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_die_ref.
|
static |
Referenced by add_AT_vec(), and is_symbol_die().
|
inlinestatic |
Add a DIE reference attribute value to a DIE.
With LTO we can end up trying to reference something we didn't create a DIE for. Avoid crashing later on a NULL referenced DIE.
References addr_table_entry_struct::index, and addr_table_entry_struct::refcount.
|
inlinestatic |
Add an unsigned double integer attribute value to a DIE.
Referenced by add_bit_offset_attribute().
|
static |
|
inlinestatic |
Add an FDE reference attribute value to a DIE.
References add_dwarf_attr(), dw_attr_struct::dw_attr, dw_attr_struct::dw_attr_val, dw_val_class_vms_delta, dw_val_struct::dw_val_struct_union::dw_val_vms_delta_union::lbl1, dw_val_struct::dw_val_struct_union::dw_val_vms_delta_union::lbl2, dw_val_struct::v, dw_val_struct::val_class, dw_val_struct::val_entry, and dw_val_struct::dw_val_struct_union::val_vms_delta.
|
inlinestatic |
Add a file attribute value to a DIE.
Referenced by gen_array_type_die().
|
static |
Referenced by add_abstract_origin_attribute(), gen_array_type_die(), output_loc_list(), and output_one_line_info_table().
|
inlinestatic |
Add a flag value attribute to a DIE.
|
static |
Referenced by add_bit_offset_attribute(), and fortran_common().
|
inlinestatic |
Add a signed integer attribute value to a DIE.
|
inlinestatic |
Add a label identifier attribute value to a DIE.
References AT_class(), die_struct::die_attr, dw_attr_struct::dw_attr_val, dw_val_class_str, indirect_string_node::refcount, dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_str.
Referenced by gen_call_site_die().
|
inlinestatic |
Add a section offset attribute value to a DIE, an offset into the debug_line section.
References die_struct::die_child, die_struct::die_parent, and die_struct::die_sib.
|
static |
Referenced by loc_list_from_tree(), record_type_tag(), and retry_incomplete_types().
|
inlinestatic |
Add a location description attribute value to a DIE.
References dw_attr_struct::dw_attr, dw_attr_struct::dw_attr_val, dw_val_class_lbl_id, dw_val_struct::v, dw_val_struct::val_class, dw_val_struct::val_entry, and dw_val_struct::dw_val_struct_union::val_lbl_id.
|
static |
Referenced by loc_list_from_tree(), and record_type_tag().
|
inlinestatic |
|
inlinestatic |
The following routines define various Dwarf attributes and any data associated with them.
Add a location description attribute value to a DIE. This emits location attributes suitable for whole variables and whole parameters. Note that the location attributes for struct fields are generated by the routine `data_member_location_attribute' below.
|
inlinestatic |
Add DW_AT_low_pc and DW_AT_high_pc to a DIE. When using dwarf_split_debug_info, address attributes in dies destined for the final executable have force_direct set to avoid using indexed references.
References add_dwarf_attr(), dw_attr_struct::dw_attr, dw_attr_struct::dw_attr_val, dw_val_class_fde_ref, dw_val_struct::v, dw_val_struct::val_class, dw_val_struct::val_entry, and dw_val_struct::dw_val_struct_union::val_fde_index.
Referenced by add_descr_info_field(), and move_linkage_attr().
|
inlinestatic |
Add a section offset attribute value to a DIE, an offset into the debug_macinfo section.
References die_struct::die_child, die_struct::die_parent, and die_struct::die_sib.
|
inlinestatic |
Add an offset attribute value to a DIE.
|
static |
Add the DW_AT_GNU_pubnames and DW_AT_GNU_pubtypes attributes.
|
static |
|
static |
For the range_list attribute, use val_entry to store whether the offset should follow split-debug-info or normal semantics. This value is read in output_range_list_offset.
References die_struct::die_child, die_struct::die_sib, die_struct::die_tag, and remove_child_with_prev().
|
static |
Referenced by gen_array_type_die().
|
inlinestatic |
Add an AT_specification attribute to a DIE, and also make the back pointer from the specification to the definition.
References AT_class(), dw_attr_struct::dw_attr_val, dw_val_class_addr, dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_addr.
|
static |
|
inlinestatic |
Add a string attribute value to a DIE.
References addr_table_entry_struct::addr, ate_kind_label, ate_kind_rtx, ate_kind_rtx_dtprel, addr_table_entry_struct::addr_table_entry_struct_union::label, addr_table_entry_struct::addr_table_entry_struct_union::rtl, and rtx_equal_p().
|
inlinestatic |
Add an unsigned integer attribute value to a DIE.
References AT_class(), dw_attr_struct::dw_attr_val, dw_val_class_str, find_string_form(), dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_str.
Referenced by add_location_or_const_value_attribute(), fortran_common(), gen_array_type_die(), and should_move_die_to_comdat().
|
inlinestatic |
Add a floating point attribute value to a DIE and return it.
References add_AT_die_ref(), and die_struct::die_definition.
Referenced by add_const_value_attribute().
|
inlinestatic |
Add a vms delta attribute value to a DIE.
References comp_unit_die(), and get_AT_unsigned().
Referenced by gen_descr_array_type_die().
|
static |
|
inlinestatic |
For a FIELD_DECL node which represents a bit-field, output an attribute which specifies the distance in bits from the highest order bit of the "containing object" for the bit-field to the highest order bit of the bit-field itself. For any given bit-field, the "containing object" is a hypothetical object (of some integral or enum type) within which the given bit-field lives. The type of this hypothetical "containing object" is always the same as the declared type of the individual bit-field itself. The determination of the exact location of the "containing object" for a bit-field is rather complicated. It's handled by the `field_byte_offset' function (above). Note that it is the size (in bytes) of the hypothetical "containing object" which will be given in the DW_AT_byte_size attribute for this bit-field. (See `byte_size_attribute' above).
Must be a field and a bit field.
We can't yet handle bit-fields whose offsets are variable, so if we encounter such things, just return without generating any attribute whatsoever. Likewise for variable or too large size.
Note that the bit offset is always the distance (in bits) from the highest-order bit of the "containing object" to the highest-order bit of the bit-field itself. Since the "high-order end" of any object or field is different on big-endian and little-endian machines, the computation below must take account of these differences.
References add_accessibility_attribute(), add_AT_double(), add_AT_int(), add_byte_size_attribute(), add_child_die(), add_name_attribute(), add_src_coords_attributes(), die_struct::die_parent, HOST_BITS_PER_WIDE_INT, host_integerp(), new_die(), scope_die_for(), and simple_type_size_in_bits().
|
static |
|
inlinestatic |
For a FIELD_DECL node which represents a bit field, output an attribute which specifies the length in bits of the given field.
Must be a field and a bit field.
|
static |
Referenced by lower_bound_default().
|
static |
Given a tree node describing an array bound (either lower or upper) output a representation for that bound.
All fixed-bounds are represented by INTEGER_CST nodes.
Use the default if possible.
Otherwise represent the bound as an unsigned value with the precision of its type. The precision and signedness of the type will be necessary to re-interpret it unambiguously.
??? Can this happen, or should the variable have been bound first? Probably it can, since I imagine that we try to create the types of parameters in the order in which they exist in the list, and won't have created a forward reference to a later parameter.
FALLTHRU
Otherwise try to create a stack operation procedure to evaluate the value of the array bound.
If DW_AT_*bound is not a reference nor constant, it is a DWARF expression rather than location description. For that loc_list_from_tree (bound, 0) is needed. If that fails to give a single element list, fall back to outputting this as a reference anyway.
|
static |
Referenced by add_bit_offset_attribute().
|
static |
For a data member of a struct or union, the DW_AT_byte_size is generally given as the number of bytes normally allocated for an object of the *declared* type of the member itself. This is true even for bit-fields.
Note that `size' might be -1 when we get to this point. If it is, that indicates that the byte size of the entity in question is variable. We have no good way of expressing this fact in Dwarf at the present time, so just let the -1 pass on through.
|
inlinestatic |
A helper function for gen_inlined_subroutine_die. Add source coordinate attributes to the DIE for a block STMT, to describe where the inlined function was called from. This is similar to add_src_coords_attributes.
|
static |
|
static |
Given an object die, add the calling convention attribute for the function call type.
DWARF 2 doesn't provide a way to identify a program's source-level entry point. DW_AT_calling_convention attributes are only meant to describe functions' calling conventions. However, lacking a better way to signal the Fortran main program, we used this for a long time, following existing custom. Now, DWARF 4 has DW_AT_main_subprogram, which we add below, but some tools still rely on the old way, which we thus keep.
Only add the attribute if the backend requests it, and is not DW_CC_normal.
|
static |
|
static |
Add a CHILD_DIE as the last child of DIE.
FIXME this should probably be an assert.
|
static |
Referenced by prune_unused_types_prune().
|
static |
Generate a DW_AT_comp_dir attribute for DIE.
|
static |
Referenced by insert_float().
|
static |
Attach a DW_AT_const_value attribute for a variable or a parameter which does not have a "location" either in memory or in a register. These things can arise in GNU C when a constant is passed as an actual parameter to an inlined function. They can also arise in C++ where declared constants do not necessarily get memory "homes".
Note that a CONST_DOUBLE rtx could represent either an integer or a floating-point constant. A CONST_DOUBLE is used whenever the constant requires more than one word in order to be adequately represented.
FALLTHROUGH
In cases where an inlined instance of an inline function is passed the address of an `auto' variable (which is local to the caller) we can get a situation where the DECL_RTL of the artificial local variable (for the inlining) which acts as a stand-in for the corresponding formal parameter (of the inline function) will look like (plus:SI (reg:SI FRAME_PTR) (const_int ...)). This is not exactly a compile-time constant expression, but it isn't the address of the (artificial) local variable either. Rather, it represents the *value* which the artificial local variable always has during its lifetime. We currently have no way to represent such quasi-constant values in Dwarf, so for now we just punt and generate nothing.
No other kinds of rtx should be possible here.
References add_AT_vec().
|
static |
|
static |
Attach the specialized form of location attribute used for data members of struct and union types. In the special case of a FIELD_DECL node which represents a bit-field, the "offset" part of this special location descriptor must indicate the distance in bytes from the lowest-addressed byte of the containing struct or union type to the lowest-addressed byte of the "containing object" for the bit-field. (See the `field_byte_offset' function above). For any given bit-field, the "containing object" is a hypothetical object (of some integral or enum type) within which the given bit-field lives. The type of this hypothetical "containing object" is always the same as the declared type of the individual bit-field itself (for GCC anyway... the DWARF spec doesn't actually mandate this). Note that it is the size (in bytes) of the hypothetical "containing object" which will be given in the DW_AT_byte_size attribute for this bit-field. (See the `byte_size_attribute' function below.) It is also used when calculating the value of the DW_AT_bit_offset attribute. (See the `bit_offset_attribute' function below.)
We're working on the TAG_inheritance for a base class.
For C++ virtual bases we can't just use BINFO_OFFSET, as they aren't at a fixed offset from all (sub)objects of the same type. We need to extract the appropriate offset from our vtable. The following dwarf expression means BaseAddr = ObAddr + *((*ObAddr) - Offset) This is specific to the V3 ABI, of course.
Make a copy of the object address.
Extract the vtable address.
Calculate the address of the offset.
Extract the offset.
Add it to the object address.
Don't need to output a location expression, just the constant.
The DWARF2 standard says that we should assume that the structure address is already on the stack, so we can specify a structure field address by using DW_OP_plus_uconst.
References count, host_integerp(), constructor_elt_d::index, int_size_in_bytes(), memcpy(), memset(), native_encode_initializer(), tree_low_cst(), type(), and constructor_elt_d::value.
|
static |
References add_AT_low_high_pc().
|
static |
|
inlinestatic |
Add an attribute/value pair to a DIE.
Maybe this should be an assert?
|
static |
|
static |
Add an enumerator to the pubnames section.
References g.
|
static |
Retrieve the descriptive type of TYPE, if any, make sure it has a DIE and attach a DW_AT_GNAT_descriptive_type attribute to the DIE of TYPE accordingly. ??? This is a temporary measure until after we're able to generate regular DWARF for the complex Ada type system.
References add_name_attribute(), is_ada(), is_fortran(), new_die(), scope_die_for(), and type_tag().
|
inlinestatic |
A helper function for gen_lexical_block_die and gen_inlined_subroutine_die. Add low_pc and high_pc attributes to the DIE for a block STMT.
Optimize duplicate .debug_ranges lists or even tails of lists. If this BLOCK has same ranges as its supercontext, lookup DW_AT_ranges attribute in the supercontext (and recursively so), verify that the ranges_table contains the right values and use it instead of adding a new .debug_range.
|
static |
Add a DW_AT_linkage_name or DW_AT_MIPS_linkage_name attribute for the given decl. This used to be a vendor extension until after DWARF 4 standardized it.
Mimic what assemble_name_raw does with a leading '*'.
|
static |
Add DW_AT_{,MIPS_}linkage_name attribute for the given decl.
Defer until we have an assembler name set.
Referenced by gen_array_type_die().
|
inlinestatic |
Add a location description term to a location description expression.
Find the end of the chain.
Referenced by add_loc_descr_op_piece(), dbx_reg_number(), modified_type_die(), reg_loc_descriptor(), and scompare_loc_descriptor().
|
static |
|
static |
Optionally add a DW_OP_piece term to a location description expression. DW_OP_piece is only added if the location description expression already doesn't end with DW_OP_piece.
Find the end of the chain.
References add_loc_descr(), int_loc_descriptor(), and new_loc_descr().
|
static |
To each location in list LIST add loc descr REF.
|
static |
Given two lists RET and LIST produce location list that is result of adding expression in LIST to expression in RET on each position in program. Might be destructive on both RET and LIST. TODO: We handle only simple cases of RET or LIST having at most one element. General case would inolve sorting the lists in program order and merging them that will need some additional work. Adding that will improve quality of debug info especially for SRA-ed structures.
References bit_position(), tree_to_double_int(), and type().
|
static |
Generate *either* a DW_AT_location attribute or else a DW_AT_const_value data attribute for a variable or a parameter. We generate the DW_AT_const_value attribute only in those cases where the given variable or parameter does not have a true "location" either in memory or in a register. This can happen (for example) when a constant is passed as an actual argument in a call to an inline function. (It's possible that these things can crop up in other ways also.) Note that one type of constant value which can be passed into an inlined function is a constant pointer. This can happen for example if an actual argument in an inlined function call evaluates to a compile-time constant address. CACHE_P is true if it is worth caching the location list for DECL, so that future calls can reuse it rather than regenerate it from scratch. This is true for BLOCK_NONLOCALIZED_VARS in inlined subroutines, since we will need to refer to them each time the function is inlined.
Try to get some constant RTL for this decl, and use that as the value of the location.
See if we have single element location list that is equivalent to a constant value. That way we are better to use add_const_value_attribute rather than expanding constant value equivalent.
If this decl is from BLOCK_NONLOCALIZED_VARS, we might need its list several times. See if we've already cached the contents.
It is usually worth caching this result if the decl is from BLOCK_NONLOCALIZED_VARS and if the list has at least two elements.
None of that worked, so it must not really have a location; try adding a constant value attribute from the DECL_INITIAL.
References add_AT_unsigned(), host_integerp(), and tree_low_cst().
Referenced by add_abstract_origin_attribute().
|
static |
Referenced by add_abstract_origin_attribute(), and gen_array_type_die().
|
static |
Add a DW_AT_name attribute and source coordinate attribute for the given decl, but only if it actually has a name.
Get the function's name, as described by its RTL. This may be different from the DECL_NAME name used in the source file.
|
static |
Referenced by add_bit_offset_attribute(), and add_gnat_descriptive_type_attribute().
|
static |
Generate a DW_AT_name attribute given some string value to be included as the value of the attribute.
|
static |
|
inlinestatic |
If the compiled language is ANSI C, then add a 'prototyped' attribute, if arg types are given for the parameters of a function.
|
static |
Referenced by gen_array_type_die().
|
static |
Don't add items to the table when we expect that the consumer will have just read the enclosing die. For example, if the consumer is looking at a class_member, it will either be inside the class already, or will have just looked up the class to find the member. Either way, searching the class is faster than searching the index.
|
static |
|
static |
Add a new entry to .debug_pubnames if appropriate.
|
static |
|
static |
Add a new entry to .debug_pubtypes if appropriate.
If we don't have a name for the type, there's no point in adding it to the table.
Although it might be more consistent to add the pubinfo for the enumerators as their dies are created, they should only be added if the enum type meets the criteria above. So rather than re-check the parent enum type whenever an enumerator die is created, just output them all here. This isn't protected by the name conditional because anonymous enums don't have names.
References dir_info::count, file_info::dir_idx, dir_info::dir_idx, dw2_asm_output_data(), file_info_cmp(), file_name_acquire(), file_table, file_name_acquire_data::files, file_info::fname, dir_info::length, file_name_acquire_data::max_files, path, file_info::path, dir_info::path, dir_info::prefix, and file_name_acquire_data::used_files.
|
static |
|
inlinestatic |
We do not currently support the pure_virtual attribute.
GNU extension: Record what type this method came from originally.
|
static |
|
static |
Add a new entry to .debug_ranges corresponding to a block, or a range terminator if BLOCK is NULL.
|
static |
Add a new entry to .debug_ranges corresponding to a pair of labels. When using dwarf_split_debug_info, address attributes in dies destined for the final executable should be direct references--setting the parameter force_direct ensures this behavior.
|
static |
Referenced by add_top_level_skeleton_die_attrs(), and get_skeleton_type_unit().
|
static |
Add a new entry to .debug_ranges. Return the offset at which it was placed.
|
static |
|
static |
Traverse the DIE and add a sibling attribute if it may have the effect of speeding up access to siblings. To save some space, avoid generating sibling attributes for DIE's without children.
|
inlinestatic |
Add a string attribute value to a skeleton DIE.
|
static |
Referenced by add_bit_offset_attribute().
|
static |
Add source coordinate attributes for the given decl.
|
static |
|
static |
Add subscript info to TYPE_DIE, describing an array TYPE, collapsing possibly nested array subscripts in a flat sequence if COLLAPSE_P is true. Note that the block of subscript information for an array type also includes information about the element type of the given array type.
Arrays come in three flavors: Unspecified bounds, fixed bounds, and (in GNU C only) variable bounds. Handle all three forms here.
We have an array type with specified bounds.
Define the index type.
??? This is probably an Ada unnamed subrange type. Ignore the TREE_TYPE field. We can't emit debug info for this because it is an unnamed integral type.
??? If upper is NULL, the array has unspecified length, but it does have a lower bound. This happens with Fortran dimension arr(N:*) Since the debugger is definitely going to need to know N to produce useful results, go ahead and output the lower bound solo, and hope the debugger can cope.
Otherwise we have an array type with an unspecified length. The DWARF-2 spec does not say how to handle this; let's just leave out the bounds.
|
static |
Helper function to generate top-level dies for skeleton debug_info and debug_types.
References add_ranges_num().
|
static |
Many forms of DIEs require a "type description" attribute. This routine locates the proper "type descriptor" die for the type given by 'type', and adds a DW_AT_type attribute below the given die.
??? If this type is an unnamed subrange type of an integral, floating-point or fixed-point type, use the inner type. This is because we have no support for unnamed types in base_type_die. This can happen if this is an Ada subrange type. Correct solution is emit a subrange type die.
Handle a special case. For functions whose return type is void, we generate *no* type attribute. (Note that no object may have type `void', so this only applies to function return types).
References comp_unit_die(), decl_class_context(), decl_function_context(), and gen_type_die_for_member().
Referenced by add_abstract_origin_attribute().
|
staticread |
|
staticread |
Add a variable location node to the linked list for DECL.
For PARM_DECLs try to keep around the original incoming value, even if that means we'll emit a zero-range .debug_loc entry.
TEMP->LAST here is either pointer to the last but one or last element in the chained list, LAST is pointer to the last element.
For SRA optimized variables if there weren't any real insns since last note, just modify the last node.
If the last note doesn't cover any instructions, remove it.
If the current location is the same as the end of the list, and either both or neither of the locations is uninitialized, we have nothing to do.
Add LOC to the end of list and update LAST. If the last element of the list has been removed above, reuse its memory for the new node, otherwise allocate a new one.
Ensure TEMP->LAST will point either to the new last but one element of the chain, or to the last element in it.
|
static |
Hash an address_table_entry.
References add_dwarf_attr(), dw_attr_struct::dw_attr, dw_attr_struct::dw_attr_val, dw_val_class_offset, offset, dw_val_struct::v, dw_val_struct::val_class, dw_val_struct::val_entry, and dw_val_struct::dw_val_struct_union::val_offset.
|
static |
Determine equality for two address_table_entries.
References add_dwarf_attr(), dw_attr_struct::dw_attr, dw_attr_struct::dw_attr_val, dw_val_class_range_list, offset, dw_val_struct::v, dw_val_struct::val_class, dw_val_struct::val_entry, and dw_val_struct::dw_val_struct_union::val_offset.
|
static |
Return loc description representing "address" of integer value. This can appear only as toplevel expression.
Determine if DW_OP_stack_value or DW_OP_implicit_value is more compact. For DW_OP_stack_value we need: litsize + 1 (DW_OP_stack_value) and for DW_OP_implicit_value: 1 (DW_OP_implicit_value) + 1 (length) + size.
|
static |
This function either modifies location piece list *DEST in place (if SRC and INNER is NULL), or copies location piece list *SRC to *DEST while modifying it. Location BITPOS is modified to contain LOC_NOTE, any pieces overlapping it are removed resp. not copied and if needed some padding around it is added. When modifying in place, DEST should point to EXPR_LIST where earlier pieces cover PIECE_BITPOS bits, when copying SRC points to the start of the whole list and INNER points to the EXPR_LIST where earlier pieces cover PIECE_BITPOS bits.
First copy all nodes preceding the current bitpos.
Add padding if needed.
A piece with correct bitpos and bitsize already exist, just update the location for it and return.
Add the piece that changed.
Skip over pieces that overlap it.
Add padding if needed.
Finally copy all nodes following it.
Referenced by decl_die_table_hash().
|
static |
|
static |
Schedule generation of a DW_AT_const_value attribute to DIE. That generation should happen after function debug info has been generated. The value of the attribute is the constant value of ARG.
References dwarf2out_do_cfi_asm(), and UI_DWARF2.
|
static |
|
static |
Assign symbols to all worthy DIEs under DIE.
References decl_table_entry::copy, hash_table< Descriptor, Allocator >::find_slot_with_hash(), and decl_table_entry::orig.
|
inlinestatic |
|
inlinestatic |
Get the RTX from to an address DIE attribute.
|
inlinestatic |
|
inlinestatic |
|
staticread |
Get the dwarf_file_data from a file DIE attribute.
References comp_unit_die(), and get_AT_unsigned().
|
inlinestatic |
|
inlinestatic |
References indirect_string_node::form, len, indirect_string_node::str, and strlen().
|
inlinestatic |
Referenced by include_pubname_in_output().
|
inlinestatic |
Return the index for any attribute that will be referenced with a DW_FORM_GNU_addr_index or DW_FORM_GNU_str_index. String indices are stored in dw_attr_val.v.val_str for reference counting pruning.
References indirect_string_node::label.
|
inlinestatic |
Referenced by construct_piece_list(), and size_of_aranges().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Referenced by clone_tree_hash(), and size_of_aranges().
|
inlinestatic |
|
inlinestatic |
Referenced by construct_piece_list(), and unmark_all_dies().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Referenced by add_addr_table_entry(), and remove_child_or_replace_with_skeleton().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Referenced by index_addr_table_entry().
|
inlinestatic |
|
static |
|
static |
Find out whether the string referenced from the attribute should be output inline in DIE or out-of-line in .debug_str section.
|
inlinestatic |
Referenced by add_AT_addr(), construct_piece_list(), and size_of_aranges().
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Return the start label of a delta attribute.
References die_struct::die_parent.
|
inlinestatic |
|
inlinestatic |
Return the end label of a delta attribute.
References die_struct::die_child, and die_struct::die_sib.
|
static |
|
static |
Calculate the checksum of an attribute.
We don't care that this was compiled with a different compiler snapshot; if the output is the same, that's what matters.
|
static |
Calculate the checksum of an attribute.
For pointer and reference types, we checksum only the (qualified) name of the target type (if there is a name). For friend entries, we checksum only the (qualified) name of the target type or function. This allows the checksum to remain the same whether the target type is complete or not.
For all other references to another DIE, we check to see if the target DIE has already been visited. If it has, we emit a backward reference; if not, we descend recursively.
|
static |
Comparison function for sorting marked base types.
|
static |
|
static |
Given a pointer to a tree node for some base type, return a pointer to a DIE that describes the given type. This routine must only be called for GCC type nodes that correspond to Dwarf base (fundamental) types.
If this is a subtype that should not be emitted as a subrange type, use the base type. See subrange_type_for_debug_p.
Dwarf2 doesn't know anything about complex ints, so use a user defined type for it.
GNU FORTRAN/Ada/C++ BOOLEAN type.
No other TREE_CODEs are Dwarf fundamental types.
|
static |
Return a reference to DW_TAG_base_type corresponding to MODE and UNSIGNEDP if possible, NULL otherwise.
Referenced by bswap_loc_descriptor(), dbx_reg_number(), reg_loc_descriptor(), and scompare_loc_descriptor().
|
static |
Return a location descriptor that designates a base+offset location.
We only use "frame base" when we're sure we're talking about the post-prologue local stack frame. We do this by *not* running register elimination until this point, and recognizing the special argument pointer and soft frame pointer rtx's.
If drap register is used to align stack, use frame pointer + offset to access stack variables. If stack is aligned without drap, use stack pointer + offset to access stack variables.
Use cfa+offset to represent the location of arguments passed on the stack when drap is used to align stack. Only do this when not optimizing, for optimized code var-tracking is supposed to track where the arguments live and the register used as vdrap or drap in some spot might be used for something else in other part of the routine.
|
static |
Referenced by should_move_die_to_comdat().
|
static |
Traverse the DIE and set up additional .debug_types sections for each type worthy of being placed in a COMDAT section.
Break out nested types into their own type units.
Create a new type unit DIE as the root for the new tree, and add it to the list of comdat types.
Generate the type signature.
Copy the declaration context, attributes, and children of the declaration into the new type unit DIE, then remove this DIE from the main CU (or replace it with a skeleton if necessary).
Add the DIE to the new compunit.
Look for nested types that can be broken out.
|
static |
|
static |
Traverse the DIE (which is always comp_unit_die), and set up additional compilation units for each of the include files we see bracketed by BINCL/EINCL.
This DIE is for a secondary CU; remove it from the main one.
We can only use this in debugging, since the frontend doesn't check to make sure that we leave every include file we enter.
References add_child_die(), clone_die(), die_struct::die_sib, generate_skeleton_ancestor_tree(), generate_skeleton_bottom_up(), is_declaration_die(), is_template_instantiation(), move_all_children(), skeleton_chain_struct::new_die, skeleton_chain_struct::old_die, remove_child_with_prev(), and replace_child().
|
static |
BSWAP (constS is initial shift count, either 56 or 24): constS const0 L1: DW_OP_pick <2> constS DW_OP_pick <3> DW_OP_minus DW_OP_shr const255 DW_OP_and DW_OP_pick <2> DW_OP_shl DW_OP_or DW_OP_swap DW_OP_dup const0 DW_OP_eq DW_OP_bra <L2> const8 DW_OP_minus DW_OP_swap DW_OP_skip <L1> L2: DW_OP_drop DW_OP_swap DW_OP_drop
References base_type_for_mode(), do_binop(), and typed_binop().
|
static |
The format of each DIE (and its attribute value pairs) is encoded in an abbreviation table. This routine builds the abbreviation table and assigns a unique abbreviation id for each abbreviation entry. The children of each die are visited recursively.
Scan the DIE references, and replace any that refer to DIEs from other CUs (i.e. those which are not marked) with the local stubs we built in optimize_external_refs.
We aren't changing this reference, so mark it external.
Referenced by output_loc_list_offset().
|
read |
This function builds a dwarf location descriptor sequence for the address at OFFSET from the CFA when stack is aligned to ALIGNMENT byte.
When CFA is defined as FP+OFFSET, emulate stack alignment.
References LI_negate_stmt, LI_set_address, LI_set_column, LI_set_discriminator, LI_set_epilogue_begin, LI_set_file, LI_set_line, and LI_set_prologue_end.
|
read |
This function builds a dwarf location descriptor sequence from a dw_cfa_location, adding the given OFFSET to the result of the expression.
|
static |
Return nonzero if decl_id of cached_dw_loc_list X is the same as UID of decl *Y.
|
static |
Returns a hash value for X (which really is a cached_dw_loc_list_list).
|
static |
Size just the base type children at the start of the CU. This is needed because build_abbrev needs to size locs and sizing of type based stack ops needs to know die_offset values for the base types.
|
static |
Referenced by copy_decls_for_unworthy_types().
|
static |
Size the debugging information associated with a given DIE. Visits the DIE's children recursively. Updates the global variable next_die_offset, on each time through. Uses the current value of next_die_offset to update the die_offset field in each DIE.
Count the null byte used to terminate sibling lists.
References dw_loc_list_struct::begin, dw_loc_list_struct::begin_entry, dw2_asm_output_data(), dw2_asm_output_data_uleb128(), dw2_asm_output_delta(), dw_loc_list_struct::end, addr_table_entry_struct::index, and dw_loc_list_struct::ll_symbol.
|
static |
|
inlinestatic |
Given a value, round it up to the lowest multiple of `boundary' which is not less than the value itself.
|
inlinestatic |
Change DIE reference REF to point to NEW_DIE instead.
Referenced by remove_child_or_replace_with_skeleton().
|
static |
Check whether we have already seen this CU and set up SYM_NUM accordingly.
|
static |
|
static |
Checksum the context of the DIE. This adds the names of any surrounding namespaces or structures to the checksum.
|
static |
|
static |
Calculate the checksum of a number in signed LEB128 format.
|
static |
Referenced by dwarf2out_imported_module_or_decl_1().
|
static |
Calculate the checksum of a number in unsigned LEB128 format.
More bytes to follow.
|
inlinestatic |
Referenced by gen_array_type_die().
|
inlinestatic |
Returns nonzero if CONTEXT_DIE is a class or namespace, for deciding whether or not to treat a DIE in this context as a declaration.
|
inlinestatic |
|
inlinestatic |
Returns nonzero if CONTEXT_DIE is a class.
|
static |
|
static |
Make a clone of DIE as a declaration.
If the DIE is already a declaration, just clone it.
If the DIE is a specification, just clone its declaration DIE.
We don't want to copy over all attributes. For example we don't want DW_AT_byte_size because otherwise we will no longer have a declaration and GDB will treat it as a definition.
|
static |
Referenced by break_out_includes(), clone_tree(), is_comdat_die(), and is_symbol_die().
|
static |
Make a clone of DIE.
|
static |
Referenced by is_comdat_die().
|
static |
Make a clone of the tree rooted at DIE.
References clone_die(), hash_table< Descriptor, Allocator >::find_slot_with_hash(), and decl_table_entry::orig.
|
static |
Like clone_tree, but additionally enter all the children into the hash table decl_table.
Assert that DIE isn't in the hash table yet. If it would be there before, the ancestors would be necessarily there as well, therefore clone_tree_hash wouldn't be called.
References AT_loc(), constant_size(), size_of_locs(), and size_of_uleb128().
|
static |
CLZ (where constV is CLZ_DEFINED_VALUE_AT_ZERO computed value, const0 is DW_OP_lit0 or corresponding typed constant, const1 is DW_OP_lit1 or corresponding typed constant and constMSB is constant with just the MSB bit set for the mode): DW_OP_dup DW_OP_bra <L1> DW_OP_drop constV DW_OP_skip <L4> L1: const0 DW_OP_swap L2: DW_OP_dup constMSB DW_OP_and DW_OP_bra <L3> const1 DW_OP_shl DW_OP_swap DW_OP_plus_uconst <1> DW_OP_swap DW_OP_skip <L2> L3: DW_OP_drop L4: DW_OP_nop CTZ is similar: DW_OP_dup DW_OP_bra <L1> DW_OP_drop constV DW_OP_skip <L4> L1: const0 DW_OP_swap L2: DW_OP_dup const1 DW_OP_and DW_OP_bra <L3> const1 DW_OP_shr DW_OP_swap DW_OP_plus_uconst <1> DW_OP_swap DW_OP_skip <L2> L3: DW_OP_drop L4: DW_OP_nop FFS is similar: DW_OP_dup DW_OP_bra <L1> DW_OP_drop const0 DW_OP_skip <L4> L1: const1 DW_OP_swap L2: DW_OP_dup const1 DW_OP_and DW_OP_bra <L3> const1 DW_OP_shr DW_OP_swap DW_OP_plus_uconst <1> DW_OP_swap DW_OP_skip <L2> L3: DW_OP_drop L4: DW_OP_nop
|
static |
|
static |
Collect the attributes that we will want to use for the checksum.
|
static |
|
static |
Return nonzero if decl_id and die_parent of die_struct X is the same as decl_id and die_parent of die_struct Y.
|
static |
|
static |
Returns a hash value for X (which really is a die_struct).
|
static |
Retrieve the comp_dir string suitable for use with DW_AT_comp_dir.
|
static |
Return the root of the DIE's built for the current compilation unit.
Referenced by add_AT_vms_delta(), add_type_attribute(), AT_file(), gen_inlined_subroutine_die(), prune_unused_types(), prune_unused_types_prune(), should_move_die_to_comdat(), and tree_add_const_value_attribute_for_decl().
|
static |
Return location descriptor for comparison OP with operands OP0 and OP1.
Referenced by reg_loc_descriptor().
|
inlinestatic |
Return true if X and Y opcodes have the same operands.
FALLTHRU
If splitting debug info, the use of DW_OP_GNU_addr_index can cause irrelevant differences in dw_loc_addr.
Other codes have no operands.
Referenced by prune_unused_types_walk_local_classes().
|
inlinestatic |
Return true if DWARF location expressions X and Y are the same.
|
static |
Compute a displacement from the "steady-state frame pointer" to the frame base (often the same as the CFA), and store it in frame_pointer_fb_offset. OFFSET is added to the displacement before the latter is negated.
??? AVR doesn't set up valid eliminations when there is no stack frame in which to eliminate. This is because it's stack pointer isn't directly accessible as a register within the ISA. To work around this, assume that while we cannot provide a proper value for frame_pointer_fb_offset, we won't need one either.
|
static |
|
static |
Calculate the MD5 checksum of the compilation unit DIE UNIT_DIE and its children, and set comdat_symbol_id accordingly.
Compute the checksum of the DIE, then append part of it as hex digits to the name filename of the unit.
References contains_subprogram_definition(), die_struct::die_tag, and is_declaration_die().
|
static |
|
static |
Return a descriptor that describes the concatenation of two locations. This is typically a complex variable.
References dw_loc_list_1(), and var_loc_node::loc.
|
static |
Return a descriptor that describes the concatenation of N locations.
|
static |
Return true if constant RTL can be emitted in DW_OP_addr or DW_AT_const_value. TLS SYMBOL_REFs, external SYMBOL_REFs or non-marked constant pool SYMBOL_REFs can't be referenced in it.
|
static |
Helper function for const_ok_for_output, called either directly or via for_each_rtx.
If delegitimize_address couldn't do anything with the UNSPEC, assume we can't express it in the debug info.
Don't complain about TLS UNSPECs, those are just too hard to delegitimize. Note this could be a non-decl SYMBOL_REF such as one in a constant pool entry, so testing SYMBOL_REF_TLS_MODEL rather than DECL_THREAD_LOCAL_P is not just an optimization.
If all references to this pool constant were optimized away, it was not output and thus we can't represent it.
Avoid references to external symbols in debug info, on several targets the linker might even refuse to link when linking a shared library, and in many other cases the relocations for .debug_info/.debug_loc are dropped, so the address becomes zero anyway. Hidden symbols, guaranteed to be defined within the same shared library or executable are fine.
|
static |
Referenced by clone_tree_hash(), and size_of_aranges().
|
static |
Return the power-of-two number of bytes necessary to represent VALUE.
|
static |
Return rtx that should be stored into loc field for LOC_NOTE and BITPOS/BITSIZE.
References AT_int(), AT_loc_list(), AT_unsigned(), dw_val_class_addr, dw_val_class_const, dw_val_class_loc, dw_val_class_loc_list, dw_val_class_offset, dw_val_class_range_list, dw_val_class_unsigned_const, HOST_WIDE_INT_PRINT_DEC, and HOST_WIDE_INT_PRINT_UNSIGNED.
Referenced by strip_naming_typedef().
|
static |
Return non-zero if this DIE contains a defining declaration of a subprogram.
References add_child_die(), and remove_child_with_prev().
Referenced by compute_section_prefix().
|
static |
Convert the CFI instructions for the current function into a location list. This is used for DW_AT_frame_base when we targeting a dwarf2 consumer that does not support the dwarf3 DW_OP_call_frame_cfa. OFFSET is a constant to be added to all CFA expressions.
??? Bald assumption that the CIE opcode list does not contain advance opcodes.
If the first partition contained no CFI adjustments, the CIE opcodes apply to the whole first partition.
The encoding is complex enough that we should never emit this.
References die_struct::die_parent, and die_struct::die_tag.
Referenced by record_type_tag().
|
static |
For OP descriptor assumed to be in unsigned MODE, convert it to a unsigned type matching MODE, or, if MODE is narrower than or as wide as DWARF2_ADDR_SIZE, untyped. Return NULL if the conversion is not possible.
References dw_val_struct::dw_val_struct_union::dw_val_die_union::die, dw_loc_descr_struct::dw_loc_oprnd1, dw_val_class_decl_ref, dw_val_class_die_ref, dw_val_struct::dw_val_struct_union::dw_val_die_union::external, lookup_decl_die(), new_loc_descr(), dw_val_struct::v, dw_val_struct::val_class, dw_val_struct::dw_val_struct_union::val_decl_ref, and dw_val_struct::dw_val_struct_union::val_die_ref.
|
static |
Copy DIE and its ancestors, up to, but not including, the compile unit or type unit entry, to a new tree. Adds the new tree to UNIT and returns a pointer to the copy of DIE. If DECL_TABLE is provided, it is used to check if the ancestor has already been copied into UNIT.
Check if the entry has already been copied to UNIT.
Record in DECL_TABLE that DIE has been copied to UNIT.
Record the pointer to the copy.
References copy_decls_walk(), hash_table< Descriptor, Allocator >::create(), decl_table, hash_table< Descriptor, Allocator >::dispose(), mark_dies(), and unmark_dies().
|
static |
Referenced by is_declaration_die().
|
static |
Copy the declaration context to the new type unit DIE. This includes any surrounding namespace or type declarations. If the DIE has an AT_specification attribute, it also includes attributes and children attached to the specification, and returns a pointer to the original parent of the declaration DIE. Returns NULL otherwise.
The original DIE will be changed to a declaration, and must be moved to be a child of the original declaration DIE.
Copy the type node pointer from the new DIE to the original declaration DIE so we can forward references later.
|
static |
|
static |
Copy declarations for "unworthy" types into the new comdat section. Incomplete types, modified types, and certain other types aren't broken out into comdat sections of their own, so they don't have a signature, and we need to copy the declaration into the same section so that we don't have an external reference.
References calc_die_sizes(), die_struct::die_child, die_struct::die_offset, next_die_offset, and size_of_die().
|
static |
Walk the DIE and its children, looking for references to incomplete or trivial types that are unmarked (i.e., that are not in the current type_unit).
TARG has already been copied, so we just need to modify the reference to point to the copy.
Record in DECL_TABLE that TARG has been copied. Need to do this now, before the recursive call, because DECL_TABLE may be expanded and SLOT would no longer be a valid pointer.
Make sure the cloned tree is marked as part of the type unit.
If TARG has surrounding context, copy its ancestor tree into the new type unit.
Make sure the newly-copied DIE is walked. If it was installed in a previously-added context, it won't get visited otherwise.
Find the highest point of the newly-added tree, mark each node along the way, and walk from there.
Referenced by copy_ancestor_tree().
|
static |
LOC is constant expression. Try a luck, look it up in constant pool and return its loc_descr of its address.
Get an RTL for this, if something has been emitted.
TODO: We might get more coverage if we was actually delaying expansion of all expressions till end of compilation when constant pools are fully populated.
|
static |
|
static |
Return the DBX register number described by a given RTL node.
References add_loc_descr(), base_type_for_mode(), dw_val_struct::dw_val_struct_union::dw_val_die_union::die, dw_loc_descr_struct::dw_loc_oprnd1, dw_val_class_die_ref, dw_val_struct::dw_val_struct_union::dw_val_die_union::external, new_loc_descr(), dw_val_struct::v, dw_val_struct::val_class, and dw_val_struct::dw_val_struct_union::val_die_ref.
DEBUG_FUNCTION void debug | ( | ) |
DEBUG_FUNCTION void debug_dwarf | ( | void | ) |
Print all DWARF information collected for the compilation unit. This routine is a debugging aid only.
DEBUG_FUNCTION void debug_dwarf_die | ( | ) |
Print the information collected for a given DIE.
|
static |
Referenced by decl_class_context().
|
static |
Hash and equality functions for debug_str_hash.
|
static |
Referenced by decl_class_context().
|
static |
|
static |
Return true when DECL_BY_REFERENCE is defined and set for DECL.
References get_address_mode().
Referenced by add_abstract_origin_attribute().
Referenced by add_type_attribute().
|
static |
Get the class to which DECL belongs, if any. In g++, the DECL_CONTEXT of a virtual function may refer to a base class, so we check the 'this' parameter.
References debug_str_do_hash(), debug_str_eq(), and find_AT_string_in_table().
|
static |
|
static |
Return nonzero if decl_id of die_struct X is the same as UID of decl *Y.
|
static |
|
static |
Returns a hash value for X (which really is a die_struct).
References adjust_piece_list().
|
static |
|
static |
Return nonzero if decl_id of var_loc_list X is the same as UID of decl *Y.
|
static |
|
static |
Returns a hash value for X (which really is a var_loc_list).
|
static |
Return how many bits covers PIECE EXPR_LIST.
Referenced by lookup_type_die_strip_naming_typedef(), and remove_child_TAG().
|
static |
Create an EXPR_LIST for location note LOC_NOTE covering BITSIZE bits. Next is the chain of following piece nodes.
Referenced by remove_child_TAG().
|
static |
Return pointer to the location of location note in PIECE EXPR_LIST.
References die_struct::die_abbrev, die_struct::die_offset, die_struct::die_tag, dwarf_tag_name(), and print_spaces().
Referenced by remove_child_TAG().
|
static |
|
static |
Get the decl's label, as described by its RTL. This may be different from the DECL_NAME name used in the source file.
|
static |
Referenced by add_abstract_origin_attribute(), dwarf2out_vms_debug_main_pointer(), and gen_array_type_die().
|
static |
Determine the "ultimate origin" of a decl. The decl may be an inlined instance of an inlined instance of a decl which is local to an inline function, so we have to trace all of the way back through the origin chain to find out what sort of node actually served as the original seed for the given block.
output_inline_function sets DECL_ABSTRACT_ORIGIN for all the nodes in the function to point to themselves; ignore that if we're trying to output the abstract instance of this function.
Since the DECL_ABSTRACT_ORIGIN for a DECL is supposed to be the most distant ancestor, this should never happen.
|
static |
|
static |
Emit a declaration DIE for THING (which is either a DECL or a tagged type) within its namespace, if appropriate. For compatibility with older debuggers, namespace DIEs only contain declarations; all definitions are emitted at CU scope.
If this decl is from an inlined function, then don't try to emit it in its namespace, as we will get confused. It would have already been emitted when the abstract instance of the inline function was emitted anyways.
References var_loc_list_def::first, first_loclabel_num_not_at_text_label, have_multiple_function_sections, var_loc_node::label, and var_loc_node::next.
|
static |
|
static |
Generate all of the decls declared within a given scope and (recursively) all of its sub-blocks.
Ignore NULL blocks.
Output the DIEs to represent all of the data objects and typedefs declared directly within this block but not within any nested sub-blocks. Also, nested function and tag DIEs have been generated with a parent of NULL; fix that up now.
If we're at -g1, we're not interested in subblocks.
Output the DIEs to represent all sub-blocks (and the items declared therein) of this block.
References asm_noperands(), get_attr_min_length(), have_multiple_function_sections, and previous_insn().
|
static |
Add VARIABLE and DIE into deferred locations list.
|
static |
|
static |
|
static |
Calculate the checksum of a DIE.
To avoid infinite recursion.
|
static |
|
static |
Calculate the checksum of a DIE, using an ordered subset of attributes.
Checksum the child DIEs.
Ignore instantiations of member type and function templates.
Use a shallow checksum for named nested types and member functions.
Use a deep checksum for other children.
Mark this DIE so it gets processed when unmarking.
|
static |
Add a type name and tag to a hash.
References die_struct::die_tag.
|
inlinestatic |
Similarly, but return a double_int instead of UHWI.
|
static |
Find the type name.
References DINFO_STRUCT_FILE_ANY, DINFO_STRUCT_FILE_NONE, DINFO_STRUCT_FILE_SYS, lang_hooks_for_types::generic_p, matches_main_base(), lang_hooks::types, and usage().
|
inlinestatic |
Return the operator to use for an address of a variable. For dtprel_true, we use DW_OP_const*. For regular variables, which need both link-time relocation and consumer-level relocation (e.g., to account for shared objects loaded at a random address), we use DW_OP_addr*.
References gen_compile_unit_die(), and single_comp_unit_die.
enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc | ( | ) |
Describe for the GTY machinery what parts of dw_cfi_oprnd1 are used.
enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc | ( | ) |
Describe for the GTY machinery what parts of dw_cfi_oprnd2 are used.
References targetm.
|
static |
Return the dwarf representation of the location list LOC_LIST of DECL. WANT_ADDRESS has the same meaning as in loc_list_from_tree function.
Now that we know what section we are using for a base, actually construct the list of locations. The first location information is what is passed to the function that creates the location list, and the remaining locations just get added on to that list. Note that we only know the start address for a location (IE location changes), so to build the range, we use the range [current location start, next location start]. This means we have to special case the last node, and generate a range of [last location start, end of function label].
This requires DW_OP_{,bit_}piece, which is not usable inside DWARF expressions.
If section switch happens in between node->label and node->next->label (or end of function) and we can't emit it as a single entry list, emit two ranges, first one ending at the end of first partition and second one starting at the beginning of second partition.
The variable has a location between NODE->LABEL and NODE->NEXT->LABEL.
If the variable has a location at the last label it keeps its location until the end of function.
The variable has a location between NODE->LABEL and NODE->NEXT->LABEL.
Try to avoid the overhead of a location list emitting a location expression instead, but only if we didn't have more than one location entry in the first place. If some entries were not representable, we don't want to pretend a single entry that was applies to the entire scope in which the variable is available.
|
static |
Helper function for dw_loc_list. Compute proper Dwarf location descriptor for VARLOC.
Single part.
Show if we can't fill the request for an address.
If we've got an address and don't want one, dereference.
Referenced by concat_loc_descriptor().
|
static |
Helper function for dw_loc_list. Compute proper Dwarf location descriptor for VAR_LOC_NOTE for variable DECL that has been optimized by SRA.
Check that cur_descr either doesn't use DW_OP_*piece operations, or their sum is equal to bitsize. Otherwise we can't embed it.
Discard the current piece of the descriptor and release any addr_table entries it uses.
If there is a hole, add DW_OP_*piece after empty DWARF expression, which means that those bits are optimized out.
DW_OP_bit_size offset should be zero for register or implicit location descriptions and empty location descriptions, but for memory addresses needs big endian adjustment.
If there were any non-empty expressions, add padding till the end of the decl.
Discard the descriptor and release any addr_table entries it uses.
References do_binop().
|
static |
Compare two location operands for exact equality.
These are all HOST_WIDE_INT, signed or unsigned.
int dwarf2_build_local_stub | ( | ) |
htab_traverse callback function for optimize_external_refs, below. SLOT points to an external_ref, DATA is the CU we're processing. If we don't already have a local stub, and we have multiple refs, build a stub.
We have multiple references to this type, so build a small stub. Both of these forms are a bit dodgy from the perspective of the DWARF standard, since technically they should have names.
If we refer to this type via sig8, use AT_signature.
Otherwise, use a typedef with no name.
Referenced by generate_skeleton().
|
static |
|
static |
Return the DWARF2/3 pubname associated with a decl.
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Generate the DWARF2 info for the "abstract" instance of a function which we may later generate inlined and/or out-of-line instances of.
Make sure we have the actual abstract inline, not a clone.
We've already generated the abstract instance.
We can be called while recursively when seeing block defining inlined subroutine DIE. Be sure to not clobber the outer location table nor use it or we would get locations in abstract instantces.
Be sure we've emitted the in-class declaration DIE (if any) first, so we don't get confused by DECL_ABSTRACT.
Pretend we've just finished compiling this function.
dw_fde_ref dwarf2out_alloc_current_fde | ( | void | ) |
Allocate CURRENT_FDE. Immediately initialize all we can, noting that this allocation may be done before pass_final.
Record the FDE associated with this function.
|
static |
Called before compile () starts outputtting functions, variables and toplevel asms into assembly.
References dw_vec_struct::array, dw_vec_struct::elt_size, dw_vec_struct::length, dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_vec.
Referenced by output_loc_sequence_raw().
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Output a marker (i.e. a label) for the beginning of the generated code for a lexical block.
|
static |
Referenced by output_loc_sequence_raw().
|
static |
We need to reset the locations at the beginning of each function. We can't do this in the end_function hook, because the declarations that use the locations won't have been output when that hook is called. Also compute have_multiple_function_sections here.
References die_struct::die_child, die_struct::die_mark, die_struct::die_sib, prune_unused_types_prune(), and prune_unused_types_update_strings().
void dwarf2out_begin_prologue | ( | unsigned int | line, |
const char * | file | ||
) |
Output a marker (i.e. a label) for the beginning of a function, before the prologue.
??? current_function_func_begin_label is also used by except.c for call-site information. We must emit this label if it might be used.
We can elide the fde allocation if we're not emitting debug info.
Cater to the various TARGET_ASM_OUTPUT_MI_THUNK implementations that emit insns as rtx but bypass the bulk of rest_of_compilation, which would include pass_dwarf2_frame. If we've not created the FDE yet, do so now.
Initialize the bits of CURRENT_FDE that were not available earlier.
We only want to output line number information for the genuine dwarf2 prologue case, not the eh frame case.
We cannot keep a current personality per function as without CFI asm, at the point where we emit the CFI data, there is no current function anymore.
Referenced by output_loc_sequence_raw().
void dwarf2out_decl | ( | ) |
Write the debugging output for DECL.
What we would really like to do here is to filter out all mere file-scope declarations of file-scope functions which are never referenced later within this translation unit (and keep all of ones that *are* referenced later on) but we aren't clairvoyant, so we have no idea which functions will be referenced in the future (i.e. later on within the current translation unit). So here we just ignore all file-scope function declarations which are not also definitions. If and when the debugger needs to know something about these functions, it will have to hunt around and find the DWARF information associated with the definition of the function. We can't just check DECL_EXTERNAL to find out which FUNCTION_DECL nodes represent definitions and which ones represent mere declarations. We have to check DECL_INITIAL instead. That's because the C front-end supports some weird semantics for "extern inline" function definitions. These can get inlined within the current translation unit (and thus, we need to generate Dwarf info for their abstract instances so that the Dwarf info for the concrete inlined instances can have something to refer to) but the compiler never generates any out-of-lines instances of such things (despite the fact that they *are* definitions). The important point is that the C front-end marks these "extern inline" functions as DECL_EXTERNAL, but we need to generate DWARF for them anyway. Note that the C++ front-end also plays some similar games for inline function definitions appearing within include files which also contain `#pragma interface' pragmas. If we are called from dwarf2out_abstract_function output a DIE anyway. We can end up here this way with early inlining and LTO where the inlined function is output in a different LTRANS unit or not at all.
If we're a nested function, initially use a parent of NULL; if we're a plain function, this will be fixed up in decls_for_scope. If we're a method, it will be ignored, since we already have a DIE.
But if we're in terse mode, we don't care about scope.
Ignore this VAR_DECL if it refers to a file-scope extern data object declaration and if the declaration was never even referenced from within this entire compilation unit. We suppress these DIEs in order to save space in the .debug section (by eliminating entries which are probably useless). Note that we must not suppress block-local extern declarations (whether used or not) because that would screw-up the debugger's name lookup mechanism and cause it to miss things which really ought to be in scope at a given point.
For local statics lookup proper context die.
If we are in terse mode, don't generate any DIEs to represent any variable declarations or definitions.
Don't emit stubs for types unless they are needed by other DIEs.
Don't bother trying to generate any DIEs to represent any of the normal built-in types for the language we are compiling.
If we are in terse mode, don't generate any DIEs for types.
If we're a function-scope tag, initially use a parent of NULL; this will be fixed up in decls_for_scope.
References macinfo_struct::code, find_AT_string(), macinfo_struct::info, set_indirect_string(), and strlen().
|
static |
Called from debug_define in toplev.c. The `buffer' parameter contains the tail part of the directive line, i.e. the part which is past the initial whitespace, #, whitespace, directive-name, whitespace part.
Insert a dummy first entry to be able to optimize the whole predefined macro block using DW_MACRO_GNU_transparent_include.
Referenced by output_loc_sequence_raw().
|
static |
Emit .cfi_startproc and .cfi_personality/.cfi_lsda if needed.
??? The GAS support isn't entirely consistent. We have to handle indirect support ourselves, but PC-relative is done in the assembler. Further, the assembler can't handle any of the weirder relocation types.
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Output a marker (i.e. a label) for the end of the generated code for a lexical block.
void dwarf2out_end_epilogue | ( | unsigned int | line, |
const char * | file | ||
) |
Output a marker (i.e. a label) for the absolute end of the generated code for a function definition. This gets called *after* the epilogue code has been generated.
Output a label to mark the endpoint of the code generated for this function.
Referenced by output_loc_sequence_raw().
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Hook called after emitting a function into assembly. This does something only for the very first function emitted.
References prune_unused_types_mark(), prune_unused_types_walk(), comdat_type_struct::root_die, and comdat_type_struct::type_die.
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Record the end of a source file.
Record the end of the file for break_out_includes.
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Output stuff that dwarf requires at the end of every file, and generate the DWARF-2 debugging info.
PCH might result in DW_AT_producer string being restored from the header compilation, so always fill it with empty string initially and overwrite only here.
Add the name for the main input file now. We delayed this from dwarf2out_init to avoid complications with PCH.
Traverse the limbo die list, and add parent/child links. The only dies without parents that should be here are concrete instances of inline functions, and the comp_unit_die. We can ignore the comp_unit_die. For concrete instances, we can get the parent die from the abstract instance.
It's OK to be confused by errors in the input.
In certain situations, the lexical block containing a nested function can be optimized away, which results in the nested function die being orphaned. Likewise with the return type of that nested function. Force this to be a child of the containing function. It may happen that even the containing function got fully inlined and optimized out. In that case we are lost and assign the empty child. This should not be big issue as the function is likely unreachable too.
When generating LTO bytecode we can not generate new assembler names at this point and all important decls got theirs via free-lang-data.
Walk through the list of incomplete types again, trying once more to emit full debugging info for them.
Generate separate COMDAT sections for type DIEs.
Each new type_unit DIE was added to the limbo die list when created. Since these have all been added to comdat_type_list, clear the limbo die list.
For each new comdat type unit, copy declarations for incomplete types to make the new unit self-contained (i.e., no direct references to the main compile unit).
In the process of copying declarations from one unit to another, we may have left some declarations behind that are no longer referenced. Prune them.
Generate separate CUs for each of the include files we've seen. They will go into limbo_die_list.
Traverse the DIE's and add add sibling attributes to those DIE's that have children.
When splitting DWARF info, we put some attributes in the skeleton compile_unit DIE that remains in the .o, while most attributes go in the DWO compile_unit_die.
Output a terminator label for the .text section.
We can only use the low/high_pc attributes if all of the code was in .text.
Don't add if the CU has no associated code.
We need to give .debug_loc and .debug_ranges an appropriate "base address". Use zero so that these addresses become absolute. Historically, we've emitted the unexpected DW_AT_entry_pc instead of DW_AT_low_pc for this purpose. Emit both to give time for other tools to adapt.
optimize_location_lists calculates the size of the lists, so index them first, and assign indices to the entries. Although optimize_location_lists will remove entries from the table, it only does so for duplicates, and therefore only reduces ref_counts to 1.
Add attributes common to skeleton compile_units and type_units. Because these attributes include strings, it must be done before freezing the string table. Top-level skeleton die attrs are added when the skeleton type unit is created, so ensure it is created by this point.
Output all of the compilation units. We put the main one last so that the offsets are available to output_pubnames.
Don't output duplicate types.
Add a pointer to the line table for the main compilation unit so that the debugger can make sense of DW_AT_decl_file attributes.
The AT_pubnames attribute needs to go in all skeleton dies, including both the main_cu and all skeleton TUs. Making this call unconditional would end up either adding a second copy of the AT_pubnames attribute, or requiring a special case in add_top_level_skeleton_die_attrs.
Compute a checksum of the comp_unit to use as the dwo_id.
Use the first 8 bytes of the checksum as the dwo_id, and add it to both comp-unit DIEs.
Add the base offset of the ranges table to the skeleton comp-unit DIE.
Output the main compilation unit if non-empty or if .debug_macinfo or .debug_macro will be emitted.
Output the abbreviation table.
Output location list section if necessary.
Output the location lists info.
Output the address range information if a CU (.debug_info section) was emitted. We output an empty table even if we had no functions to put in it. This because the consumer has no way to tell the difference between an empty table that we omitted and failure to generate a table that would have contained data.
Output ranges section if necessary.
Have to end the macro section.
Output the source line correspondence table. We must do this even if there is no line information. Otherwise, on an empty translation unit, we will generate a present, but empty, .debug_info section. IRIX 6.5 `nm' will then complain when examining the file. This is done late so that any filenames used by the debug_info section are marked as 'used'.
If we emitted any indirect strings, output the string table too.
void dwarf2out_frame_finish | ( | void | ) |
Output call frame information.
Output another copy for the unwinder.
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Write the debugging output for DECL.
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Output debug information for global decl DECL. Called from toplev.c after compilation proper has finished.
Output DWARF2 information for file-scope tentative data object declarations, file-scope (extern) function declarations (which had no corresponding body) and file-scope tagged type declarations and definitions which have not yet been forced out.
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Returns nonzero if it is appropriate not to emit any debugging information for BLOCK, because it doesn't contain any instructions. Don't allow this for blocks with nested functions or local classes as we would end up with orphans, and in the presence of scheduling we may end up calling them anyway.
|
static |
Output debug information for imported module or decl DECL. NAME is non-NULL name in context if the decl has been renamed. CHILD is true if decl is one of the renamed decls as part of importing whole module.
dw_die_ref at_import_die;
To emit DW_TAG_imported_module or DW_TAG_imported_decl, we need two DIEs. We need decl DIE for reference and scope die. First, get DIE for the decl itself.
Get the scope die for decl context. Use comp_unit_die for global module or decl. If die is not found for non globals, force new die.
OK, now we have DIEs for decl as well as scope. Emit imported die.
Referenced by output_loc_sequence_raw().
|
static |
Output debug information for imported module or decl DECL. NAME is non-NULL name in the lexical block if the decl has been renamed. LEXICAL_BLOCK is the lexical block (which TREE_CODE is a BLOCK) that DECL belongs to. LEXICAL_BLOCK_DIE is the DIE of LEXICAL_BLOCK.
For namespace N { typedef void T; } using N::T; base_type_die returns NULL, but DW_TAG_imported_declaration requires the DW_AT_import tag. Force creation of DW_TAG_typedef.
If we're trying to avoid duplicate debug info, we may not have emitted the member decl for this field. Emit it now.
References checksum_uleb128(), macinfo_struct::code, count, first, HOST_WIDE_INT, HOST_WIDE_INT_PRINT_UNSIGNED, macinfo_struct::info, macinfo_struct::lineno, memcpy(), strlen(), and vec_safe_is_empty().
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Set up for Dwarf output at the start of compilation.
Allocate the file_table.
Allocate the decl_die_table.
Allocate the decl_loc_table.
Allocate the cached_dw_loc_list_table.
Allocate the initial hunk of the decl_scope_table.
Allocate the initial hunk of the abbrev_die_table.
Zero-th entry is allocated, but unused.
Allocate the pubtypes and pubnames vectors.
Somewhat confusing detail: The skeleton_[abbrev|info] sections stay in the main .o, but the skeleton_line goes into the split off dwo.
Make sure the line number table for .text always exists.
References dw_loc_descr_struct::dw_loc_oprnd1, optimize_location_into_implicit_ptr(), remove_AT(), dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_addr.
|
static |
Note that the current function section is being used for code.
References ate_kind_label, ate_kind_rtx, and ate_kind_rtx_dtprel.
void dwarf2out_set_demangle_name_func | ( | const char *(*)(const char *) | func | ) |
|
static |
Replace DW_AT_name for the decl with name.
replace the string.
|
static |
@verbatim
Output Dwarf2 format symbol table information from GCC. Copyright (C) 1992-2013 Free Software Foundation, Inc. Contributed by Gary Funck (gary@). Derived from DWARF 1 implementation of Ron Guilmette ( intr epid. comrfg@m). Extensively modified by Jason Merrill ( onke ys.co mjason). @cyg nus.c om
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
TODO: Emit .debug_line header even when there are no functions, since the file numbers are used by .debug_info. Alternately, leave out locations for types and decls. Avoid talking about ctors and op= for PODs. Factor out common prologue sequences into multiple CIEs.
The first part of this file deals with the DWARF 2 frame unwind information, which is also used by the GCC efficient exception handling mechanism. The second part, controlled only by an #ifdef DWARF2_DEBUGGING_INFO, deals with the other DWARF 2 debugging information.
DWARF2 Abbreviation Glossary: CFA = Canonical Frame Address a fixed address on the stack which identifies a call frame. We define it to be the value of SP just before the call insn. The CFA register and offset, which may change during the course of the function, are used to calculate its value at runtime. CFI = Call Frame Instruction an instruction for the DWARF2 abstract machine CIE = Common Information Entry information describing information common to one or more FDEs DIE = Debugging Information Entry FDE = Frame Description Entry information describing the stack call frame, in particular, how to restore registers DW_CFA_... = DWARF2 CFA call frame instruction DW_TAG_... = DWARF2 DIE tag
Output a label to mark the beginning of a source code line entry and record information relating to this source line, in 'line_info_table' for later output of the .debug_line section.
??? The discriminator parameter ought to be unsigned.
The discriminator column was added in dwarf4. Simplify the below by simply removing it if we're not supposed to output it.
??? TODO: Elide duplicate line number entries. Traditionally, the debugger has used the second (possibly duplicate) line number at the beginning of the function to mark the end of the prologue. We could eliminate any other duplicates within the function. For Dwarf3, we ought to include the DW_LNS_set_prologue_end mark in that second line number entry.
Recall that this end-of-prologue indication is *not* the same thing as the end_prologue debug hook. The NOTE_INSN_PROLOGUE_END note, to which the hook corresponds, follows the last insn that was emitted by gen_prologue. What we need is to precede the first insn that had been emitted after NOTE_INSN_FUNCTION_BEG, i.e. the first insn that corresponds to something the user wrote. These may be very different locations once scheduling is enabled.
If requested, emit something human-readable.
Emit the .loc directive understood by GNU as.
"\t.loc %u %u 0 is_stmt %u discriminator %u", file_num, line, is_stmt, discriminator
References dwarf_file_data::filename.
Referenced by output_loc_sequence_raw().
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Record the beginning of a new source file.
Record the beginning of the file for break_out_includes.
void dwarf2out_switch_text_section | ( | void | ) |
There is no need to mark used sections when not debugging.
Now do the real section switch.
Referenced by output_loc_sequence_raw().
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Output debug information for type decl DECL. Called from toplev.c and from language front ends (to record built-in types).
|
static |
Called from debug_undef in toplev.c. The `buffer' parameter contains the tail part of the directive line, i.e. the part which is past the initial whitespace, #, whitespace, directive-name, whitespace part.
Insert a dummy first entry to be able to optimize the whole predefined macro block using DW_MACRO_GNU_transparent_include.
Referenced by output_loc_sequence_raw().
|
static |
Referenced by output_loc_sequence_raw().
|
static |
Called by the final INSN scan whenever we see a var location. We use it to drop labels in the right places, and throw the location in our lookup table.
Optimize processing a large consecutive sequence of location notes so we don't spend too much time in next_real_insn. If the next insn is another location note, remember the next_real_insn calculation for next time.
If there are no instructions which would be affected by this note, don't do anything.
If there were any real insns between note we processed last time and this note (or if it is the first note), clear last_{,postcall_}label so that they are not reused this time.
If there were no real insns between note we processed last time and this note, use the label we emitted last time. Otherwise create a new label and emit it.
See if loclabel might be equal to .Ltext0. If yes, bump first_loclabel_num_not_at_text_label.
Inline asm could occupy zero bytes.
Assume insn has non-zero length.
References addr_table_entry_struct::addr, ate_kind_label, ate_kind_rtx, ate_kind_rtx_dtprel, dw2_asm_output_addr(), dw2_asm_output_addr_rtx(), addr_table_entry_struct::index, addr_table_entry_struct::addr_table_entry_struct_union::label, addr_table_entry_struct::addr_table_entry_struct_union::rtl, and targetm.
void dwarf2out_vms_begin_epilogue | ( | unsigned int | line, |
const char * | file | ||
) |
Output a marker (i.e. a label) for the beginning of the generated code for a function epilogue. This gets called *before* the prologue code has been generated.
Output a label to mark the endpoint of the code generated for this function.
Referenced by output_loc_sequence_raw().
void dwarf2out_vms_debug_main_pointer | ( | ) |
Output the debug main pointer die for VMS
Allocate the VMS debug main subprogram die.
Make it the first child of comp_unit_die ().
References decl_ultimate_origin(), gen_field_die(), gen_subprogram_die(), gen_type_die(), lookup_decl_die(), lookup_type_die_strip_naming_typedef(), member_declared_type(), and push_decl_scope().
void dwarf2out_vms_end_prologue | ( | unsigned int | line, |
const char * | file | ||
) |
Output a marker (i.e. a label) for the end of the generated code for a function prologue. This gets called *after* the prologue code has been generated.
Output a label to mark the endpoint of the code generated for this function.
References targetm.
Referenced by output_loc_sequence_raw().
|
static |
Referenced by size_of_pubnames(), and unmark_all_dies().
|
static |
Convert a DWARF attribute code into its string name.
|
static |
|
static |
Convert a DWARF value form code into its string name.
|
static |
Convert a DWARF stack opcode into its string name.
|
static |
Referenced by decl_piece_varloc_ptr(), and size_of_pubnames().
|
static |
Convert a DIE tag into its string name.
References add_dwarf_attr(), dw_attr_struct::dw_attr, dw_attr_struct::dw_attr_val, dw_val_class_data8, memcpy(), dw_val_struct::v, dw_val_struct::val_class, dw_val_struct::dw_val_struct_union::val_data8, and dw_val_struct::val_entry.
|
static |
Referenced by add_abstract_origin_attribute().
|
static |
Equate a DIE to a particular declaration.
|
static |
|
inlinestatic |
Equate a DIE to a given type specifier.
|
static |
Output debug info about reason why we failed to expand expression as dwarf expression.
References mem_loc_descriptor(), and VAR_INIT_STATUS_INITIALIZED.
|
static |
|
static |
Reads integers from dw_vec_const array. Inverse of insert_int.
|
static |
Return true if frame description entry FDE is needed for EH.
If exceptions are enabled, we have collected nothrow info.
References fde_vec, and dw_fde_struct::uses_eh_lsda.
|
static |
Referenced by fortran_common().
|
static |
Given a pointer to a FIELD_DECL, compute and return the byte offset of the lowest addressed byte of the "containing object" for the given FIELD_DECL, or return 0 if we are unable to determine what that offset is, either because the argument turns out to be a pointer to an ERROR_MARK node, or because the offset is actually variable. (We can't handle the latter case just yet).
We cannot yet cope with fields whose positions are variable, so for now, when we see such things, we simply return 0. Someday, we may be able to handle such cases, but it will be damn difficult.
The size could be unspecified if there was an error, or for a flexible array member.
If the size of the field is not constant, use the type size.
The GCC front-end doesn't make any attempt to keep track of the starting bit offset (relative to the start of the containing structure type) of the hypothetical "containing object" for a bit-field. Thus, when computing the byte offset value for the start of the "containing object" of a bit-field, we must deduce this information on our own. This can be rather tricky to do in some cases. For example, handling the following structure type definition when compiling for an i386/i486 target (which only aligns long long's to 32-bit boundaries) can be very tricky: struct S { int field1; long long field2:31; }; Fortunately, there is a simple rule-of-thumb which can be used in such cases. When compiling for an i386/i486, GCC will allocate 8 bytes for the structure shown above. It decides to do this based upon one simple rule for bit-field allocation. GCC allocates each "containing object" for each bit-field at the first (i.e. lowest addressed) legitimate alignment boundary (based upon the required minimum alignment for the declared type of the field) which it can possibly use, subject to the condition that there is still enough available space remaining in the containing object (when allocated at the selected point) to fully accommodate all of the bits of the bit-field itself. This simple rule makes it obvious why GCC allocates 8 bytes for each object of the structure type shown above. When looking for a place to allocate the "containing object" for `field2', the compiler simply tries to allocate a 64-bit "containing object" at each successive 32-bit boundary (starting at zero) until it finds a place to allocate that 64- bit field such that at least 31 contiguous (and previously unallocated) bits remain within that selected 64 bit field. (As it turns out, for the example above, the compiler finds it is OK to allocate the "containing object" 64-bit field at bit-offset zero within the structure type.) Here we attempt to work backwards from the limited set of facts we're given, and we try to deduce from those facts, where GCC must have believed that the containing object started (within the structure type). The value we deduce is then used (by the callers of this routine) to generate DW_AT_location and DW_AT_bit_offset attributes for fields (both bit-fields and, in the case of DW_AT_location, regular fields as well).
Figure out the bit-distance from the start of the structure to the "deepest" bit of the bit-field.
This is the tricky part. Use some fancy footwork to deduce where the lowest addressed bit of the containing object must be.
Round up to type_align by default. This works best for bitfields.
Round up to decl_align instead.
|
static |
Referenced by asan_decl_phase_3().
|
inlinestatic |
Given a pointer to what is assumed to be a FIELD_DECL node, return a pointer to the declared type for the relevant field variable, or return `integer_type_node' if the given node turns out to be an ERROR_MARK node.
|
static |
Referenced by add_pubtype().
|
static |
Callback function for file_info comparison. We sort by looking at the directories in the path.
Take care of file names without directories. We need to make sure that we return consistent values to qsort since some will get confused if we return the same value when identical operands are passed in opposite orders. So if neither has a directory, return 0 and otherwise return 1 or -1 depending on which one has the directory.
Reached the end of the first path? If so, handle like above.
Character of current path component the same?
|
static |
Traversal function for the hash table.
Skip all leading "./".
Create a new array entry.
Search for the file name part.
Referenced by add_pubtype().
|
static |
Hash table routines for file_hash.
|
static |
|
static |
Set the parameter to true if there are any relative pathnames in the file table.
Referenced by prune_unused_types_prune().
|
staticread |
Add STR to the indirect string hash table.
Referenced by dwarf2out_decl().
|
staticread |
Add STR to the given string hash table.
References AT_class(), dw_attr_struct::dw_attr_val, dw_val_class_loc_list, dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_loc_list.
Referenced by decl_class_context().
|
static |
Helper function of dwarf2out_end_function, called only after emitting the very first function into assembly. Check if some .debug_loc range might end with a .LVL* label that could be equal to .Ltext0. In that case we must force using absolute addresses in .debug_loc ranges, because this range could be .LVLN-.Ltext0 .. .LVLM-.Ltext0 for .LVLN == .LVLM == .Ltext0, thus 0 .. 0, which is a .debug_loc list terminator. Set have_multiple_function_sections to true in that case and terminate htab traversal.
Referenced by gen_namespace_die().
|
static |
Find out whether a string should be output inline in DIE or out-of-line in .debug_str section.
If the string is shorter or equal to the size of the reference, it is always better to put it inline.
If we cannot expect the linker to merge strings in .debug_str section, only put it into .debug_str if it is worth even in this single module.
Referenced by add_AT_unsigned().
|
static |
Referenced by gen_array_type_die(), gen_inlined_subroutine_die(), and gen_reference_type_die().
|
static |
Returns the DIE for decl. A DIE will always be returned.
Clear current_function_decl, so that gen_subprogram_die thinks that this is a declaration. At this point, we just want to force declaration die.
Set external flag to force declaration die. Restore it after gen_decl_die() call.
DWARF2 has neither DW_TAG_module, nor DW_TAG_namespace.
We should be able to find the DIE now.
|
static |
Referenced by gen_inlined_subroutine_die().
|
static |
Returns the DIE for TYPE, that must not be a base type. A DIE is always returned.
|
static |
Check whether decl is a Fortran COMMON symbol. If not, NULL_TREE is returned. If so, the decl for the COMMON block is returned, and the value is the offset into the common block for the symbol.
If the decl isn't a VAR_DECL, or if it isn't static, or if it does not have a value (the offset into the common area), or if it is thread local (as opposed to global) then it isn't common, and shouldn't be handled as such.
References add_AT_int(), add_AT_unsigned(), bit_position(), field_byte_offset(), host_integerp(), int_bit_position(), simple_type_size_in_bits(), and tree_low_cst().
|
static |
|
static |
These routines generate the internal representation of the DIE's for the compilation unit. Debugging information is collected by walking the declaration trees passed in from dwarf2out_decl().
GNU compilers represent multidimensional array types as sequences of one dimensional array types whose element types are themselves array types. We sometimes squish that down to a single array_type DIE with multiple subscripts in the Dwarf debugging info. The draft Dwarf specification say that we are allowed to do this kind of compression in C, because there is no difference between an array of arrays and a multidimensional array. We don't do this for Ada to remain as close as possible to the actual representation, which is especially important against the language flexibilty wrt arrays of variable size.
Emit DW_TAG_string_type for Fortran character types (with kind 1 only, as DW_TAG_string_type doesn't have DW_AT_type attribute).
For Fortran multidimensional arrays use DW_ORD_col_major ordering.
We default the array ordering. SDB will probably do the right things even if DW_AT_ordering is not present. It's not even an issue until we start to get into multidimensional arrays anyway. If SDB is ever caught doing the Wrong Thing for multi-dimensional arrays, then we'll have to put the DW_AT_ordering attribute back in. (But if and when we find out that we need to put these in, we will only do so for multidimensional arrays.
For VECTOR_TYPEs we use an array die with appropriate bounds.
Add representation of the type of the elements of this array type and emit the corresponding DIE if we haven't done it already.
References add_abstract_origin_attribute(), add_AT_file(), add_AT_flag(), add_AT_specification(), add_AT_unsigned(), add_child_die(), add_linkage_name(), add_name_and_src_coords_attributes(), add_pubname(), class_or_namespace_scope_p(), current_function_decl, decl_ultimate_origin(), die_struct::die_parent, DINFO_LEVEL_TERSE, expand_location(), force_decl_die(), get_AT(), get_AT_file(), get_AT_flag(), get_AT_unsigned(), is_cu_die(), local_scope_p(), lookup_decl_die(), lookup_filename(), new_die(), premark_used_types(), remove_AT(), and remove_child_TAG().
|
static |
|
static |
Generate a DW_TAG_lexical_block DIE followed by DIEs to represent all of the things which are local to the given block.
Ignore blocks that are NULL.
If the block is one fragment of a non-contiguous block, do not process the variables, since they will have been done by the origin block. Do process subblocks.
Determine if we need to output any Dwarf DIEs at all to represent this block.
The outer scopes for inlinings *must* always be represented. We generate DW_TAG_inlined_subroutine DIEs for them. (See below.)
Determine if this block directly contains any "significant" local declarations which we will need to output DIEs for.
We are not in terse mode so *any* local declaration counts as being a "significant" one.
It would be a waste of space to generate a Dwarf DW_TAG_lexical_block DIE for any block which contains no significant local declarations at all. Rather, in such cases we just call `decls_for_scope' so that any needed Dwarf info for any sub-blocks will get properly generated. Note that in terse mode, our definition of what constitutes a "significant" local declaration gets restricted to include only inlined function instances and local (nested) function definitions.
If STMT block is abstract, that means we have been called indirectly from dwarf2out_abstract_function. That function rightfully marks the descendent blocks (of the abstract function it is dealing with) as being abstract, precisely to prevent us from emitting any DW_TAG_inlined_subroutine DIE as a descendent of an abstract function instance. So in that case, we should not call gen_inlined_subroutine_die. Later though, when cgraph asks dwarf2out to emit info for the concrete instance of the function decl into which the concrete instance of STMT got inlined, the later will lead to the generation of a DW_TAG_inlined_subroutine DIE.
|
static |
Generate a DW_TAG_GNU_call_site DIE in function DECL under SUBR_DIE for CA_LOC call arg loc node.
References add_AT_lbl_id().
|
static |
Referenced by dw_addr_op().
|
static |
Generate the DIE for the compilation unit.
Don't add cwd for <built-in>.
If our producer is LTO try to figure out a common language to use from the global list of translation units.
Mixing C and C++ is ok, use C++ in that case.
Fall back to C.
Use a degraded Fortran setting in strict DWARF2 so is_fortran works.
Fortran has case insensitive identifiers and the front-end lowercases everything.
The default DW_ID_case_sensitive doesn't need to be specified.
|
static |
|
static |
Generate a DIE to represent a named constant.
References DINFO_USAGE_DIR_USE, and gen_type_die_with_usage().
|
static |
|
static |
Generate Dwarf debug information for a decl described by DECL. The return value is currently only meaningful for PARM_DECLs, for all other decls it returns NULL.
The individual enumerators of an enum type get output when we output the Dwarf representation of the relevant enum type itself.
Emit its type.
And its containing namespace.
Don't output any DIEs to represent mere function declarations, unless they are class members or explicit block externs.
FIXME
This doesn't work because the C frontend sets DECL_ABSTRACT_ORIGIN on local redeclarations of global functions. That seems broken.
This is only a declaration.
If we're emitting a clone, emit info for the abstract instance.
If we're emitting an out-of-line copy of an inline function, emit info for the abstract instance and set up to refer to it.
dwarf2out_abstract_function won't emit a die if this is just a declaration. We must avoid setting DECL_ABSTRACT_ORIGIN in that case, because that works only if we have a die.
Otherwise we're emitting the primary DIE for this decl.
Before we describe the FUNCTION_DECL itself, make sure that we have its containing type.
And its return type.
And its virtual context.
Make sure we have a member DIE for decl.
And its containing namespace.
Now output a DIE to represent the function itself.
If we are in terse mode, don't generate any DIEs to represent any actual typedefs.
In the special case of a TYPE_DECL node representing the declaration of some type tag, if the given TYPE_DECL is marked as having been instantiated from some other (original) TYPE_DECL node (e.g. one which was generated within the original definition of an inline function) we used to generate a special (abbreviated) DW_TAG_structure_type, DW_TAG_union_type, or DW_TAG_enumeration_type DIE here. But nothing should be actually referencing those DIEs, as variable DIEs with that type would be emitted already in the abstract origin, so it was always removed during unused type prunning. Don't add anything in this case.
Output a DIE to represent the typedef itself.
If we are in terse mode, don't generate any DIEs to represent any variable declarations or definitions.
Output any DIEs that are needed to specify the type of this data object.
And its containing type.
And its containing namespace.
Now output the DIE to represent the data object itself. This gets complicated because of the possibility that the VAR_DECL really represents an inlined instance of a formal parameter for an inline function.
Ignore the nameless fields that are used to skip bits but handle C++ anonymous unions and structs.
Probably some frontend-internal decl. Assume we don't care.
|
static |
This routine generates DIE for array with hidden descriptor, details are filled into *info by a langhook.
For Fortran multidimensional arrays use DW_ORD_col_major ordering.
If it is the default value, omit it.
References add_AT_vms_delta(), dw_fde_struct::dw_fde_begin, dw_fde_struct::dw_fde_vms_begin_epilogue, and dw_fde_struct::dw_fde_vms_end_prologue.
|
static |
|
static |
|
static |
|
static |
Generate a DIE to represent an enumeration type. Note that these DIEs include all of the information about the enumeration values also. Each enumerated type name/value is listed as a child of the enumerated type DIE.
Handle a GNU C/C++ extension, i.e. incomplete enum types. If the given enum type is incomplete, do not generate the DW_AT_byte_size attribute or the DW_AT_element_list attribute.
If the first reference to this type was as the return type of an inline function, then it may not have a parent. Fix this now.
DWARF2 does not provide a way of indicating whether or not enumeration constants are signed or unsigned. GDB always assumes the values are signed, so we output all values as if they were signed. That means that enumeration constants with very large unsigned values will appear to have negative values in the debugger. TODO: the above comment is wrong, DWARF2 does provide DW_FORM_sdata/DW_FORM_udata to represent signed/unsigned data. This should be re-worked to use correct signed/unsigned int/double tags for all cases, instead of always treating as signed.
Enumeration constants may be wider than HOST_WIDE_INT. Handle that here.
|
static |
Referenced by dwarf2out_vms_debug_main_pointer(), and gen_member_die().
|
static |
Generate a DIE for a field in a record, or structure.
Equate decl number to die, so that we can look up this decl later on.
|
static |
Generate a DIE to represent either a real live formal parameter decl or to represent just the type of some formal parameter position in some function type. Note that this routine is a bit unusual because its argument may be a ..._DECL node (i.e. either a PARM_DECL or perhaps a VAR_DECL which represents an inlining of some PARM_DECL) or else some sort of a ..._TYPE node. If it's the former then this function is being called to output a DIE to represent a formal parameter object (or some inlining thereof). If it's the latter, then this function is only being called to output a DW_TAG_formal_parameter DIE to stand as a placeholder for some formal argument type of some subprogram type. If EMIT_NAME_P is true, name and source coordinate attributes are emitted.
We were called with some kind of a ..._TYPE node.
References call_arg_loc_node::call_arg_loc_note, get_address_mode(), lookup_decl_die(), mem_loc_descriptor(), pc_rtx, reg_loc_descriptor(), call_arg_loc_node::symbol_ref, and VAR_INIT_STATUS_INITIALIZED.
|
static |
Generate and return a DW_TAG_GNU_formal_parameter_pack. Also generate children DW_TAG_formal_parameter DIEs representing the arguments of the parameter pack. PARM_PACK must be a function parameter pack. PACK_ARG is the first argument of the parameter pack. Its TREE_CHAIN must point to the subsequent arguments of the function PACK_ARG belongs to. SUBR_DIE is the DIE of the function PACK_ARG belongs to. If NEXT_ARG is non NULL, *NEXT_ARG is set to the function argument following the last one for which a DIE was generated.
|
static |
|
static |
Generate a list of nameless DW_TAG_formal_parameter DIEs (and perhaps a DW_TAG_unspecified_parameters DIE) to represent the types of the formal parameters as specified in some function type specification (except for those which appear as part of a function *definition*).
Make our first pass over the list of formal parameter types and output a DW_TAG_formal_parameter DIE for each one.
Output a (nameless) DIE to represent the formal parameter itself.
If this function type has an ellipsis, add a DW_TAG_unspecified_parameters DIE to the end of the parameter list.
Make our second (and final) pass over the list of formal parameter types and output DIEs to represent those types (as necessary).
|
static |
|
static |
Generate DIEs for the generic parameters of T. T must be either a generic type or a generic function. See http://gcc.gnu.org/wiki/TemplateParmsDwarf for more.
T has no generic parameter. It means T is neither a generic type or function. End of story.
If PARM represents a template parameter pack, emit a DW_TAG_GNU_template_parameter_pack DIE, followed by DW_TAG_template_*_parameter DIEs for the argument pack elements of ARG. Note that ARG would then be an argument pack.
References new_loc_descr().
|
static |
|
static |
Generate the DIE for a base class.
In DWARF3+ the default is DW_ACCESS_private only in DW_TAG_class_type children, otherwise the default is DW_ACCESS_public. In DWARF2 the default has always been DW_ACCESS_private.
|
static |
|
static |
Generate a DIE for an inlined subprogram.
The instance of function that is effectively being inlined shall not be abstract.
Emit info for the abstract instance first, if we haven't yet. We must emit this even if the block is abstract, otherwise when we emit the block below (or elsewhere), we may end up trying to emit a die whose origin die hasn't been emitted, and crashing.
References comp_unit_die(), force_decl_die(), force_type_die(), and strip_naming_typedef().
|
static |
|
static |
References copy(), die_struct::die_parent, and hash_table< Descriptor, Allocator >::is_created().
|
static |
|
static |
Generate a DIE to represent a label identifier.
Deleted labels are programmer specified labels which have been eliminated because of various optimizations. We still emit them here so that it is possible to put breakpoints on them.
When optimization is enabled (via -O) some parts of the compiler (e.g. jump.c and cse.c) may try to delete CODE_LABEL insns which represent source-level labels which were explicitly declared by the user. This really shouldn't be happening though, so catch it if it ever does happen.
|
static |
|
static |
Generate a DIE for a lexical block.
|
inlinestatic |
Generate a new internal symbol for this location list node, if it hasn't got one yet.
References targetm.
|
static |
|
static |
Generate a DIE for a class member.
If this is not an incomplete type, output descriptions of each of its members. Note that as we output the DIEs necessary to represent the members of this record or union type, we will also be trying to output DIEs to represent the *types* of those members. However the `type' function (above) will specifically avoid generating type DIEs for member types *within* the list of member DIEs for this (containing) type except for those types (of members) which are explicitly marked as also being members of this (containing) type themselves. The g++ front- end can force any given type to be treated as a member of some other (containing) type by setting the TYPE_CONTEXT of the given (member) type to point to the TREE node representing the appropriate (containing) type.
First output info about the base classes.
Now output info about the data members and type members.
If we thought we were generating minimal debug info for TYPE and then changed our minds, some of the member declarations may have already been defined. Don't define them again, but do put them in the right order.
Now output info about the function members (if any).
Don't include clones in the member list.
References gen_field_die(), gen_type_die(), and member_declared_type().
|
static |
|
static |
Generate a DIE for a namespace or namespace alias.
Namespace aliases have a DECL_ABSTRACT_ORIGIN of the namespace they are an alias of.
Output a real namespace or module.
For Fortran modules defined in different CU don't add src coords.
Output a namespace alias.
Force out the namespace we are an alias of, if necessary.
Now create the namespace alias DIE.
Bypass dwarf2_name's check for DECL_NAMELESS.
References decl_loc_table, find_empty_loc_ranges_at_text_label(), and have_multiple_function_sections.
|
static |
Don't generate either pointer_type DIEs or reference_type DIEs here. Use modified_type_die instead. We keep this code here just in case these types of DIEs may be needed to represent certain things in other languages (e.g. Pascal) someday.
|
static |
Return a heap allocated producer string including command line options if -grecord-gcc-switches.
Ignore these.
|
static |
|
static |
Generate a DIE for a pointer to a member type.
References DINFO_LEVEL_TERSE.
|
static |
Don't generate either pointer_type DIEs or reference_type DIEs here. Use modified_type_die instead. We keep this code here just in case these types of DIEs may be needed to represent certain things in other languages (e.g. Pascal) someday.
References force_decl_die().
|
static |
Add a DW_AT_const_value attribute to DIEs that were scheduled by append_entry_to_tmpl_value_parm_die_table. This function must be called after function DIEs have been generated.
|
static |
Generate generic parameters DIEs for instances of generic types that have been previously scheduled by schedule_generic_params_dies_gen. This function must be called after all the types of the CU have been laid out.
|
static |
Generate a DIE for a structure or union type. If TYPE_DECL_SUPPRESS_DEBUG is set, we pretend that the type was never defined, so we only get the member DIEs needed by later specification DIEs.
Generate child dies for template paramaters.
First occurrence of type or toplevel definition of nested class.
If this type has been completed, then give it a byte_size attribute and then give a list of members.
Prevent infinite recursion in cases where the type of some member of this type is expressed in terms of this type itself.
If the first reference to this type was as the return type of an inline function, then it may not have a parent. Fix this now.
GNU extension: Record what type our vtable lives in.
We don't need to do this for function-local types.
|
static |
Referenced by dwarf2out_vms_debug_main_pointer().
|
static |
Generate a DIE to represent a declared function (either file-scope or block-local).
It is possible to have both DECL_ABSTRACT and DECLARATION be true if we started to generate the abstract instance of an inline, decided to output its containing class, and proceeded to emit the declaration of the inline from the member list for the class. If so, DECLARATION takes priority; we'll get back to the abstract instance when done with the class.
The class-scope declaration DIE must be the primary DIE.
Now that the C++ front end lazily declares artificial member fns, we might need to retrofit the declaration into its class.
Fixup die_parent for the abstract instance of a nested inline function.
This is where the actual code for a cloned function is. Let's emit linkage name attribute for it. This helps debuggers to e.g, set breakpoints into constructors/destructors when the user asks "break K::K".
We can have a normal definition following an inline one in the case of redefinition of GNU C extern inlines. It seems reasonable to use AT_specification in this case.
Detect and ignore this case, where we are trying to output something we have already output.
If the definition comes from the same place as the declaration, maybe use the old DIE. We always want the DIE for this function that has the *_pc attributes to be under comp_unit_die so the debugger can find it. We also need to do this for abstract instances of inlines, since the spec requires the out-of-line copy to have the same parent. For local class methods, this doesn't apply; we just use the old DIE.
Clear out the declaration attribute and the formal parameters. Do not remove all children, because it is possible that this declaration die was forced using force_decl_die(). In such cases die that forced declaration die (e.g. TAG_imported_module) is one of the children that we do not want to remove.
If this is an explicit function declaration then generate a DW_AT_explicit attribute.
The first time we see a member function, it is in the context of the class to which it belongs. We make sure of this by emitting the class first. The next time is the definition, which is handled above. The two may come from the same source text. Note that force_decl_die() forces function declaration die. It is later reused to represent definition.
We have already generated the labels.
Create start/end labels and add the range.
HP OpenVMS Industry Standard 64: DWARF Extensions Section 2.3 Prologue and Epilogue Attributes: When a breakpoint is set on entry to a function, it is generally desirable for execution to be suspended, not on the very first instruction of the function, but rather at a point after the function's frame has been set up, after any language defined local declaration processing has been completed, and before execution of the first statement of the function begins. Debuggers generally cannot properly determine where this point is. Similarly for a breakpoint set on exit from a function. The prologue and epilogue attributes allow a compiler to communicate the location(s) to use.
Generate pubnames entries for the split function code ranges.
We should use ranges for non-contiguous code section addresses. Use the actual code range for the initial section, since the HOT/COLD labels might precede an alignment offset.
There is no real support in DW2 for this .. so we make a work-around. First, emit the pub name for the segment containing the function label. Then make and emit a simplified subprogram DIE for the second segment with the name pre-fixed by __hot/cold_sect_of_. We use the same linkage name for the second die so that gdb will find both sections when given "b foo".
Do the 'primary' section.
Build a minimal DIE for the secondary section.
We define the "frame base" as the function's CFA. This is more convenient for several reasons: (1) It's stable across the prologue and epilogue, which makes it better than just a frame pointer, (2) With dwarf3, there exists a one-byte encoding that allows us to reference the .debug_frame data by proxy, but failing that, (3) We can at least reuse the code inspection and interpretation code that determines the CFA position at various points in the function.
Compute a displacement from the "steady-state frame pointer" to the CFA. The former is what all stack slots and argument slots will reference in the rtl; the latter is what we've told the debugger about. We'll need to adjust all frame_base references by this displacement.
Generate child dies for template paramaters.
Now output descriptions of the arguments for this function. This gets (unnecessarily?) complex because of the fact that the DECL_ARGUMENT list for a FUNCTION_DECL doesn't indicate cases where there was a trailing `...' at the end of the formal parameter list. In order to find out if there was a trailing ellipsis or not, we must instead look at the type associated with the FUNCTION_DECL. This will be a node of type FUNCTION_TYPE. If the chain of type nodes hanging off of this FUNCTION_TYPE node ends with a void_type_node then there should *not* be an ellipsis at the end.
In the case where we are describing a mere function declaration, all we need to do here (and all we *can* do here) is to describe the *types* of its formal parameters.
Generate DIEs to represent all known formal parameters.
Now we want to walk the list of parameters of the function and emit their relevant DIEs. We consider the case of DECL being an instance of a generic function as well as it being a normal function. If DECL is an instance of a generic function we walk the parameters of the generic function declaration _and_ the parameters of DECL itself. This is useful because we want to emit specific DIEs for function parameter packs and those are declared as part of the generic function declaration. In that particular case, the parameter pack yields a DW_TAG_GNU_formal_parameter_pack DIE. That DIE has children DIEs representing the set of arguments of the pack. Note that the set of pack arguments can be empty. In that case, the DW_TAG_GNU_formal_parameter_pack DIE will not have any children DIE. Otherwise, we just consider the parameters of DECL.
Decide whether we need an unspecified_parameters DIE at the end. There are 2 more cases to do this for: 1) the ansi ... declaration - this is detectable when the end of the arg list is not a void_type_node 2) an unprototyped function declaration (not a definition). This just means that we have no info about the parameters at all.
This is the prototyped case, check for....
Output Dwarf info for all of the stuff within the body of the function (if it has one - it may be just a declaration).
OUTER_SCOPE is a pointer to the outermost BLOCK node created to represent a function. This BLOCK actually represents the outermost binding contour for the function, i.e. the contour in which the function's formal parameters and labels get declared. Curiously, it appears that the front end doesn't actually put the PARM_DECL nodes for the current function onto the BLOCK_VARS list for this outer scope, but are strung off of the DECL_ARGUMENTS list for the function instead. The BLOCK_VARS list for the `outer_scope' does provide us with a list of the LABEL_DECL nodes for the function however, and we output DWARF info for those in decls_for_scope. Just within the `outer_scope' there will be a BLOCK node representing the function's outermost pair of curly braces, and any blocks used for the base and member initializers of a C++ constructor function.
Emit a DW_TAG_variable DIE for a named return value.
Add the calling convention attribute if requested.
|
static |
|
static |
Generate a DIE for a subroutine _type_.
|
static |
Generate a DIE for a struct, class, enum or union type.
If this is a nested type whose containing class hasn't been written out yet, writing it out will cover this one, too. This does not apply to instantiations of member class templates; they need to be added to the containing class as they are generated. FIXME: This hurts the idea of combining type decls from multiple TUs, since we can't predict what set of template instantiations we'll get.
If that failed, attach ourselves to the stub.
If this type is local to a function that hasn't been written out yet, use a NULL context for now; it will be fixed up in decls_for_scope.
A declaration DIE doesn't count; nested types need to go in the specification.
This might have been written out by the call to declare_in_namespace.
Don't set TREE_ASM_WRITTEN on an incomplete struct; we want to fix it up if it is ever completed. gen_*_type_die will set it for us when appropriate.
|
static |
Referenced by dwarf2out_vms_debug_main_pointer(), and gen_member_die().
|
static |
|
static |
Referenced by add_type_attribute().
|
static |
We want to generate the DIE for TYPE so that we can generate the die for MEMBER, which has been defined; we will need to refer back to the member declaration nested within TYPE. If we're trying to generate minimal debug info for TYPE, processing TYPE won't do the trick; we need to attach the member declaration by hand.
If we're trying to avoid duplicate debug info, we may not have emitted the member decl for this function. Emit it now.
Ignore the nameless fields that are used to skip bits but handle C++ anonymous unions and structs.
|
static |
Generate a type description DIE.
The DECL of this type is a typedef we don't want to emit debug info for but we want debug info for its underlying typedef. This can happen for e.g, the injected-class-name of a C++ type.
If TYPE is a typedef type variant, let's generate debug info for the parent typedef which TYPE is a type of.
Prevent broken recursion; we can't hand off to the same type.
Give typedefs the right scope.
If type is an anonymous tagged type named by a typedef, let's generate debug info for the typedef.
Use the DIE of the containing namespace as the parent DIE of the type description DIE we want to generate.
If this is an array type with hidden descriptor, handle it first.
We are going to output a DIE to represent the unqualified version of this type (i.e. without any const or volatile qualifiers) so get the main variant (i.e. the unqualified version) of this type now. (Vectors are special because the debugging info is in the cloned type itself).
We must set TREE_ASM_WRITTEN in case this is a recursive type. This ensures that the gen_type_die recursion will terminate even if the type is recursive. Recursive types are possible in Ada.
??? We could perhaps do this for all types before the switch statement.
For these types, all that is required is that we output a DIE (or a set of DIEs) to represent the "basis" type.
This code is used for C++ pointer-to-data-member types. Output a description of the relevant class type.
Output a description of the type of the object pointed to.
Now output a DIE to represent this pointer-to-data-member type itself.
Force out return type (in case it wasn't forced out already).
Force out return type (in case it wasn't forced out already).
No DIEs needed for fundamental types.
Just use DW_TAG_unspecified_type.
Referenced by gen_const_die().
|
static |
|
static |
Generate a DIE for a type definition.
Here, we are in the case of decl being a typedef naming an anonymous type, e.g: typedef struct {...} foo; In that case TREE_TYPE (decl) is not a typedef variant type and TYPE_NAME of the anonymous type is set to the TYPE_DECL of the typedef. This construct is emitted by the C++ FE. TYPE is the anonymous struct named by the typedef DECL. As we need the DW_AT_type attribute of the DW_TAG_typedef to point to the DIE of TYPE, let's generate that DIE right away. add_type_attribute called below will then pick (via lookup_type_die) that anonymous struct DIE.
This is a GNU Extension. We are adding a DW_AT_linkage_name attribute to the DIE of the anonymous struct TYPE. The value of that attribute is the name of the typedef decl naming the anonymous struct. This greatly eases the work of consumers of this debug info.
We want that all subsequent calls to lookup_type_die with TYPE in argument yield the DW_TAG_typedef we have just created.
|
static |
|
static |
Generate a special type of DIE used as a stand-in for a trailing ellipsis at the end of an (ANSI prototyped) formal parameters list.
|
static |
|
static |
Generate a DIE to represent a declared data object. Either DECL or ORIGIN must be non-null.
Symbol in common gets emitted as a child of the common block, in the form of a data member.
Optimize the common case.
Avoid sharing the same loc descriptor between DW_TAG_common_block and DW_TAG_variable.
Optimize the common case.
If the compiler emitted a definition for the DECL declaration and if we already emitted a DIE for it, don't emit a second DIE for it again. Allow re-declarations of DECLs that are inside functions, though.
For static data members, the declaration in the class is supposed to have DW_TAG_member tag; the specification should still be DW_TAG_variable referencing the DW_TAG_member DIE.
Loop unrolling can create multiple blocks that refer to the same static variable, so we must test for the DW_AT_declaration flag. ??? Loop unrolling/reorder_blocks should perhaps be rewritten to copy decls and set the DECL_ABSTRACT flag on them instead of sharing them. ??? Duplicated blocks have been rewritten to use .debug_ranges. ??? The declare_in_namespace support causes us to get two DIEs for one variable, both of which are declarations. We want to avoid considering one to be a specification, so we must test that this DIE is not a declaration.
This is a definition of a C++ class level static.
Local static vars are shared between all clones/inlines, so emit DW_AT_location on the abstract DIE if DECL_RTL is already set.
When abstract origin already has DW_AT_location attribute, no need to add it again.
|
static |
|
static |
Wrapper function for generate_skeleton_bottom_up.
If this type definition is nested inside another type, and is not an instantiation of a template, always leave at least a declaration in its place.
References hash_table< Descriptor, Allocator >::create(), dwarf2_build_local_stub(), map, optimize_external_refs_1(), and hash_table< Descriptor, Allocator >::traverse().
|
static |
Referenced by break_out_includes().
|
static |
Generate the skeleton ancestor tree for the given NODE, then clone the DIE and add the clone into the tree.
|
static |
Referenced by break_out_includes().
|
static |
Generate a skeleton tree of DIEs containing any declarations that are found in the original tree. We traverse the tree looking for declaration DIEs, and construct the skeleton from the bottom up whenever we find one.
Instantiated templates do not need to be cloned into the type unit. Just move the DIE and its children back to the skeleton tree (in the main CU).
Clone the existing DIE, move the original to the skeleton tree (which is in the main CU), and put the clone, with all the original's children, where the original came from (which is about to be moved to the type unit).
|
static |
Referenced by should_move_die_to_comdat().
|
static |
Generate the type signature for DIE. This is computed by generating an MD5 checksum over the DIE's tag, its relevant attributes, and its children. Attributes that are references to other DIEs are processed by recursion, using the MARK field to prevent infinite recursion. If the DIE is nested inside a namespace or another type, we also need to include that context in the signature. The lower 64 bits of the resulting MD5 checksum comprise the signature.
First, compute a signature for just the type name (and its surrounding context, if any. This is stored in the type unit DIE for link-time ODR (one-definition rule) checking.
Checksum the names of surrounding namespaces and structures.
Checksum the current DIE.
Next, compute the complete type signature.
Checksum the names of surrounding namespaces and structures.
Checksum the DIE and its children.
Store the signature in the type node and link the type DIE and the type node together.
If the DIE is a specification, link its declaration to the type node as well.
|
static |
Create and return a DIE for PARM which should be the representation of a generic type parameter. For instance, in the C++ front end, PARM would be a template parameter. ARG is the argument to PARM. EMIT_NAME_P if tree, the DIE will have DW_AT_name attribute set to the name of the PARM. PARENT_DIE is the parent DIE which the new created DIE should be added to, as a child node.
We support non-type generic parameters and arguments, type generic parameters and arguments, as well as generic generic parameters (a.k.a. template template parameters in C++) and arguments.
PARM is a nontype generic parameter
PARM is a type generic parameter.
PARM is a generic generic parameter. Its DIE is a GNU extension. It shall have a DW_AT_name attribute to represent the name of the template template parameter, and a DW_AT_GNU_template_name attribute to represent the name of the template template argument.
If PARM is a generic parameter pack, it means we are emitting debug info for a template argument pack element. In other terms, ARG is a template argument pack element. In that case, we don't emit any DW_AT_name attribute for the die.
DWARF3, 5.6.8 says if PARM is a non-type generic parameter TMPL_DIE should have a child DW_AT_type attribute that is set to the type of the argument to PARM, which is ARG. If PARM is a type generic parameter, TMPL_DIE should have a child DW_AT_type that is set to ARG.
So TMPL_DIE is a DIE representing a a generic generic template parameter, a.k.a template template parameter in C++ and arg is a template.
The DW_AT_GNU_template_name attribute of the DIE must be set to the name of the argument.
So PARM is a non-type generic parameter. DWARF3 5.6.8 says we must set a DW_AT_const_value child attribute of TMPL_DIE which value represents the value of ARG. We must be careful here: The value of ARG might reference some function decls. We might currently be emitting debug info for a generic type and types are emitted before function decls, we don't know if the function decls referenced by ARG will actually be emitted after cgraph computations. So must defer the generation of the DW_AT_const_value to after cgraph is ready.
Referenced by output_one_line_info_table().
|
static |
|
static |
Return TRUE if T is an instance of generic type, FALSE otherwise.
|
static |
Referenced by add_addr_table_entry(), add_AT_addr(), gen_array_type_die(), and index_addr_table_entry().
|
static |
Get the attribute of type attr_kind.
References get_AT_ref().
|
staticread |
Referenced by gen_array_type_die().
|
static |
Referenced by gen_array_type_die().
|
inlinestatic |
Return the value of the flag attribute designated by ATTR_KIND, or -1 if it is not present.
References lookup_type_die(), and strip_naming_typedef().
|
static |
|
inlinestatic |
Return the "high pc" attribute value, typically associated with a subprogram DIE. Return null if the "high pc" attribute is either not present, or if it cannot be represented as an assembler label identifier.
References die_struct::die_tag, get_AT_ref(), and is_naming_typedef_decl().
|
static |
|
inlinestatic |
Return the "low pc" attribute value, typically associated with a subprogram DIE. Return null if the "low pc" attribute is either not present, or if it cannot be represented as an assembler label identifier.
|
inlinestatic |
Referenced by get_AT(), and get_AT_hi_pc().
|
inlinestatic |
|
static |
|
inlinestatic |
Return the value of the string attribute designated by ATTR_KIND, or NULL if it is not present.
|
static |
Referenced by add_AT_vms_delta(), AT_file(), gen_array_type_die(), and should_move_die_to_comdat().
|
inlinestatic |
Return the value of the unsigned attribute designated by ATTR_KIND, or 0 if it is not present.
|
static |
|
static |
Return die_offset of a DIE reference to a base type.
|
inlinestatic |
Referenced by prune_unused_types().
|
inlinestatic |
Returns the DIE for a context.
Find die that represents this context.
|
static |
Returns the parent of the declaration of DIE.
References add_child_die(), limbo_die_struct::created_for, limbo_die_struct::die, die_struct::die_tag, limbo_die_list, and limbo_die_struct::next.
|
static |
|
static |
Return die_offset of a DIE reference other than base type.
|
static |
|
static |
Set label to debug_info_section_label + die_offset of a DIE reference.
|
static |
Return the single type-unit die for skeleton type units.
For dwarf_split_debug_sections with use_type info, all type units in the skeleton sections have identical dies (but different headers). This single die will be output many times.
References add_ranges_num(), memset(), offset, and ranges_by_label_in_use.
|
inlinestatic |
Compute hash of the whole location list LIST_HEAD.
|
static |
|
static |
Helper routines for optimize_location_lists. This pass tries to share identical local lists in .debug_loc section.
Iteratively hash operands of LOC opcode.
FALLTHRU
FALLTHRU
Other codes have no operands.
|
inlinestatic |
Iteratively hash the whole DWARF location expression LOC.
Compute sizes, so that DW_OP_skip/DW_OP_bra can be checksummed.
|
static |
Helper function for loc_descriptor. Return DW_OP_GNU_implicit_pointer for DEBUG_IMPLICIT_PTR RTL.
References dw_loc_descr_struct::dw_loc_next, and memcpy().
|
static |
Calculate if the entry should appear in the final output file. It may be from a pruned a type.
By limiting gnu pubnames to definitions only, gold can generate a gdb index without entries for declarations, which don't include enough information to be useful.
Enumerator names are part of the pubname table, but the parent DW_TAG_enumeration_type die may have been pruned. Don't output them if that is the case.
Everything else in the pubname table is included.
The pubtypes table shouldn't include types that have been pruned.
References AT_index(), and dw2_asm_output_data_uleb128().
Referenced by optimize_external_refs_1().
|
static |
A helper function for dwarf2out_finish called through htab_traverse. Assign an addr_table_entry its index. All entries must be collected into the table when this function is called, because the indexing code relies on htab_traverse to traverse nodes in the same order for each run.
Don't index unreferenced nodes.
References AT_string(), and get_AT().
|
static |
Recursively assign each location list a unique index into the debug_addr section.
Don't index an entry that has already been indexed or won't be output.
|
static |
A helper function for dwarf2out_finish called through htab_traverse. Assign a string its index. All strings must be collected into the table by the time index_string is called, because the indexing code relies on htab_traverse to traverse nodes in the same order for each run.
void init_addr_table_entry | ( | ) |
Initialize an addr_table_entry.
|
static |
|
static |
Writes double_int values to dw_vec_const array.
|
static |
|
static |
Writes floating point values to dw_vec_const array.
real_to_target puts 32-bit pieces in each long. Pack them.
References add_const_value_attribute(), initializer_constant_valid_p(), int_size_in_bytes(), and rtl_for_decl_init().
|
static |
|
static |
Writes integer values to dw_vec_const array.
References int_size_in_bytes(), and constructor_elt_d::value.
|
static |
Referenced by add_loc_descr_op_piece(), and modified_type_die().
|
static |
Return a location descriptor that designates a constant.
Pick the smallest representation of a constant, rather than just defaulting to the LEB encoding.
DW_OP_litX DW_OP_litY DW_OP_shl takes just 3 bytes and DW_OP_litX DW_OP_const1u Y DW_OP_shl takes just 4 bytes, while DW_OP_const4u is 5 bytes.
DW_OP_const1u X DW_OP_litY DW_OP_shl takes just 4 bytes, while DW_OP_const4u is 5 bytes.
DW_OP_const1u X DW_OP_const1u Y DW_OP_shl takes just 5 bytes, while DW_OP_constu of constant >= 0x100000000 takes at least 6 bytes.
DW_OP_const2u X DW_OP_litY DW_OP_shl takes just 5 bytes, DW_OP_const2u X DW_OP_const1u Y DW_OP_shl takes 6 bytes, while DW_OP_constu takes in this case at least 6 bytes.
DW_OP_const4u X DW_OP_litY DW_OP_shl takes just 7 bytes.
|
static |
Return a location descriptor that designates a constant i, as a compound operation from constant (i >> shift), constant shift and DW_OP_shl.
|
inlinestatic |
Return TRUE if the language is Ada.
Referenced by add_gnat_descriptive_type_attribute().
|
static |
|
inlinestatic |
Given a pointer to an arbitrary ..._TYPE tree node, return nonzero if the given input type is a Dwarf "fundamental" type. Otherwise return null.
|
static |
|
inlinestatic |
Return true if this RTL expression describes a base+offset calculation.
|
inlinestatic |
Returns true iff C is a class or structure DIE.
References copy().
|
static |
|
static |
Returns 1 iff C is the sort of DIE that should go into a COMDAT CU. Basically, we want to choose the bits that are likely to be shared between compilations (types) and leave out the bits that are specific to individual compilations (functions).
I think we want to leave base types and __vtbl_ptr_type in the main CU, as we do for stabs. The advantage is a greater likelihood of sharing between objects that don't include headers in the same order (and therefore would put the base types in a different comdat). jason 8/28/00
References add_child_die(), clone_die(), and clone_tree().
|
inlinestatic |
Returns true iff C is a compile-unit DIE.
Referenced by gen_array_type_die().
|
inlinestatic |
Return TRUE if the language is C++.
|
static |
Referenced by break_out_includes(), and compute_section_prefix().
|
static |
Return non-zero if this DIE is a declaration.
References copy_declaration_context().
|
inlinestatic |
Return TRUE if the language is Fortran.
Referenced by add_gnat_descriptive_type_attribute().
|
inlinestatic |
Return TRUE if the language is Java.
|
inlinestatic |
Returns true iff C is a namespace DIE.
|
static |
Referenced by get_AT_hi_pc().
|
static |
Return TRUE if TYPE is a typedef that names a type for linkage purposes. This kind of typedefs is produced by the C++ FE for constructs like: typedef struct {...} foo; In that case, there is no typedef variant type produced for foo. Rather, the TREE_TYPE of the TYPE_DECL of foo is the anonymous struct type.
It looks like Ada produces TYPE_DECLs that are very similar to C++ naming typedefs but that have different semantics. Let's be specific to c++ for now.
|
static |
Return non-zero if this DIE is nested inside a subprogram.
|
static |
Forward declarations for functions defined in this file.
Referenced by loc_descriptor_from_tree().
|
inlinestatic |
Test if rtl node points to a pseudo register.
References AT_class(), dw_attr_struct::dw_attr_val, dw_val_class_flag, dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_flag.
|
inlinestatic |
|
inlinestatic |
Is this a typedef we can avoid emitting?
Also ignore the artificial member typedef for the class name.
References loclabel_num.
|
static |
|
static |
Returns 1 iff C is the sort of DIE that might be referred to from another compilation unit.
References add_AT_die_ref(), clone_die(), and die_struct::comdat_type_p.
|
static |
|
inlinestatic |
Return nonzero if the given type node represents a tagged type.
|
inlinestatic |
Referenced by break_out_includes().
|
inlinestatic |
Return non-zero if this DIE represents a template instantiation.
|
inlinestatic |
Return non-zero if this DIE is a template parameter.
|
static |
|
static |
Returns nonzero if DIE represents a type, in the sense of TYPE_P.
|
inlinestatic |
Returns true iff C is a unit DIE of some sort.
|
static |
|
inlinestatic |
Calculate the checksum of a location expression.
|
static |
|
inlinestatic |
Calculate the checksum of a location expression.
Special case for lone DW_OP_plus_uconst: checksum as if the location were emitted as a DW_FORM_sdata instead of a location expression.
Otherwise, just checksum the raw location expression.
bool loc_descr_equal_p | ( | ) |
Compare two complete location expressions for exact equality.
Referenced by lookup_cfa_1().
|
static |
Compare two location atoms for exact equality.
??? This is only ever set for DW_OP_constNu, for N equal to the address size, but since we always allocate cleared storage it should be zero for other types of locations.
References dw_loc_descr_struct::dw_loc_oprnd1, addr_table_entry_struct::index, size_of_uleb128(), and dw_val_struct::val_entry.
|
static |
Add a constant OFFSET to a location expression.
Find the end of the chain.
If the last operation is fbreg, breg{0..31,x}, optimize by adjusting its offset. Don't optimize if an signed integer overflow would happen.
|
static |
Output a proper Dwarf location descriptor for a variable or parameter which is either allocated in a register or in a memory location. For a register, we just generate an OP_REG and the register number. For a memory location we provide a Dwarf postfix expression describing how to generate the (dynamic) address of the object onto the address stack. MODE is mode of the decl if this loc_descriptor is going to be used in .debug_loc section where DW_OP_stack_value and DW_OP_implicit_value are allowed, VOIDmode otherwise. If we don't know how to describe it, return 0.
The case of a subreg may arise when we have a local (register) variable or a formal (register) parameter which doesn't quite fill up an entire register. For now, just assume that it is legitimate to make the Dwarf info refer to the whole register which contains the given subreg.
Single part.
FALLTHRU
Create the first one, so we have something to add to.
Note that a CONST_DOUBLE rtx could represent either an integer or a floating-point constant. A CONST_DOUBLE is used whenever the constant requires more than one word in order to be adequately represented. We output CONST_DOUBLEs as blocks.
FALLTHROUGH
FALLTHRU
Value expression.
|
static |
|
static |
Same as above but return only single location expression.
References is_pseudo_reg().
|
static |
Return dw_loc_list representing address of addr_expr LOC by looking for inner INDIRECT_REF expression and turning it into simple arithmetics.
Variable offset.
|
static |
|
static |
Generate Dwarf location list representing LOC. If WANT_ADDRESS is false, expression computing LOC will be computed If WANT_ADDRESS is 1, expression computing address of LOC will be returned if WANT_ADDRESS is 2, expression computing address useable in location will be returned (i.e. DW_OP_reg can be used to refer to register values).
??? Most of the time we do not take proper care for sign/zero extending the values properly. Hopefully this won't be a real problem...
This case involves extracting fields from an object to determine the position of other fields. We don't try to encode this here. The only user of this is Ada, which encodes the needed information using the names of types.
There are no opcodes for these operations.
There are no opcodes for these operations.
If we already want an address, see if there is INDIRECT_REF inside e.g. for &this->field.
Otherwise, process the argument and look for the address.
If this is not defined, we have no way to emit the data.
The way DW_OP_GNU_push_tls_address is specified, we can only look up addresses of objects in the current module. We used DW_OP_addr as first op, but that's wrong, because DW_OP_addr is relocated by the debug info consumer, while DW_OP_GNU_push_tls_address operand shouldn't be.
We stuffed the control variable into the DECL_VALUE_EXPR to signal (via DECL_HAS_VALUE_EXPR_P) that the decl should no longer appear in gimple code. We used the control variable in specific so that we could pick it up here.
FALLTHRU
FALLTHRU
Certain constructs can only be represented at top-level.
??? FIXME.
Fallthru.
TODO: We can extract value of the small expression via shifting even for nonzero bitpos.
Variable offset.
We can construct small constants here using int_loc_descriptor.
... fall through ...
??? Need a node to point the skip at. Use a nop.
Leave front-end specific codes as simply unknown. This comes up, for instance, with the C STMT_EXPR.
Otherwise this is a generic code; we should just lists all of these explicitly. We forgot one.
In a release build, we want to degrade gracefully: better to generate incomplete debugging information than to crash.
Show if we can't fill the request for an address.
If we've got an address and don't want one, dereference.
References add_AT_loc(), add_AT_loc_list(), dw_loc_list_struct::expr, and single_element_loc_list_p().
|
static |
Add a constant OFFSET to a location list.
|
inlinestatic |
Referenced by gen_array_type_die().
|
inlinestatic |
Returns nonzero if CONTEXT_DIE is internal to a function.
References set_block_abstract_flags().
|
static |
|
inlinestatic |
Return the DIE associated with a given declaration.
|
static |
|
inlinestatic |
Return the var_loc list associated with a given declaration.
References memset().
|
staticread |
Return a pointer to the external_ref for references to DIE.
References pubname_struct::die, die_struct::die_parent, die_struct::die_perennial_p, and die_struct::die_tag.
Referenced by remove_child_or_replace_with_skeleton().
|
staticread |
Referenced by gen_array_type_die(), and lookup_filename().
|
staticread |
Lookup FILE_NAME (in the list of filenames that we know about here in dwarf2out.c) and return its "index". The index of each (known) filename is just a unique number which is associated with only that one filename. We need such numbers for the sake of generating labels (in the .debug_sfnames section) and references to those files numbers (in the .debug_srcinfo and.debug_macinfo sections). If the filename given as an argument is not found in our current list, add it to the list and assign it the next available unique index number. In order to speed up searches, we remember the index of the filename was looked up last. This handles the majority of all searches.
Check to see if the file name that was searched on the previous call matches this file name. If so, return the index.
Didn't match the previous lookup, search the table.
|
static |
Referenced by get_AT_flag(), and output_one_line_info_table().
|
inlinestatic |
Return the DIE associated with the given type specifier.
|
static |
Referenced by dwarf2out_vms_debug_main_pointer().
|
inlinestatic |
Like lookup_type_die, but if type is an anonymous type named by a typedef[1], return the DIE of the anonymous type instead the one of the naming typedef. This is because in gen_typedef_die, we did equate the anonymous struct named by the typedef with the DIE of the naming typedef. So by default, lookup_type_die on an anonymous struct yields the DIE of the naming typedef. [1]: Read the comment of is_naming_typedef_decl to learn about what a naming typedef is.
References decl_piece_bitsize().
|
static |
Return the default for DW_AT_lower_bound, or -1 if there is not any default.
References add_bound_info(), and new_die().
|
static |
Helper function for resolve_addr, mark DW_TAG_base_type nodes referenced from typed stack ops and count how often they are used.
FALLTHRU
|
static |
Referenced by copy_ancestor_tree(), and output_loc_list_offset().
|
static |
Set the marks for a die and its children. We do this so that we know whether or not a reference needs to use FORM_ref_addr; only DIEs in the same CU will be marked. We used to clear out the offset and use that as the flag, but ran into ordering problems.
|
static |
Match the base name of a file to the base name of a compilation unit.
Cache the last query.
Referenced by dump_struct_debug().
|
static |
|
static |
If the assembler will construct the file table, then translate the compiler internal file table number into the assembler file table number, and emit a .file directive if we haven't already emitted one yet. The file table numbers are different because we prune debug info for unused variables and types, which may include filenames.
|
read |
The following routine converts the RTL for a variable or parameter (resident in memory) into an equivalent Dwarf representation of a mechanism for getting the address of that same variable onto the top of a hypothetical "address evaluation" stack. When creating memory location descriptors, we are effectively transforming the RTL for a memory-resident object into its Dwarf postfix expression equivalent. This routine recursively descends an RTL tree, turning it into Dwarf postfix code as it goes. MODE is the mode that should be assumed for the rtl if it is VOIDmode. MEM_MODE is the mode of the memory reference, needed to handle some autoincrement addressing modes. Return 0 if we can't represent the location.
Note that for a dynamically sized array, the location we will generate a description of here will be the lowest numbered location which is actually within the array. That's *not* necessarily the same as the zeroth element of the array.
The case of a subreg may arise when we have a local (register) variable or a formal (register) parameter which doesn't quite fill up an entire register. For now, just assume that it is legitimate to make the Dwarf info refer to the whole register which contains the given subreg.
Whenever a register number forms a part of the description of the method for calculating the (dynamic) address of a memory resident object, DWARF rules require the register number be referred to as a "base register". This distinction is not based in any way upon what category of register the hardware believes the given register belongs to. This is strictly DWARF terminology we're dealing with here. Note that in cases where the location of a memory-resident data object could be expressed as: OP_ADD (OP_BASEREG (basereg), OP_CONST (0)) the actual DWARF location descriptor that we generate may just be OP_BASEREG (basereg). This may look deceptively like the object in question was allocated to a register (rather than in memory) so DWARF consumers need to be aware of the subtle distinction between OP_REG and OP_BASEREG.
If RTL is internal_arg_pointer, which has been optimized out, use DRAP instead.
If DW_OP_const{1,2,4}u won't be used, it is shorter to expand zero extend as two shifts instead of masking.
Some ports can transform a symbol ref into a label ref, because the symbol ref is too far away and has to be dumped into a constant pool.
If this is not defined, we have no way to emit the data.
Extract the PLUS expression nested inside and fall into PLUS code below.
Turn these into a PLUS expression and fall into the PLUS code below.
... fall through ...
If a pseudo-reg is optimized away, it is possible for it to be replaced with a MEM containing a multiply or shift.
const DW_OP_GNU_convert <XXX> vs. DW_OP_GNU_const_type <XXX, 1, const>.
Note that a CONST_DOUBLE rtx could represent either an integer or a floating-point constant. A CONST_DOUBLE is used whenever the constant requires more than one word in order to be adequately represented. We output CONST_DOUBLEs as blocks.
FALLTHRU
In theory, we could implement the above.
DWARF cannot represent the unsigned compare operations natively.
If delegitimize_address couldn't do anything with the UNSPEC, we can't express it in the debug info. This can happen e.g. with some TLS UNSPECs.
Referenced by expansion_failed(), gen_formal_parameter_die(), reg_loc_descriptor(), and scompare_loc_descriptor().
|
static |
Referenced by dwarf2out_vms_debug_main_pointer(), and gen_member_die().
|
inlinestatic |
Return the type associated with a data member, make a special check for bit field types.
References call_arg_loc_node::block, and block_map.
|
static |
Return location descriptor for {U,S}{MIN,MAX}.
|
static |
Given a pointer to an arbitrary ..._TYPE tree node, return a debugging entry that chains various modifiers in front of the given type.
See if we already have the appropriately qualified variant of this type.
If we do, then we can just use its DIE, if it exists.
Handle C typedef types.
For a named type, use the typedef.
cv-unqualified version of named type. Just use the unnamed type to which it refers.
Else cv-qualified version of named type; fall through.
If both is_const_type and is_volatile_type, prefer the path which leads to a qualified type.
We have to get the type_main_variant here (and pass that to the `lookup_type_die' routine) because the ..._TYPE node we have might simply be a *copy* of some original type node (where the copy was created to help us keep track of typedef names) and that copy might have a different TYPE_UID from the original ..._TYPE node.
Vectors have the debugging information in the type, not the main variant.
Builtin types don't have a DECL_ORIGINAL_TYPE. For those, don't output a DW_TAG_typedef, since there isn't one in the user's program; just attach a DW_AT_name to the type. Don't attach a DW_AT_name to DW_TAG_const_type or DW_TAG_volatile_type if the base type already has the same name.
Could just call add_name_and_src_coords_attributes here, but since this is a builtin type it doesn't have any useful source coordinates anyway.
This probably indicates a bug.
We must do this after the equate_type_number_to_die call, in case this is a recursive type. This ensures that the modified_type_die recursion will terminate even if the type is recursive. Recursive types are possible in Ada.
References add_loc_descr(), int_loc_descriptor(), new_loc_descr(), and size_of_int_loc_descriptor().
|
static |
Move all children from OLD_PARENT to NEW_PARENT.
References copy().
Referenced by break_out_includes().
|
inlinestatic |
Move a DW_AT_{,MIPS_}linkage_name attribute just added to dw_die_ref to the location it would have been added, should we know its DECL_ASSEMBLER_NAME when we added other attributes. This will probably improve compactness of debug info, removing equivalent abbrevs, and hide any differences caused by deferring the computation of the assembler name, triggered by e.g. PCH.
References add_AT_low_high_pc(), and text_section_used.
|
static |
Move base types marked by mark_base_types as early as possible in the CU, sorted by decreasing usage count both to make the uleb128 references as small as possible and to make sure they will have die_offset already computed by calc_die_sizes when sizes of typed stack loc ops is computed.
Sort by decreasing usage count, they will be added again in that order later on.
As base types got marked, there must be at least one node other than DW_TAG_base_type.
|
static |
Given an RTL of a register, return a location descriptor that designates a value that spans more than one register.
Simple, contiguous registers.
Now onto stupid register sets in non contiguous locations.
|
static |
Helper function for tree_add_const_value_attribute. Natively encode initializer INIT into an array. Return true if successful.
Referenced by add_data_member_location_attribute().
|
inlinestatic |
Return a pointer to a newly allocated address location description. If dwarf_split_debug_info is true, then record the address with the appropriate relocation.
|
static |
|
inlinestatic |
Return a pointer to a newly created DIE node.
|
static |
Create a new line number table.
|
inlinestatic |
Return a pointer to a newly allocated location description. Location descriptions are simple expression terms that can be strung together to form more complicated location (address) descriptions.
References dw_vec_struct::array, dw_vec_struct::elt_size, dw_vec_struct::length, dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_vec.
Referenced by add_loc_descr_op_piece(), convert_descriptor_to_mode(), dbx_reg_number(), gen_generic_params_dies(), modified_type_die(), reg_loc_descriptor(), retry_incomplete_types(), and scompare_loc_descriptor().
|
static |
Create a DW_OP_piece or DW_OP_bit_piece for bitsize, or return NULL if it is not possible.
|
inlinestatic |
Return a new location list, given the begin and end range, and the expression.
|
inlinestatic |
Return a pointer to a newly allocated location description for REG and OFFSET.
References dw_loc_descr_struct::dtprel.
|
static |
|
static |
Return a location descriptor that designates a machine register for a given hard register number.
|
static |
DIE is a unit; look through all the DIE references to see if there are any external references to types, and if so, create local stubs for them which will be applied in build_abbrev_table. This is useful because references to local DIEs are smaller.
Referenced by output_loc_list_offset().
|
static |
Subroutine of optimize_external_refs, below. If we see a type skeleton, record it as our stub. If we see external references, remember how many we've seen.
This is a local skeleton; use it for local references.
Scan the DIE references, and remember any that refer to DIEs from other CUs (i.e. those which are not marked).
References include_pubname_in_output(), pubname_struct::name, and strlen().
Referenced by generate_skeleton().
|
static |
Helper function of resolve_addr. DIE had DW_AT_location of DW_OP_addr alone, which referred to DECL in DW_OP_addr's operand and DW_OP_addr couldn't be resolved. resolve_addr has already removed the DW_AT_location attribute. This function attempts to add a new DW_AT_location attribute with DW_OP_GNU_implicit_pointer to it or DW_AT_const_value attribute, if possible.
For variables that have been optimized away and thus don't have a memory location, see if we can emit DW_AT_const_value instead.
If init is ADDR_EXPR or POINTER_PLUS_EXPR of ADDR_EXPR, and ADDR_EXPR refers to a decl that has DW_AT_location or DW_AT_const_value (but isn't addressable, otherwise resolving the original DW_OP_addr wouldn't fail), see if we can add DW_OP_GNU_implicit_pointer.
Referenced by dwarf2out_init().
|
static |
Optimize location lists referenced from DIE children and share them whenever possible.
|
static |
Recursively optimize location lists referenced from DIE children and share them whenever possible.
TODO: perform some optimizations here, before hashing it and storing into the hash table.
|
static |
Attempt to make a sequence of define/undef macinfo ops shareable with other compilation unit .debug_macinfo sections. IDX is the first index of a define/undef, return the number of ops that should be emitted in a comdat .debug_macinfo section and emit a DW_MACRO_GNU_transparent_include entry referencing it. If the define/undef entry should be emitted normally, return 0.
Optimize only if there are at least two consecutive define/undef ops, and either all of them are before first DW_MACINFO_start_file with lineno {0,1} (i.e. predefined macro block), or all of them are in some included header file.
Find the last define/undef entry that can be grouped together with first and at the same time compute md5 checksum of their codes, linenumbers and strings.
From the containing include filename (if any) pick up just usable characters from its basename.
Count . at the end.
The group name format is: wmN.[<encoded filename>.]<lineno>.<md5sum>
Construct a macinfo_entry for DW_MACRO_GNU_transparent_include in the empty vector entry before the first define/undef.
Avoid emitting duplicates.
If such an entry has been used before, just emit a DW_MACRO_GNU_transparent_include op.
And clear all macinfo_entry in the range to avoid emitting them in the second pass.
|
static |
Helper function of resolve_addr_in_expr. LOC is a DW_OP_addr followed by DW_OP_stack_value, either at the start of exprloc or after DW_OP_{,bit_}piece, and val_addr can't be resolved. Replace it (both DW_OP_addr and DW_OP_stack_value) with DW_OP_GNU_implicit_pointer if possible and return true, if unsuccessful, return false.
|
static |
Output the .debug_abbrev section which defines the DIE abbreviation table.
Terminate the table.
|
static |
Produce the .debug_addr section.
References dw_loc_descr_struct::dtprel.
|
static |
Callback for htab_traverse to assign an index to an entry in the table, and to write that entry to the .debug_addr section.
|
static |
|
static |
Output the information that goes into the .debug_aranges table. Namely, define the beginning and ending address range of the text section generated for this compilation unit.
Version number for aranges is still 2, even in DWARF3.
We need to align to twice the pointer size here.
Pad using a 2 byte words so that padding is correct for any pointer size.
It is necessary not to output these entries if the sections were not used; if the sections were not used, the length will be 0 and the address may end up as 0 if the section is discarded by ld --gc-sections, leaving an invalid (0, 0) entry that can be confused with the terminator.
Output the terminator words.
References dw2_asm_output_addr(), dw2_asm_output_data(), dw2_asm_output_data_sleb128(), dw2_asm_output_data_uleb128(), dw_line_info_table_struct::entries, LI_negate_stmt, LI_set_address, LI_set_column, LI_set_discriminator, LI_set_epilogue_begin, LI_set_file, LI_set_line, LI_set_prologue_end, dw_line_info_struct::opcode, size_of_uleb128(), and dw_line_info_struct::val.
|
static |
Output an attribute's index or value appropriately.
References targetm.
Referenced by size_of_aranges().
|
static |
|
static |
Output the call frame information used to record information that relates to calculating the frame pointer, and records the location of saved registers.
Don't emit a CIE if there won't be any FDEs.
Nothing to do if the assembler's doing it all.
If we don't have any functions we'll want to unwind out of, don't emit any EH unwind information. If we make FDEs linkonce, we may have to emit an empty label for an FDE that wouldn't otherwise be emitted. We want to avoid having an FDE kept around when the function it refers to is discarded. Example where this matters: a primary function template in C++ requires EH information, an explicit specialization doesn't.
We're going to be generating comments, so turn on app.
Switch to the proper frame section, first time.
Output the CIE.
Now that the CIE pointer is PC-relative for EH, use 0 to identify the CIE.
Use the CIE version 3 for DWARF3; allow DWARF2 to continue to use CIE version 1, unless that would produce incorrect results due to overflowing the return register column.
Augmentation: z Indicates that a uleb128 is present to size the augmentation section. L Indicates the encoding (and thus presence) of an LSDA pointer in the FDE augmentation. R Indicates a non-default pointer encoding for FDE code pointers. P Indicates the presence of an encoding + language personality routine in the CIE augmentation.
Ug. Some platforms can't do unaligned dynamic relocations at all.
Augmentations should be small, so there's scarce need to iterate for a solution. Die if we exceed one uleb128 byte.
Pad the CIE out to an address sized boundary.
Loop through all of the FDE's.
Don't emit EH unwind info for leaf functions that don't need it.
Turn off app to make assembly quicker.
References targetm.
|
static |
|
static |
Output a comdat type unit DIE and its children.
First mark all the DIEs in this CU so we know which get local refs.
Initialize the beginning DIE offset - and calculate sizes/offsets.
Output debugging information.
Produce the skeleton type-unit header.
|
static |
|
static |
Output the compilation unit DIE and its children.
Unless we are outputting main CU, we may throw away empty ones.
Even if there are no children of this DIE, we must output the information about the compilation unit. Otherwise, on an empty translation unit, we will generate a present, but empty, .debug_info section. IRIX 6.5 `nm' will then complain when examining the file. First mark all the DIEs in this CU so we know which get local refs.
Initialize the beginning DIE offset - and calculate sizes/offsets.
Output debugging information.
Leave the marks on the main CU, so we can check them in output_pubnames.
|
static |
Output the compilation unit that appears at the beginning of the .debug_info section, and precedes the DIE descriptions.
|
static |
|
static |
Output the DIE and its attributes. Called recursively to generate the definitions of each child DIE.
If someone in another CU might refer to us, set up a symbol for them to point to.
Output the block length for this list of location operations.
??? It would be slightly more efficient to use a scheme like is used for unsigned constants below, but gdb 4.x does not sign extend. Gdb 5.x does sign extend.
Currently all add_AT_flag calls pass in 1 as last argument, so DW_FORM_flag_present can be used. If that ever changes, we'll need to use DW_FORM_flag and have some optimization in build_abbrev_table that will change those to DW_FORM_flag_present if it is set to 1 in all DIEs using the same abbrev entry.
In DWARF2, DW_FORM_ref_addr is sized by target address length, whereas in DWARF3 it's always sized as an offset.
Add null byte to terminate sibling list.
References targetm.
|
static |
|
static |
Given a die and id, produce the appropriate abbreviations.
|
static |
Referenced by size_of_pubnames().
|
inlinestatic |
Output a symbol we can use to refer to this DIE from another CU.
We make these global, not weak; if the target doesn't support .linkonce, it doesn't support combining the sections, so debugging will break.
|
static |
Output one FDE.
empty
Loop through the Call Frame Instructions associated with this FDE.
If we are to emit a ref/link from function bodies to their frame tables, do it now. This is typically performed to make sure that tables associated with functions are dragged with them and not discarded in garbage collecting links. We need to do this on a per function basis to cope with -ffunction-sections.
Switch to the function section, emit the ref to the tables, and switch *back* into the table section.
Pad the FDE out to an address sized boundary.
|
static |
Output the directory table and the file name table. We try to minimize the total amount of memory needed. A heuristic is used to avoid large slowdowns with many input files.
Allocate the various arrays we need.
Find all the different directories used.
Same directory as last entry.
This is a new directory.
Search for a prefix.
Now to the actual work. We have to find a subset of the directories which allow expressing the file name using references to the directory table with the least amount of characters. We do not do an exhaustive search where we would have to check out every combination of every single possible prefix. Instead we use a heuristic which provides nearly optimal results in most cases and never is much off.
We can always save some space for the current directory. But this does not mean it will be enough to justify adding the directory.
Determine whether the dirs[i] path is a prefix of the dirs[j] path.
Yes it is. We can possibly save some memory by writing the filenames in dirs[j] relative to dirs[i].
Check whether we can save enough to justify adding the dirs[i] directory.
It's worthwhile adding.
Remember how much we saved for this directory so far.
Remember the prefix directory.
Emit the directory name table.
We have to emit them in the order of emitted_number since that's used in the debug info generation. To do this efficiently we generate a back-mapping of the indices first.
Now write all the file names.
Setting these fields can lead to debugger miscomparisons, but VMS Debug requires them to be set correctly.
Include directory index.
Modification time.
File length in bytes.
Include directory index.
Modification time.
File length in bytes.
|
static |
A helper function for dwarf2out_finish called through htab_traverse. Output the indexed string.
Assert that the strings are output in the same order as their indexes were assigned.
|
static |
A helper function for output_indirect_strings called through htab_traverse. Output the offset to a string and update the current offset.
Assert that this node has been assigned an index.
References addr_table_entry_struct::addr, dw_loc_descr_struct::dtprel, iterative_hash_rtx(), addr_table_entry_struct::addr_table_entry_struct_union::rtl, and dw_val_struct::val_entry.
|
static |
And now, the support for symbolic debugging information.
.debug_str support.
|
static |
A helper function for dwarf2out_finish called through htab_traverse. Emit one queued .debug_str string.
|
static |
Output the indexed string table.
|
static |
|
static |
Output the source line number correspondence information. This information goes into the .debug_line section.
Define the architecture-dependent minimum instruction length (in bytes). In this implementation of DWARF, this field is used for information purposes only. Since GCC generates assembly language, we have no a priori knowledge of how many instruction bytes are generated for each source line, and therefore can use only the DW_LNE_set_address and DW_LNS_fixed_advance_pc line information commands. Accordingly, we fix this as '1', which is "correct enough" for all architectures, and don't let the target override.
Write out the information about the files we use.
Output the marker for the end of the line number info.
??? Some Darwin linkers crash on a .debug_line section with no sequences. Further, merely a DW_LNE_end_sequence entry is not sufficient -- the address column must also be initialized. Make sure to output at least one set_address/end_sequence pair, choosing .text since that section is always present.
Output the marker for the end of the line number info.
|
static |
|
static |
Output the location list given to us.
Walk the location list, and output each range + expression.
Don't output an entry that starts and ends at the same address.
If the expression is too large, drop it on the floor. We could perhaps put it into DW_TAG_dwarf_procedure and refer to that in the expression, but >= 64KB expressions for a single value in a single range are unlikely very useful.
The length field is 4 bytes. If we ever need to support an 8-byte length, we can add a new DW_LLE code or fall back to DW_LLE_GNU_start_end_entry.
Output the block length for this list of location operations.
References add_AT_flag(), and want_pubnames().
|
static |
Output the offset into the debug_loc section.
References build_abbrev_table(), mark_dies(), optimize_external_refs(), and comdat_type_struct::root_die.
|
static |
Output location description stack opcode's operands (if any). The for_eh_or_skip parameter controls whether register numbers are converted using DWARF2_FRAME_REG_OUT, which is needed in the case that hard reg numbers have been processed via DWARF_FRAME_REGNUM (i.e. for unwind info). This should be suppressed for the cases that have not been converted (i.e. symbolic debug info), by setting the parameter < 0. See PR47324.
FALLTHRU
FALLTHRU
We currently don't make any attempt to make sure these are aligned properly like we do for the main unwind info, so don't support emitting things larger than a byte if we're only doing unwinding.
Other codes have no operands.
|
static |
Output location description stack opcode's operands (if any). The output is single bytes on a line, suitable for .cfi_escape.
We cannot output addresses in .cfi_escape, only bytes.
Other codes have no operands.
void output_loc_sequence | ( | ) |
Output a sequence of location operations. The for_eh_or_skip parameter controls whether register numbers are converted using DWARF2_FRAME_REG_OUT, which is needed in the case that hard reg numbers have been processed via DWARF_FRAME_REGNUM (i.e. for unwind info). This should be suppressed for the cases that have not been converted (i.e. symbolic debug info), by setting the parameter < 0. See PR47324.
Output the opcode.
Output the operand(s) (if any).
Referenced by size_of_aranges().
void output_loc_sequence_raw | ( | ) |
Output the opcode.
Output the opcode.
References debug_nothing_int(), debug_nothing_int_charstar(), debug_nothing_rtx(), debug_nothing_tree(), dwarf2out_abstract_function(), dwarf2out_assembly_start(), dwarf2out_begin_block(), dwarf2out_begin_function(), dwarf2out_begin_prologue(), dwarf2out_define(), dwarf2out_end_block(), dwarf2out_end_epilogue(), dwarf2out_end_function(), dwarf2out_end_source_file(), dwarf2out_finish(), dwarf2out_function_decl(), dwarf2out_global_decl(), dwarf2out_ignore_block(), dwarf2out_imported_module_or_decl(), dwarf2out_init(), dwarf2out_source_line(), dwarf2out_start_source_file(), dwarf2out_switch_text_section(), dwarf2out_type_decl(), dwarf2out_undef(), dwarf2out_var_location(), dwarf2out_vms_begin_epilogue(), and dwarf2out_vms_end_prologue().
|
static |
|
static |
Output all location lists for the DIE and its children.
|
static |
Output macinfo section(s).
output_macinfo* uses these interchangeably.
For .debug_macro emit the section header.
In the first loop, it emits the primary .debug_macinfo section and after each emitted op the macinfo_entry is cleared. If a longer range of define/undef ops can be optimized using DW_MACRO_GNU_transparent_include, the DW_MACRO_GNU_transparent_include op is emitted and kept in the vector before the first define/undef in the range and the whole range of define/undef ops is not emitted and kept.
A dummy entry may be inserted at the beginning to be able to optimize the whole block of predefined macros.
If any DW_MACRO_GNU_transparent_include were used, on those DW_MACRO_GNU_transparent_include entries terminate the current chain and switch to a new comdat .debug_macinfo section and emit the define/undef entries within it.
Terminate the previous .debug_macinfo section.
|
static |
Output a single .debug_macinfo entry.
|
static |
Output one line number table into the .debug_line section.
??? Unfortunately, we have little choice here currently, and must always use the most general form. GCC does not know the address delta itself, so we can't use DW_LNS_advance_pc. Many ports do have length attributes which will give an upper bound on the address range. We could perhaps use length attributes to determine when it is safe to use DW_LNS_fixed_advance_pc.
This can handle any delta. This takes 4+DWARF2_ADDR_SIZE bytes.
We still need to start a new row, so output a copy insn.
This can handle deltas from -10 to 234, using the current definitions of DWARF_LINE_BASE and DWARF_LINE_RANGE. This takes 1 byte.
This can handle any delta. This takes at least 4 bytes, depending on the value being encoded.
Emit debug info for the address of the end of the table.
References add_AT_flag(), generic_parameter_die(), lang_hooks_for_types::get_argument_pack_elems, lang_hooks::get_innermost_generic_args, lang_hooks::get_innermost_generic_parms, int_cst_value(), lookup_decl_die(), lookup_type_die(), template_parameter_pack_die(), and lang_hooks::types.
|
static |
Output a single entry in the pubnames table.
This logic follows gdb's method for determining the value of the flag byte.
An unusual tag. Leave the flag-byte empty.
|
static |
|
static |
Output the public names table used to speed up access to externally visible names; or the public types table used to find type definitions.
Version number for pubnames/pubtypes is independent of dwarf version.
We shouldn't see pubnames for DIEs outside of the main CU.
If we're putting types in their own .debug_types sections, the .debug_pubtypes table will still point to the compile unit (not the type unit), so we want to use the offset of the skeleton DIE (if there is one).
|
static |
Output public names and types tables if necessary.
??? Only defined by DWARF3, but emitted by Darwin for DWARF2. It shouldn't hurt to emit it always, since pure DWARF2 consumers simply won't look for the section.
|
static |
Output a range_list offset into the debug_range section. Emit a relocated reference if val_entry is NULL, otherwise, emit an indirect reference.
Referenced by size_of_aranges().
|
static |
If all code is in the text section, then the compilation unit base address defaults to DW_AT_low_pc, which is the base of the text section.
Otherwise, the compilation unit base address is zero, which allows us to use absolute addresses, and not worry about whether the target supports cross-section arithmetic.
Negative block_num stands for an index into ranges_by_label.
If we ever use add_ranges_by_labels () for a single function section, all we have to do is to take out the #if 0 above.
References dw2_asm_output_data().
|
inlinestatic |
Output a type signature.
|
static |
Output skeleton debug sections that point to the dwo file.
These attributes will be found in the full debug_info section.
Produce the skeleton compilation-unit header. This one differs enough from a normal CU header that it's better not to call output_compilation_unit header.
Build the skeleton debug_abbrev section.
|
static |
|
static |
Output the encoding of an attribute value.
|
static |
Helper function for mem_loc_descriptor. Return DW_OP_GNU_parameter_ref for DEBUG_PARAMETER_REF RTL.
|
static |
Referenced by same_die_p().
|
static |
Close an include-file CU and reopen the enclosing one.
|
inlinestatic |
Pop a declaration scope.
|
static |
POPCOUNT (const0 is DW_OP_lit0 or corresponding typed constant, const1 is DW_OP_lit1 or corresponding typed constant): const0 DW_OP_swap L1: DW_OP_dup DW_OP_bra <L2> DW_OP_dup DW_OP_rot const1 DW_OP_and DW_OP_plus DW_OP_swap const1 DW_OP_shr DW_OP_skip <L1> L2: DW_OP_drop PARITY is similar: L1: DW_OP_dup DW_OP_bra <L2> DW_OP_dup DW_OP_rot const1 DW_OP_and DW_OP_xor DW_OP_swap const1 DW_OP_shr DW_OP_skip <L1> L2: DW_OP_drop
|
static |
Mark all members of types_used_by_vars_entry as perennial.
References inlined_function_outer_scope_p().
|
static |
Helper function of premark_types_used_by_global_vars which gets called through htab_traverse. Marks the DIE of a given type in *SLOT as perennial, so it never gets marked as unused by prune_unused_types. The DIE of the type is marked only if the global variable using the type will actually be emitted.
Ask cgraph if the global variable really is to be emitted. If yes, then we'll keep the DIE of ENTRY->TYPE.
Keep the parent DIEs as well.
|
static |
Mark all members of used_types_hash as perennial.
Referenced by gen_array_type_die().
|
static |
Helper function of premark_used_types() which gets called through htab_traverse. Marks the DIE of a given type in *SLOT as perennial, so it never gets marked as unused by prune_unused_types.
|
static |
|
static |
Print the information associated with a given DIE, and its children. This routine is a debugging aid only.
|
inlinestatic |
Print a type signature in hex.
|
static |
Referenced by decl_piece_varloc_ptr().
|
inlinestatic |
Indent the line the number of spaces given by print_indent.
|
static |
Process variable DECL (or variable with origin ORIGIN) within block STMT and add it to CONTEXT_DIE.
|
static |
|
static |
Clear the marks for a die and its children. Be cool if the mark isn't set.
|
static |
Remove dies representing declarations that we never use.
All the marks should already be clear.
Mark types that are used in global variables.
Set the mark on nodes that are actually used.
Also set the mark on nodes referenced from the pubname_table. Enumerators are unusual in that they are pubnames that are the children of pubtypes. They should only be marked via their parent DW_TAG_enumeration_type die, not as roots in themselves.
Leave the marks clear.
References add_child_die(), comp_unit_die(), limbo_die_struct::created_for, get_context_die(), and scope_die_for().
|
static |
Referenced by dwarf2out_end_function().
|
static |
Mark DIE as being used. If DOKIDS is true, then walk down to DIE's children.
We haven't done this node yet. Mark it as used.
If this is the DIE of a generic type instantiation, mark the children DIEs that describe its generic parms and args.
We also have to mark its parents as used. (But we don't want to mark our parent's kids due to this, unless it is a class.)
Mark any referenced nodes.
If this node is a specification, also mark the definition, if it exists.
We need to walk the children, but haven't done so yet. Remember that we've walked the kids.
If this is an array type, we need to make sure our kids get marked, even if they're types. If we're breaking out types into comdat sections, do this for all type definitions.
|
static |
|
static |
Mark the generic parameters and arguments children DIEs of DIE.
|
static |
Referenced by dwarf2out_begin_function().
|
static |
Remove from the tree DIE any dies that aren't marked.
No marked children between 'prev' and the end of the list.
No marked children at all.
References add_comp_dir_attribute(), comp_unit_die(), file_table, and file_table_relative_p().
|
static |
Increment the string counts on strings referred to from DIE's attributes.
Avoid unnecessarily putting strings that are used less than twice in the hash table.
Referenced by dwarf2out_begin_function().
|
static |
Referenced by dwarf2out_end_function().
|
static |
Walk the tree DIE and mark types that we actually use.
Don't do anything if this node is already marked and children have been marked as well.
Finding used static member functions inside of classes is needed just for local classes, because for other classes static member function DIEs with DW_AT_specification are emitted outside of the DW_TAG_*_type. If we ever change it, we'd need to call this even for non-local classes.
It's a type node --- don't mark it.
It's a type node --- don't mark it.
Mark everything else.
Now, mark any dies referenced from here.
Mark children.
|
static |
|
static |
Given DIE that we're marking as used, find any other dies it references as attributes and mark them as used.
A reference to another DIE. Make sure that it will get emitted. If it was broken out into a comdat group, don't follow it.
Set the string's refcount to 0 so that prune_unused_types_mark accounts properly for it.
|
static |
For local classes, look if any static member functions were emitted and if so, mark them.
Mark children.
References compare_loc_operands(), dw_loc_descr_struct::dtprel, and dw_loc_descr_struct::dw_loc_next.
|
static |
Referenced by dwarf2out_vms_debug_main_pointer().
|
static |
Push a new declaration scope.
|
static |
Add OPCODE+VAL as an entry at the end of the opcode array in TABLE.
|
static |
Referenced by same_die_p().
|
static |
Start a new compilation unit DIE for an include file. OLD_UNIT is the CU for the enclosing include file, if any. BINCL_DIE is the DW_TAG_GNU_BINCL DIE that marks the start of the DIEs for this include file.
|
static |
Record SYM_NUM to record of CU in HTABLE.
|
static |
Determine what tag to use for a record type.
References add_AT_loc(), add_AT_loc_list(), convert_cfa_to_fb_loc_list(), dw_loc_list_struct::dw_loc_next, and dw_loc_list_struct::expr.
Determine whether the evaluation of EXPR references any variables or functions which aren't otherwise used (and therefore may not be output).
??? The C++ FE emits debug information for using decls, so putting gcc_unreachable here falls over. See PR31899. For now be conservative.
The call graph machinery must have finished analyzing, optimizing and gimplifying the CU by now. So if *TP has no call graph node associated to it, it means *TP will not be emitted.
|
static |
Referenced by gen_formal_parameter_die().
|
static |
Return a location descriptor that designates a machine register or zero if there is none.
We only use "frame base" when we're sure we're talking about the post-prologue local stack frame. We do this by *not* running register elimination until this point, and recognizing the special argument pointer and soft frame pointer rtx's. Use DW_OP_fbreg offset DW_OP_stack_value in this case.
References add_loc_descr(), base_type_for_mode(), compare_loc_descriptor(), dw_val_struct::dw_val_struct_union::dw_val_die_union::die, dw_loc_descr_struct::dw_loc_oprnd1, dw_val_class_die_ref, dw_val_struct::dw_val_struct_union::dw_val_die_union::external, mem_loc_descriptor(), new_loc_descr(), shift, dw_val_struct::v, dw_val_struct::val_class, dw_val_struct::dw_val_struct_union::val_die_ref, and VAR_INIT_STATUS_INITIALIZED.
|
static |
|
static |
Remove an entry from the addr table by decrementing its refcount. Strictly, decrementing the refcount would be enough, but the assertion that the entry is actually in the table has found bugs.
After an index is assigned, the table is frozen.
|
static |
Referenced by dwarf2out_init(), and gen_array_type_die().
|
static |
Remove the specified attribute if present.
vec::ordered_remove should help reduce the number of abbrevs that are needed.
References decl_die_table, and die_struct::decl_id.
|
static |
Remove the CHILD DIE from its parent, possibly replacing it with a cloned declaration. The original DIE is moved to a new compile unit so that existing references to it follow it to the new location. If any of the original DIE's descendants is a declaration, we need to replace the original DIE with a skeleton tree and move the declarations back into the skeleton tree.
Copy the declaration context to the type unit DIE. If the returned ORIG_PARENT is not NULL, the skeleton needs to be added as a child of that DIE.
If the original DIE was a specification, we need to put the skeleton under the parent DIE of the declaration. This leaves the original declaration in the tree, but it will be pruned later since there are no longer any references to it.
References AT_ref(), change_AT_die_ref(), lookup_external_ref(), set_AT_ref_external(), and external_ref::stub.
Referenced by should_move_die_to_comdat().
|
static |
Referenced by gen_array_type_die().
|
static |
Remove child DIE whose die_tag is TAG. Do nothing if no child matches TAG.
Might have removed every child.
References decl_piece_bitsize(), decl_piece_node(), and decl_piece_varloc_ptr().
|
static |
Remove CHILD from its parent. PREV must have the property that PREV->DIE_SIB == CHILD. Does not alter CHILD.
Referenced by add_AT_range_list(), break_out_includes(), contains_subprogram_definition(), and same_die_p().
|
static |
Given a location list, remove all addresses it refers to from the address_table.
|
static |
Replace OLD_CHILD with NEW_CHILD. PREV must have the property that PREV->DIE_SIB == OLD_CHILD. Does not alter OLD_CHILD.
Referenced by break_out_includes().
|
static |
Resolve DW_OP_addr and DW_AT_const_value CONST_STRING arguments to an address in .rodata section if the string literal is emitted there, or remove the containing location list or replace DW_AT_const_value with DW_AT_location and empty location expression, if it isn't found in .rodata. Similarly for SYMBOL_REFs, keep only those that refer to something that has been emitted in the current CU.
The same list can be referenced more than once. See if we have already recorded the result from a previous pass.
As things stand, we do not expect or allow one die to reference a suffix of another die's location list chain. References must be identical or completely separate. There is therefore no need to cache the result of this pass on any list other than the first; doing so would lead to unnecessary writes.
For -gdwarf-2 don't attempt to optimize DW_AT_data_member_location containing DW_OP_plus_uconst - older consumers might rely on it being that op instead of a more complex, but shorter, location description.
|
static |
Helper function for resolve_addr, handle one location expression, return false if at least one CONST_STRING or SYMBOL_REF in the location list couldn't be resolved.
Optimize away next DW_OP_GNU_convert after adjusting LOC's base type die reference.
Don't change integer DW_OP_GNU_convert after e.g. floating point typed stack entry.
|
static |
|
static |
Helper function for resolve_addr, attempt to resolve one CONST_STRING, return non-zero if not successful. Similarly verify that SYMBOL_REFs refer to variables emitted in the current CU.
|
static |
Walk through the list of incomplete types again, trying once more to emit full debugging info for them.
References add_AT_loc(), new_loc_descr(), and targetm.
|
static |
ROTATE (constMASK is mode mask, BITSIZE is bitsize of mode): DW_OP_over DW_OP_over DW_OP_shl [ constMASK DW_OP_and ] DW_OP_rot [ DW_OP_swap constMASK DW_OP_and DW_OP_swap ] DW_OP_neg DW_OP_plus_uconst <BITSIZE> DW_OP_shr DW_OP_or ROTATERT is similar: DW_OP_over DW_OP_over DW_OP_neg DW_OP_plus_uconst <BITSIZE> DW_OP_shl [ constMASK DW_OP_and ] DW_OP_rot [ DW_OP_swap constMASK DW_OP_and DW_OP_swap ] DW_OP_shr DW_OP_or
|
inlinestatic |
Return the result of rounding T up to ALIGN.
|
static |
Generate an RTL constant from a decl initializer INIT with decl type TYPE, for use in a later add_const_value_attribute call.
If a variable is initialized with a string constant without embedded zeros, build CONST_STRING.
Other aggregates, and complex values, could be represented using CONCAT: FIXME!
Vectors only work if their mode is supported by the target. FIXME: generic vectors ought to work too.
If the initializer is something that we know will expand into an immediate RTL constant, expand it now. We must be careful not to reference variables which won't be output.
Convert vector CONSTRUCTOR initializers to VECTOR_CST if possible.
Even when ctor is constant, it might contain non-*_CST elements (e.g. { 1.0/0.0 - 1.0/0.0, 0.0 }) and those don't belong into VECTOR_CST nodes.
FALLTHRU
If expand_expr returns a MEM, it wasn't immediate.
Referenced by insert_float().
|
static |
Generate RTL for the variable DECL to represent its location.
Here we have to decide where we are going to say the parameter "lives" (as far as the debugger is concerned). We only have a couple of choices. GCC provides us with DECL_RTL and with DECL_INCOMING_RTL. DECL_RTL normally indicates where the parameter lives during most of the activation of the function. If optimization is enabled however, this could be either NULL or else a pseudo-reg. Both of those cases indicate that the parameter doesn't really live anywhere (as far as the code generation parts of GCC are concerned) during most of the function's activation. That will happen (for example) if the parameter is never referenced within the function. We could just generate a location descriptor here for all non-NULL non-pseudo values of DECL_RTL and ignore all of the rest, but we can be a little nicer than that if we also consider DECL_INCOMING_RTL in cases where DECL_RTL is NULL or is a pseudo-reg. Note however that we can only get away with using DECL_INCOMING_RTL as a backup substitute for DECL_RTL in certain limited cases. In cases where DECL_ARG_TYPE (decl) indicates the same type as TREE_TYPE (decl), we can be sure that the parameter was passed using the same type as it is declared to have within the function, and that its DECL_INCOMING_RTL points us to a place where a value of that type is passed. In cases where DECL_ARG_TYPE (decl) and TREE_TYPE (decl) are different, we cannot (in general) use DECL_INCOMING_RTL as a substitute for DECL_RTL because in these cases DECL_INCOMING_RTL points us to a value of some type which is *different* from the type of the parameter itself. Thus, if we tried to use DECL_INCOMING_RTL to generate a location attribute in such cases, the debugger would end up (for example) trying to fetch a `float' from a place which actually contains the first part of a `double'. That would lead to really incorrect and confusing output at debug-time. So, in general, we *do not* use DECL_INCOMING_RTL as a backup for DECL_RTL in cases where DECL_ARG_TYPE (decl) != TREE_TYPE (decl). There are a couple of exceptions however. On little-endian machines we can get away with using DECL_INCOMING_RTL even when DECL_ARG_TYPE (decl) is not the same as TREE_TYPE (decl), but only when DECL_ARG_TYPE (decl) is an integral type that is smaller than TREE_TYPE (decl). These cases arise when (on a little-endian machine) a non-prototyped function has a parameter declared to be of type `short' or `char'. In such cases, TREE_TYPE (decl) will be `short' or `char', DECL_ARG_TYPE (decl) will be `int', and DECL_INCOMING_RTL will point to the lowest-order byte of the passed `int' value. If the debugger then uses that address to fetch a `short' or a `char' (on a little-endian machine) the result will be the correct data, so we allow for such exceptional cases below. Note that our goal here is to describe the place where the given formal parameter lives during most of the function's activation (i.e. between the end of the prologue and the start of the epilogue). We'll do that as best as we can. Note however that if the given formal parameter is modified sometime during the execution of the function, then a stack backtrace (at debug-time) will show the function as having been called with the *new* value rather than the value which was originally passed in. This happens rarely enough that it is not a major problem, but it *is* a problem, and I'd like to fix it. A future version of dwarf2out.c may generate two additional attributes for any given DW_TAG_formal_parameter DIE which will describe the "passed type" and the "passed location" for the given formal parameter in addition to the attributes we now generate to indicate the "declared type" and the "active location" for each parameter. This additional set of attributes could be used by debuggers for stack backtraces. Separately, note that sometimes DECL_RTL can be NULL and DECL_INCOMING_RTL can be NULL also. This happens (for example) for inlined-instances of inline function formal parameters which are never referenced. This really shouldn't be happening. All PARM_DECL nodes should get valid non-NULL DECL_INCOMING_RTL values. FIXME.
Use DECL_RTL as the "location" unless we find something better.
When generating abstract instances, ignore everything except constants, symbols living in memory, and symbols living in fixed registers.
This decl represents a formal parameter which was optimized out. Note that DECL_INCOMING_RTL may be NULL in here, but we handle all cases where (rtl == NULL_RTX) just below.
If the parm was passed in registers, but lives on the stack, then make a big endian correction if the mode of the type of the parameter is not the same as the mode of the rtl.
??? This is the same series of checks that are made in dbxout.c before we reach the big endian correction code there. It isn't clear if all of these checks are necessary here, but keeping them all is the safe thing to do.
Not passed in memory.
Not passed by invisible reference.
Big endian correction check.
If a variable is declared "register" yet is smaller than a register, then if we store the variable to memory, it looks like we're storing a register-sized value, when in fact we are not. We need to adjust the offset of the storage location to reflect the actual value's bytes, else gdb will not be able to display it.
A variable with no DECL_RTL but a DECL_INITIAL is a compile-time constant, and will have been substituted directly into all expressions that use it. C does not have such a concept, but C++ and other languages do.
If we don't look past the constant pool, we risk emitting a reference to a constant pool entry that isn't referenced from code, and thus is not emitted.
Try harder to get a rtl. If this symbol ends up not being emitted in the current CU, resolve_addr will remove the expression referencing it.
|
static |
|
static |
Do the attributes look the same?
We don't care that this was compiled with a different compiler snapshot; if the output is the same, that's what matters.
|
static |
|
static |
Do the dies look the same?
To avoid infinite recursion.
References add_child_die(), die_struct::die_child, die_struct::die_sib, die_struct::die_tag, pop_compile_unit(), push_new_compile_unit(), and remove_child_with_prev().
|
static |
|
static |
Do the dies look the same? Wrapper around same_die_p.
References die_struct::die_attr, and dw_attr_struct::dw_attr.
|
static |
|
static |
Do the values look the same?
|
static |
|
inlinestatic |
Do the location expressions look same?
|
static |
Save any strings needed by the macinfo table in the debug str table. All strings must be collected into the table by the time index_string is called.
Match the logic in output_macinfo_op to decide on indirect strings.
|
static |
|
static |
Schedule the generation of the generic parameter dies for the instance of generic type T. The proper generation itself is later done by gen_scheduled_generic_parms_dies.
References dw2_asm_output_data(), indirect_string_node::form, indirect_string_node::index, indirect_string_node::refcount, indirect_string_node::str, and strlen().
|
static |
Return location descriptor for signed comparison OP RTL.
For eq/ne, if the operands are known to be zero-extended, there is no need to do the fancy shifting up.
deref_size zero extends, and for constants we can check whether they are zero extended or not.
EQ/NE comparison against constant in narrower type than DWARF2_ADDR_SIZE can be performed either as DW_OP_const1u <shift> DW_OP_shl DW_OP_const* <cst << shift> DW_OP_{eq,ne} or DW_OP_const*u <mode_mask> DW_OP_and DW_OP_const* <cst & mode_mask> DW_OP_{eq,ne}. Pick whatever is shorter.
References add_loc_descr(), base_type_for_mode(), dw_val_struct::dw_val_struct_union::dw_val_die_union::die, dw_loc_descr_struct::dw_loc_oprnd1, dw_val_class_die_ref, dw_val_struct::dw_val_struct_union::dw_val_die_union::external, mem_loc_descriptor(), new_loc_descr(), subreg_lowpart_p(), targetm, dw_val_struct::v, dw_val_struct::val_class, and dw_val_struct::dw_val_struct_union::val_die_ref.
|
static |
Referenced by add_bit_offset_attribute(), add_gnat_descriptive_type_attribute(), and prune_unused_types().
|
static |
Return the DIE for the scope that immediately contains this type. Non-named types that do not involve a function-local type get global scope. Named types nested in namespaces or other types get their containing scope. All other types (i.e. function-local named types) get the current active scope.
Non-types always go in the current scope.
Use the scope of the typedef, rather than the scope of the type it refers to.
Use the containing namespace if there is one.
OK
Ignore function type "scopes" from the C frontend. They mean that a tagged type is local to a parmlist of a function declarator, but that isn't useful to DWARF.
If T uses a local type keep it local as well, to avoid references to function-local DIEs from outside the function.
For types, we can just look up the appropriate DIE.
References set_block_origin_self().
|
static |
We need to figure out what section we should use as the base for the address ranges where a given location is valid. 1. If this particular DECL has a section associated with it, use that. 2. If this function has a section associated with it, use that. 3. Otherwise, use the text section. XXX: If you split a variable across multiple sections, we won't notice.
|
inlinestatic |
Referenced by remove_child_or_replace_with_skeleton().
|
inlinestatic |
|
static |
Given a pointer to some BLOCK node, and a boolean value to set the "abstract" flags to, set that value into the BLOCK_ABSTRACT flag for the given block, and for all local decls and all local sub-blocks (recursively) which are contained therein.
Referenced by local_scope_p().
|
static |
Given a pointer to some BLOCK node, if the BLOCK_ABSTRACT_ORIGIN for the given BLOCK node is NULL, set the BLOCK_ABSTRACT_ORIGIN for the node so that it points to the node itself, thus indicating that the node is its own (abstract) origin. Additionally, if the BLOCK_ABSTRACT_ORIGIN for the given node is NULL, recursively descend the decl/block tree which it is the root of, and for each other ..._DECL or BLOCK node contained therein whose DECL_ABSTRACT_ORIGINs or BLOCK_ABSTRACT_ORIGINs are also still NULL, set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN values to point to themselves.
Referenced by scope_die_for().
|
static |
|
static |
Lookup the "current" table into which we emit line info, so that we don't have to do it for every source line.
|
static |
|
static |
Given a pointer to some ..._DECL node, and a boolean value to set the "abstract" flags to, set that value into the DECL_ABSTRACT flag for the given decl, and (in the case where the decl is a FUNCTION_DECL) also set the abstract flags for all of the parameters, local vars, local blocks and sub-blocks (recursively) to the same setting.
|
static |
Forward declare these functions, because they are mutually recursive with their set_block_* pairing functions.
|
static |
Given a pointer to some ..._DECL node, if the DECL_ABSTRACT_ORIGIN for the given ..._DECL node is NULL, set the DECL_ABSTRACT_ORIGIN for the node to so that it points to the node itself, thus indicating that the node represents its own (abstract) origin. Additionally, if the DECL_ABSTRACT_ORIGIN for the given node is NULL, recursively descend the decl/block tree of which the given node is the root of, and for each other ..._DECL or BLOCK node contained therein whose DECL_ABSTRACT_ORIGINs or BLOCK_ABSTRACT_ORIGINs are also still NULL, set *their* DECL_ABSTRACT_ORIGIN or BLOCK_ABSTRACT_ORIGIN values to point to themselves.
References dw_loc_descr_struct::dw_loc_oprnd1, dw_loc_list_struct::expr, plus_constant(), dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_addr.
|
static |
Call this function directly to bypass AT_string_form's logic to put the string inline in the die.
Already indirect is a no op.
Referenced by dwarf2out_decl().
|
static |
|
static |
Force out any required namespaces to be able to output DECL, and return the new context_die for it, if it's changed.
Force out the namespace.
|
static |
|
static |
Referenced by should_move_die_to_comdat().
|
static |
Return non-zero if this is a type DIE that should be moved to a COMDAT .debug_types section.
Don't move declarations, inlined instances, or types nested in a subprogram.
A type definition should never contain a subprogram definition.
References add_AT_unsigned(), break_out_comdat_types(), comdat_type_list, comp_unit_die(), die_struct::die_child, die_struct::die_sib, first, generate_type_signature(), get_AT_unsigned(), new_die(), comdat_type_struct::next, remove_child_or_replace_with_skeleton(), comdat_type_struct::root_die, should_move_die_to_comdat(), and comdat_type_struct::skeleton_die.
|
static |
|
inlinestatic |
References get_address_mode().
|
static |
|
inlinestatic |
Given a pointer to a tree node, return the alignment in bits for it, or else return BITS_PER_WORD if the node actually turns out to be an ERROR_MARK node.
|
static |
Referenced by add_bit_offset_attribute(), and fortran_common().
|
inlinestatic |
Given a pointer to a tree node, assumed to be some kind of a ..._TYPE node, return the size in bits for the type if it is a constant, or else return the alignment for the type if the type's size is not constant, or else return BITS_PER_WORD if the type actually turns out to be an ERROR_MARK node.
|
static |
Return if the loc_list has only single element and thus can be represented as location description.
Referenced by loc_list_from_tree().
|
static |
Return the size of the information in the .debug_aranges section.
Count the address/length pair for this compilation unit.
Count the two zero words used to terminated the address range table.
References AT_int(), AT_loc(), AT_unsigned(), constant_size(), dw2_asm_output_data(), dw2_asm_output_data_sleb128(), dw2_asm_output_data_uleb128(), dw_attr_struct::dw_attr, dw_attr_struct::dw_attr_val, dw_val_class_addr, dw_val_class_const, dw_val_class_loc, dw_val_class_offset, dw_val_class_range_list, dw_val_class_unsigned_const, output_attr_index_or_value(), output_loc_sequence(), output_range_list_offset(), size_of_locs(), dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_offset.
|
static |
Referenced by copy_decls_for_unworthy_types().
|
static |
Return the size of a DIE as it is represented in the .debug_info section.
Block length.
Currently all add_AT_flag calls pass in 1 as last argument, so DW_FORM_flag_present can be used. If that ever changes, we'll need to use DW_FORM_flag and have some optimization in build_abbrev_table that will change those to DW_FORM_flag_present if it is set to 1 in all DIEs using the same abbrev entry.
In DWARF4, we use DW_FORM_ref_sig8; for earlier versions we use DW_FORM_ref_addr. In DWARF2, DW_FORM_ref_addr is sized by target address length, whereas in DWARF3 it's always sized as an offset.
|
static |
Referenced by modified_type_die().
|
static |
Return size_of_locs (int_loc_descriptor (i)) without actually allocating it.
|
static |
Return size_of_locs (int_shift_loc_descriptor (i, shift)) without actually allocating it.
|
static |
Return the size of a location descriptor.
unsigned long size_of_locs | ( | ) |
Return the size of a series of location descriptors.
If there are no skip or bra opcodes, don't fill in the dw_loc_addr field, to avoid writing to a PCH file.
Referenced by clone_tree_hash(), and size_of_aranges().
|
static |
|
static |
Return the size of the .debug_pubnames or .debug_pubtypes table generated for the compilation unit.
References AT_class(), die_struct::comdat_type_p, die_struct::die_abbrev, die_struct::die_attr, die_struct::die_id, die_struct::die_offset, die_struct::die_symbol_or_type_node::die_symbol, die_struct::die_tag, dw2_asm_output_data_uleb128(), dw_attr_struct::dw_attr, dwarf_attr_name(), dwarf_tag_name(), and output_die_symbol().
|
static |
|
static |
Move CHILD, which must be a child of PARENT or the DIE for which PARENT is the specification, to the end of PARENT's list of children. This is done by removing and re-adding it.
We want the declaration DIE from inside the class, not the specification DIE at toplevel.
|
static |
For STRING_CST, return SYMBOL_REF of its constant pool entry, if possible, and create DW_TAG_dwarf_procedure that can be referenced from DW_OP_GNU_implicit_pointer if the string hasn't been seen yet.
|
static |
Referenced by gen_inlined_subroutine_die(), and get_AT_flag().
|
inlinestatic |
Given a TYPE_DIE representing the type TYPE, if TYPE is an anonymous type named by the typedef TYPE_DIE, return the DIE of the anonymous type instead the one of the naming typedef.
References construct_piece_list(), var_loc_list_def::first, var_loc_list_def::last, var_loc_node::loc, and var_loc_node::next.
|
static |
Forward declarations for functions defined in this file.
|
inlinestatic |
Return a pointer to a copy of the section string name S with all attributes stripped off, and an asterisk prepended (for assemble_name).
|
static |
|
static |
Given a pointer to a tree node for a subrange type, return a pointer to a DIE that describes the given type.
The size of the subrange type and its base type do not match, so we need to generate a size attribute for the subrange type.
|
static |
Switch [BACK] to eh_frame_section. If we don't have an eh_frame_section, switch to the data section instead, and write out a synthetic start label for collect2 the first time around.
We have no special eh_frame section. Put the information in the data section and emit special labels to guide collect2.
|
static |
Switch [BACK] to the eh or debug frame table section, depending on FOR_EH.
|
static |
Generate and return a DW_TAG_GNU_template_parameter_pack DIE representing. PARM_PACK must be a template parameter pack. The returned DIE will be child DIE of PARENT_DIE.
Referenced by output_one_line_info_table().
|
static |
Try to handle TLS MEMs, for which mem_loc_descriptor on XEXP (mem, 0) failed.
|
static |
|
static |
Attach a DW_AT_const_value attribute to DIE. The value of the attribute is the const value T.
If the host and target are sane, try harder.
|
static |
|
static |
Attach a DW_AT_const_value attribute to VAR_DIE. The value of the attribute is the const value of T, where T is an integral constant variable with static storage duration (so it can't be a PARM_DECL or a RESULT_DECL).
OK
Don't add DW_AT_const_value if abstract origin already has one.
References comp_unit_die(), current_function_decl, and uses_local_type().
|
static |
|
inlinestatic |
Given a pointer to an arbitrary ..._TYPE tree node, return true if it is an enumerated type.
|
inlinestatic |
Return a reference to a type, with its const and volatile qualifiers removed.
??? There really should be only one main variant among any group of variants of a given type (and all of the MAIN_VARIANT values for all members of the group should point to that one type) but sometimes the C front-end messes this up for array types, so we work around that bug here.
|
static |
Referenced by add_gnat_descriptive_type_attribute().
|
static |
Given a tree pointer to a struct, class, union, or enum type node, return a pointer to the (string) tag name for the given type, or zero if the type was declared without a tag.
Find the IDENTIFIER_NODE for the type name.
The g++ front end makes the TYPE_NAME of *each* tagged type point to a TYPE_DECL node, regardless of whether or not a `typedef' was involved.
We want to be extra verbose. Don't call dwarf_name if DECL_NAME isn't set. The default hook for decl_printable_name doesn't like that, and in this context it's correct to return 0, instead of "<anonymous>" or the like.
Now get the name as a string, or invent one.
|
static |
Helper function for mem_loc_descriptor. Perform OP binary op, but after converting arguments to type_die, afterwards convert back to unsigned.
References targetm.
Referenced by bswap_loc_descriptor().
|
static |
Return location descriptor for unsigned comparison OP RTL.
deref_size zero extends, so no need to mask it again.
deref_size zero extends, so no need to mask it again.
|
static |
|
static |
Clear the marks for a die, its children and referred dies.
References AT_loc_list(), dw2_asm_output_delta(), dw2_asm_output_offset(), dw_attr_struct::dw_attr, dwarf_attr_name(), and dw_loc_list_struct::ll_symbol.
|
static |
Referenced by copy_ancestor_tree().
|
static |
Clear the marks for a die and its children.
References dw2_asm_output_offset(), dw_attr_struct::dw_attr_val, HOST_WIDE_INT_PRINT_HEX, dw_val_struct::v, and dw_val_struct::dw_val_struct_union::val_offset.
|
static |
If TYPE involves a function-local type (including a local typedef to a non-local type), returns that type; otherwise returns NULL_TREE.
Referenced by tree_add_const_value_attribute_for_decl().
|
static |
walk_tree helper function for uses_local_type, below.
|
static |
|
static |
Select the encoding of an attribute value.
Only very few attributes allow DW_FORM_addr.
FALLTHRU
In DWARF3 DW_AT_data_member_location with DW_FORM_data4 or DW_FORM_data8 is a loclistptr, not constant, so we need to use DW_FORM_udata if we need a large constant.
Currently all add_AT_flag calls pass in 1 as last argument, so DW_FORM_flag_present can be used. If that ever changes, we'll need to use DW_FORM_flag and have some optimization in build_abbrev_table that will change those to DW_FORM_flag_present if it is set to 1 in all DIEs using the same abbrev entry.
|
static |
Note in all location lists that text section has changed.
|
static |
Note in one location list that text section has changed.
References die_struct::die_parent, die_struct::die_perennial_p, and die_struct::die_tag.
|
static |
Verify that all marks are clear.
int vms_file_stats_name | ( | const char * | , |
long long * | , | ||
long * | , | ||
char * | , | ||
int * | |||
) |
Return VMS file date, size, format, version given a name.
Allocate and initialize a FAB and NAM structures.
Validate filespec syntax and device existence.
Find matching filespec.
Get the device name and assign an IO channel.
Initialize the FIB and fill in the directory id field.
Open and close the file to fill in the attributes.
Deassign the channel and exit.
Allocate and initialize a FAB and NAM structures.
Validate filespec syntax and device existence.
Find matching filespec.
Get the device name and assign an IO channel.
Initialize the FIB and fill in the directory id field.
Open and close the file to fill in the attributes.
Deassign the channel and exit.
|
inlinestatic |
Whether to generate the DWARF accelerator tables in .debug_pubnames and .debug_pubtypes. This is configured per-target, but can be overridden by the -gpubnames or -gno-pubnames options.
References dw2_asm_output_addr(), dw2_asm_output_delta(), dw_fde_struct::dw_fde_begin, and dw_fde_struct::dw_fde_end.
Referenced by output_loc_list().
|
static |
A pointer to the base of a list of references to DIE's that are uniquely identified by their tag, presence/absence of children DIE's, and list of attribute/value pairs.
|
static |
Number of elements currently allocated for abbrev_die_table.
|
static |
Number of elements in type_die_table currently in use.
|
static |
|
static |
Table of entries into the .debug_addr section.
|
static |
|
static |
Vector mapping block numbers to DW_TAG_{lexical_block,inlined_subroutine} DIEs.
Referenced by member_declared_type().
|
static |
Table of cached location lists.
|
static |
|
static |
|
static |
Head and tail of call_arg_loc chain.
|
static |
Number of call sites in the current function.
|
static |
|
static |
The default cold text section.
|
static |
|
static |
|
static |
|
static |
The prefix to attach to symbols on DIEs in the current comdat debug info section.
|
static |
The index of the current symbol within the current comdat CU.
|
static |
A list of type DIEs that have been separated into comdat sections.
Referenced by should_move_die_to_comdat().
|
static |
A hash table of references to DIE's that describe COMMON blocks. The key is DECL_UID() ^ die_parent.
|
static |
The current table to which we should emit line number information for the current function. This will be set up at the beginning of assembly for the function.
|
static |
Record whether the function being analyzed contains inlined functions.
|
static |
Personality decl of current unit. Used only when assembler does not support personality CFI.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Pointers to various DWARF2 sections.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
A hash table of references to DIE's that describe declarations. The key is a DECL_UID() which is a unique number identifying each decl.
Referenced by remove_AT().
|
static |
Table of decl location linked lists.
Referenced by gen_namespace_die().
A pointer to the base of a table of references to declaration scopes. This table is a display which tracks the nesting of declaration scopes at the current scope and containing scopes. This table is used to find the proper place to define type declaration DIE's.
|
static |
A list of DIEs for which we may have to generate DW_AT_{,MIPS_}linkage_name once their DECL_ASSEMBLER_NAMEs are set.
|
static |
|
static |
We allow a language front-end to designate a function that is to be called to "demangle" any name before it is put into a DIE.
|
static |
struct gcc_debug_hooks dwarf2_debug_hooks |
The debug hooks structure.
Referenced by vmsdbgout_begin_epilogue(), vmsdbgout_begin_prologue(), vmsdbgout_end_source_file(), vmsdbgout_init(), and vmsdbgout_start_source_file().
|
static |
Referenced by fde_needed_for_eh_p().
|
static |
Filenames referenced by this compilation unit.
Referenced by add_pubtype(), and prune_unused_types_prune().
|
static |
Cached result of previous call to lookup_filename.
|
static |
One above highest N where .LVLN label might be equal to .Ltext0 label.
Referenced by declare_in_namespace().
|
static |
Offset from the "steady-state frame pointer" to the frame base, within the current function.
|
static |
Instances of generic types for which we need to generate debug info that describe their generic parameters and arguments. That generation needs to happen once all types are properly laid out so we do it at the end of compilation.
|
static |
Whether we have location lists that need outputting
|
static |
True if the compilation unit places functions in more than one section.
Referenced by declare_in_namespace(), decls_for_scope(), and gen_namespace_die().
|
static |
True if before or during processing of the first function being emitted.
A pointer to the base of a list of incomplete types which might be completed at some later time. incomplete_types_list needs to be a vec<tree, va_gc> *because we want to tell the garbage collector about it.
|
static |
A flag to tell pubnames/types export if there is an info section to refer to.
|
static |
Number of internal labels generated by gen_internal_sym().
|
static |
The last file entry emitted by maybe_emit_file().
|
static |
|
static |
A list of DIEs with a NULL parent waiting to be relocated.
Referenced by get_die_parent().
|
static |
A global counter for generating labels for line number data.
|
static |
|
static |
Unique label counter.
Referenced by is_redundant_typedef().
|
static |
|
static |
A pointer to the base of a table that contains a list of macro defines/undefines (and file start/end markers).
|
static |
True if loc_note during dwarf2out_var_location call might still be before first real instruction at address equal to .Ltext0.
|
static |
This location is used by calc_die_sizes() to keep track the offset of each DIE within the .debug_info section.
Referenced by copy_decls_for_unworthy_types().
|
static |
Unique label counter for point-of-call tables.
|
static |
Keep track of the number of spaces used to indent the output of the debugging routines that print the structure of the DIE internal representation.
|
static |
|
static |
A pointer to the base of a table that contains a list of publicly accessible names.
|
static |
A pointer to the base of a table that contains a list of publicly accessible types.
|
static |
Array of pairs of labels referenced in ranges_table.
|
static |
Number of elements currently allocated for ranges_by_label.
|
static |
Number of elements in ranges_by_label currently in use.
Referenced by get_skeleton_type_unit().
|
static |
|
static |
Array of dies for which we should generate .debug_ranges info.
|
static |
Number of elements currently allocated for ranges_table.
|
static |
Number of elements in ranges_table currently in use.
|
static |
The set of all non-default tables of line number info.
|
static |
Record the root of the DIE's built for the current compilation unit.
Referenced by dw_addr_op().
|
static |
With split_debug_info, both the comp_dir and dwo_name go in the main object file, rather than the dwo, similar to the force_direct parameter elsewhere but with additional complications: 1) The string is needed in both the main object file and the dwo. That is, the comp_dir and dwo_name will appear in both places. 2) Strings can use three forms: DW_FORM_string, DW_FORM_strp or DW_FORM_GNU_str_index. 3) GCC chooses the form to use late, depending on the size and reference count. Rather than forcing the all debug string handling functions and callers to deal with these complications, simply use a separate, special-cased string table for any attribute that should go in the main object file. This limits the complexity to just the places that need it.
|
static |
Number of tail call sites in the current function.
|
static |
Definitions of defaults for formats and names of various special (artificial) labels which may be generated within this file (when the -g options is used and DWARF2_DEBUGGING_INFO is in effect. If necessary, these may be overridden from within the tm.h file, but typically, overriding these defaults is unnecessary.
|
static |
|
static |
The two default tables of line number info.
|
static |
Whether the default text and cold text sections have been used at all.
Referenced by move_linkage_attr().
|
static |