mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
e34fd4dc1c
commit
2ded3754ad
|
|
@ -1,3 +1,8 @@
|
||||||
|
2017-06-01 Pierre-Marie de Rodat <derodat@adacore.com>
|
||||||
|
|
||||||
|
* dwarf2out.c (dwarf2out_late_global_decl): Add locations for
|
||||||
|
symbols that hold a DECL_VALUE_EXPR.
|
||||||
|
|
||||||
2017-06-01 Martin Jambor <mjambor@suse.cz>
|
2017-06-01 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
PR tree-optimization/80898
|
PR tree-optimization/80898
|
||||||
|
|
|
||||||
|
|
@ -25545,9 +25545,10 @@ dwarf2out_late_global_decl (tree decl)
|
||||||
{
|
{
|
||||||
/* We get called via the symtab code invoking late_global_decl
|
/* We get called via the symtab code invoking late_global_decl
|
||||||
for symbols that are optimized out. Do not add locations
|
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);
|
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);
|
tree_add_const_value_attribute_for_decl (die, decl);
|
||||||
else
|
else
|
||||||
add_location_or_const_value_attribute (die, decl, false);
|
add_location_or_const_value_attribute (die, decl, false);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
2017-06-01 Pierre-Marie de Rodat <derodat@adacore.com>
|
||||||
|
|
||||||
|
* debug12.adb, debug12.ads: New testcase.
|
||||||
|
|
||||||
2017-06-01 Martin Jambor <mjambor@suse.cz>
|
2017-06-01 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
PR tree-optimization/80898
|
PR tree-optimization/80898
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
-- { dg-options "-cargs -gdwarf-4 -fdebug-types-section -dA -margs" }
|
||||||
|
-- { dg-final { scan-assembler-times "DW_AT_location" 4 } }
|
||||||
|
|
||||||
|
package body Debug12 is
|
||||||
|
function Get_A2 return Boolean is
|
||||||
|
begin
|
||||||
|
return A2;
|
||||||
|
end Get_A2;
|
||||||
|
end Debug12;
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package Debug12 is
|
||||||
|
type Bit_Array is array (Positive range <>) of Boolean
|
||||||
|
with Pack;
|
||||||
|
A : Bit_Array := (1 .. 10 => False);
|
||||||
|
A2 : Boolean renames A (2);
|
||||||
|
|
||||||
|
function Get_A2 return Boolean;
|
||||||
|
end Debug12;
|
||||||
Loading…
Reference in New Issue