]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
DWARF: materialize subprogram renamings in Ada as imported declarations
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Nov 2015 16:59:43 +0000 (16:59 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Nov 2015 16:59:43 +0000 (16:59 +0000)
... so that debugger users can reference them instead of the renamed
subprograms.  This is in accordance with the DWARF specification: the
section 3.2.3 (Imported (or Renamed) Declaration Entities) allows
DW_TAG_imported_declaration DIEs to be used "as a general means to
rename or provide an alias for an entity regardless of the context in
which the importing declaration or the imported entity occur." (wording
from the DWARFv3 and DWARFv4 specifications, allowed in DWARFv2).

gcc/ada/ChangeLog:

* gcc-interface/utils.c (gnat_write_global_declarations): Output
debugging information for top-level imported declarations.

gcc/ChangeLog:

* dwarf2out.c (gen_decl_die): Generate DW_TAG_imported_* instead
of DW_TAG_namespace for IMPORTED_DECL declarations.  Call
dwarf2out_imported_module_or_decl_1 for all DWARF versions as
this function already takes care of checking what it can emit.

Bootstrapped, regtested and checked with GDB's testsuite on
x86_64-linux.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230821 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c
gcc/dwarf2out.c

index 8fb91521574e4fdf6fe42b0461e51d1d0a886353..d61154fdb504ba5ead76fad522d0a16837ba4d56 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-24  Pierre-Marie de Rodat  <derodat@adacore.com>
+
+       * dwarf2out.c (gen_decl_die): Generate DW_TAG_imported_* instead of
+       DW_TAG_namespace for IMPORTED_DECL declarations.  Call
+       dwarf2out_imported_module_or_decl_1 for all DWARF versions as this
+       function already takes care of checking what it can emit.
+
 2015-11-24  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
        * doc/invoke.texi (-fpic): Add the AArch64 limit.
index a83124f2cc243b616b645491458d5e2434fc20d3..e5c24418f606e82585a43b27437f76bb446da00d 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-24  Pierre-Marie de Rodat  <derodat@adacore.com>
+
+       * gcc-interface/utils.c (gnat_write_global_declarations): Output
+       debugging information for top-level imported declarations.
+
 2015-11-24  Gary Dismukes  <dismukes@adacore.com>
 
        * sem_ch3.adb, sem_type.adb, sem_ch7.adb, sem_ch9.adb, checks.adb,
index aa2fdf2405588fae12824ba0b320d328ae76e882..0016a3fa288fafd480f5ac4e18eab7c0244b734d 100644 (file)
@@ -5281,6 +5281,13 @@ gnat_write_global_declarations (void)
   FOR_EACH_VEC_SAFE_ELT (global_decls, i, iter)
     if (TREE_CODE (iter) == VAR_DECL)
       rest_of_decl_compilation (iter, true, 0);
+
+  /* Output the imported modules/declarations.  In GNAT, these are only
+     materializing subprogram.  */
+  FOR_EACH_VEC_SAFE_ELT (global_decls, i, iter)
+   if (TREE_CODE (iter) == IMPORTED_DECL && !DECL_IGNORED_P (iter))
+     debug_hooks->imported_module_or_decl (iter, DECL_NAME (iter),
+                                          DECL_CONTEXT (iter), 0);
 }
 
 /* ************************************************************************
index f184750091051d970818fc64615d8913be418227..d46a6715cf7ee9272b0ad02d2090d090036a1b2a 100644 (file)
@@ -21585,11 +21585,15 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die)
                                       context_die);
 
     case NAMESPACE_DECL:
-    case IMPORTED_DECL:
       if (dwarf_version >= 3 || !dwarf_strict)
        gen_namespace_die (decl, context_die);
       break;
 
+    case IMPORTED_DECL:
+      dwarf2out_imported_module_or_decl_1 (decl, DECL_NAME (decl),
+                                          DECL_CONTEXT (decl), context_die);
+      break;
+
     case NAMELIST_DECL:
       gen_namelist_decl (DECL_NAME (decl), context_die,
                         NAMELIST_DECL_ASSOCIATED_DECL (decl));