diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-02-28 21:34:23 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-02-28 21:34:23 +0000 |
commit | 89f29a1bda59100cb5ca697da31039e1839d26d6 (patch) | |
tree | a1b57e26048b1bb2efd2b164a77163315bcc41ca /gcc/dwarf2out.c | |
parent | ee934637308320659497dc5e882a978c0c777160 (diff) | |
download | gcc-89f29a1bda59100cb5ca697da31039e1839d26d6.tar.gz |
PR debug/39267
* cgraph.h (varpool_output_debug_info): Remove.
* cgraphunit.c (varpool_output_debug_info): Remove.
* dwarf2out.c (deferred_locations_struct): New struct
(deferred_locations): New type.
(deferred_locations_list): New static var.
(deffer_location): New function.
(gen_variable_die): Use it.
(decls_for_scope): Output info on local static vars.
(dwarf2out_finish): Process deferred locations.
* varpool.c (varpool_output_debug_info): Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144496 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9d39a455e85..48178b7cbcb 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3405,6 +3405,17 @@ typedef const struct die_struct *const_dw_die_ref; typedef struct dw_loc_descr_struct *dw_loc_descr_ref; typedef struct dw_loc_list_struct *dw_loc_list_ref; +typedef struct deferred_locations_struct GTY(()) +{ + tree variable; + dw_die_ref die; +} deferred_locations; + +DEF_VEC_O(deferred_locations); +DEF_VEC_ALLOC_O(deferred_locations,gc); + +static GTY(()) VEC(deferred_locations, gc) *deferred_locations_list; + /* Each DIE may have a series of attribute/value pairs. Values can take on several forms. The forms that are used in this implementation are listed below. */ @@ -11858,6 +11869,17 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, tree_add_const_value_attribute (die, decl); } +/* Add VARIABLE and DIE into deferred locations list. */ + +static void +defer_location (tree variable, dw_die_ref die) +{ + deferred_locations entry; + entry.variable = variable; + entry.die = die; + VEC_safe_push (deferred_locations, gc, deferred_locations_list, &entry); +} + /* Helper function for tree_add_const_value_attribute. Natively encode initializer INIT into an array. Return true if successful. */ @@ -14054,7 +14076,11 @@ gen_variable_die (tree decl, dw_die_ref context_die) if (! declaration && ! DECL_ABSTRACT (decl)) { - add_location_or_const_value_attribute (var_die, decl, DW_AT_location); + if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl) + && !TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) + defer_location (decl, var_die); + else + add_location_or_const_value_attribute (var_die, decl, DW_AT_location); add_pubname (decl, var_die); } else @@ -14934,16 +14960,6 @@ decls_for_scope (tree stmt, dw_die_ref context_die, int depth) if (die != NULL && die->die_parent == NULL) add_child_die (context_die, die); - /* Do not produce debug information for static variables since - these might be optimized out. We are called for these later - in varpool_analyze_pending_decls. - - But *do* produce it for Fortran COMMON variables because, - even though they are static, their names can differ depending - on the scope, which we need to preserve. */ - if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl) - && !(is_fortran () && TREE_PUBLIC (decl))) - ; else if (TREE_CODE (decl) == IMPORTED_DECL) dwarf2out_imported_module_or_decl_1 (decl, DECL_NAME (decl), stmt, context_die); @@ -16443,6 +16459,7 @@ dwarf2out_finish (const char *filename) { limbo_die_node *node, *next_node; dw_die_ref die = 0; + unsigned int i; /* Add the name for the main input file now. We delayed this from dwarf2out_init to avoid complications with PCH. */ @@ -16457,6 +16474,14 @@ dwarf2out_finish (const char *filename) add_comp_dir_attribute (comp_unit_die); } + for (i = 0; i < VEC_length (deferred_locations, deferred_locations_list); i++) + { + add_location_or_const_value_attribute ( + VEC_index (deferred_locations, deferred_locations_list, i)->die, + VEC_index (deferred_locations, deferred_locations_list, i)->variable, + DW_AT_location); + } + /* 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. |