diff options
author | Pierre-Marie de Rodat <derodat@adacore.com> | 2015-06-11 12:40:10 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2015-06-11 12:40:10 +0000 |
commit | 881a5e608a945bebcfbefcf8c521a2e481610789 (patch) | |
tree | f7c9d03a32db11d1b9f07488e40eac40beba11a8 /gcc/dwarf2out.c | |
parent | f13c4673a54c76a1c92018d630f48126349732b0 (diff) | |
download | gcc-881a5e608a945bebcfbefcf8c521a2e481610789.zip gcc-881a5e608a945bebcfbefcf8c521a2e481610789.tar.gz gcc-881a5e608a945bebcfbefcf8c521a2e481610789.tar.bz2 |
Restore DW_AT_abstract_origin for cross-unit call sites
PR debug/66503
gcc/ChangeLog:
* debug.h (struct gcc_debug_hooks): Add a
register_main_translation_unit hook.
* debug.c (do_nothing_debug_hooks): Provide a function for this
new hook.
* dbxout.c (dbx_debug_hooks): Likewise.
* sdbout.c (sdb_debug_hooks): Likewise.
* vmsdbgout.c (vmsdbg_debug_hooks): Likewise.
* dwarf2out.c (main_translation_unit): New global variable.
(dwarf2out_register_main_translation_unit): New function
implementing the new hook.
(dwarf2_debug_hooks): Assign
dwarf2out_register_main_translation_unit to this new hook.
(dwarf2out_init): Associate any main translation unit to
comp_unit_die ().
* c/c-decl.c (pop_scope): Register the main translation unit
through the new debug hook.
* cp/decl.c (cxx_init_decl_processing): Likewise.
gcc/ada/ChangeLog:
* gcc-interface/utils.c (get_global_context): Register the main
translation unit through the new debug hook.
gcc/fortran/ChangeLog:
* f95-lang.c (gfc_create_decls): Register the main translation
unit through the new debug hook.
From-SVN: r224371
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ee2bcb1..8a36fe8 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2446,6 +2446,7 @@ static void dwarf2out_abstract_function (tree); static void dwarf2out_var_location (rtx_insn *); static void dwarf2out_begin_function (tree); static void dwarf2out_end_function (unsigned int); +static void dwarf2out_register_main_translation_unit (tree unit); static void dwarf2out_set_name (tree, tree); /* The debug hooks structure. */ @@ -2475,6 +2476,7 @@ const struct gcc_debug_hooks dwarf2_debug_hooks = dwarf2out_end_epilogue, dwarf2out_begin_function, dwarf2out_end_function, /* end_function */ + dwarf2out_register_main_translation_unit, dwarf2out_function_decl, /* function_decl */ dwarf2out_early_global_decl, dwarf2out_late_global_decl, @@ -22505,6 +22507,26 @@ dwarf2out_end_function (unsigned int) maybe_at_text_label_p = false; } +/* Temporary holder for dwarf2out_register_main_translation_unit. Used to let + front-ends register a translation unit even before dwarf2out_init is + called. */ +static tree main_translation_unit = NULL_TREE; + +/* Hook called by front-ends after they built their main translation unit. + Associate comp_unit_die to UNIT. */ + +static void +dwarf2out_register_main_translation_unit (tree unit) +{ + gcc_assert (TREE_CODE (unit) == TRANSLATION_UNIT_DECL + && main_translation_unit == NULL_TREE); + main_translation_unit = unit; + /* If dwarf2out_init has not been called yet, it will perform the association + itself looking at main_translation_unit. */ + if (decl_die_table != NULL) + equate_decl_number_to_die (unit, comp_unit_die ()); +} + /* Add OPCODE+VAL as an entry at the end of the opcode array in TABLE. */ static void @@ -23242,6 +23264,11 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED) /* Make sure the line number table for .text always exists. */ text_section_line_info = new_line_info_table (); text_section_line_info->end_label = text_end_label; + + /* If front-ends already registered a main translation unit but we were not + ready to perform the association, do this now. */ + if (main_translation_unit != NULL_TREE) + equate_decl_number_to_die (main_translation_unit, comp_unit_die ()); } /* Called before compile () starts outputtting functions, variables |