diff options
author | Pierre-Marie de Rodat <derodat@adacore.com> | 2017-06-01 14:06:37 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2017-06-01 14:06:37 +0000 |
commit | 2ded3754ad63a2eb375b34e2719303ec673cc72f (patch) | |
tree | f97bfb3229e74b8b7cb0be754b8a86319ff4f709 /gcc/dwarf2out.c | |
parent | e34fd4dc1c10ff16eebd39318d90ad6f68e15ae7 (diff) | |
download | gcc-2ded3754ad63a2eb375b34e2719303ec673cc72f.zip gcc-2ded3754ad63a2eb375b34e2719303ec673cc72f.tar.gz gcc-2ded3754ad63a2eb375b34e2719303ec673cc72f.tar.bz2 |
DWARF: add DW_AT_location for global decls with DECL_VALUE_EXPR
In GNAT, we materialize renamings that cannot be described in standard
DWARF as synthetic variables that describe how to fetch the renamed
object. Look for "___XR" in gcc/ada/exp_dbug.ads for more details about
this convention.
In order to have a location for these variables in the debug info (GDB
requires it not to discard the variable) but also to avoid allocating
runtime space for them, we make these variable hold a DECL_VALUE_EXPR
tree. However, since GCC 7, the DWARF back-end no longer generates a
DW_AT_location attribute for those. This patch is an attempt to restore
this attribute.
gcc/
* dwarf2out.c (dwarf2out_late_global_decl): Add locations for
symbols that hold a DECL_VALUE_EXPR.
gcc/testsuite/
* debug12.adb, debug12.ads: New testcase.
From-SVN: r248792
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7983f52..036d0a8 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -25545,9 +25545,10 @@ dwarf2out_late_global_decl (tree decl) { /* We get called via the symtab code invoking late_global_decl for symbols that are optimized out. Do not add locations - for those. */ + for those, except if they have a DECL_VALUE_EXPR, in which case + they are relevant for debuggers. */ varpool_node *node = varpool_node::get (decl); - if (! node || ! node->definition) + if ((! node || ! node->definition) && ! DECL_HAS_VALUE_EXPR_P (decl)) tree_add_const_value_attribute_for_decl (die, decl); else add_location_or_const_value_attribute (die, decl, false); |