summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-17 17:48:59 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-17 17:48:59 +0000
commit023dc49317aa097a7ace023b84c0ba6be2996107 (patch)
treeb68edd62ac1d5ba91c115def3f86a0fc35e308d2
parentf6875e9cc74abd2ec3b000074accd89b2b7f53d7 (diff)
downloadppe42-gcc-023dc49317aa097a7ace023b84c0ba6be2996107.tar.gz
ppe42-gcc-023dc49317aa097a7ace023b84c0ba6be2996107.zip
2003-11-17 Scott Snyder <snyder@fnal.gov>
PR debug/11325 * dwarf2out.c (struct die_struct): Add die_definition field. (add_AT_specification): New. (gen_subprogram_die, gen_variable_die, gen_struct_or_union_type_die): Use it. (prune_unused_types_mark): If we're marking a forward declaration, also mark the full definition, if it exists. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73676 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/dwarf2out.c25
2 files changed, 32 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index be235d9c818..8ab81d74641 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2003-11-17 Scott Snyder <snyder@fnal.gov>
+
+ PR debug/11325
+ * dwarf2out.c (struct die_struct): Add die_definition field.
+ (add_AT_specification): New.
+ (gen_subprogram_die, gen_variable_die,
+ gen_struct_or_union_type_die): Use it.
+ (prune_unused_types_mark): If we're marking a forward declaration,
+ also mark the full definition, if it exists.
+
2003-11-16 Nick Clifton <nickc@redhat.com>
* config/stormy16/stormy16.h (BUILD_VA_LIST_TYPE): Delete.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 85e2d321ee7..7db16217b52 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3332,6 +3332,7 @@ typedef struct die_struct GTY(())
dw_die_ref die_parent;
dw_die_ref die_child;
dw_die_ref die_sib;
+ dw_die_ref die_definition; /* ref from a specification to its definition */
dw_offset die_offset;
unsigned long die_abbrev;
int die_mark;
@@ -3599,6 +3600,7 @@ static void add_AT_string (dw_die_ref, enum dwarf_attribute, const char *);
static inline const char *AT_string (dw_attr_ref);
static int AT_string_form (dw_attr_ref);
static void add_AT_die_ref (dw_die_ref, enum dwarf_attribute, dw_die_ref);
+static void add_AT_specification (dw_die_ref, dw_die_ref);
static inline dw_die_ref AT_ref (dw_attr_ref);
static inline int AT_ref_external (dw_attr_ref);
static inline void set_AT_ref_external (dw_attr_ref, int);
@@ -4664,6 +4666,18 @@ add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_
add_dwarf_attr (die, attr);
}
+/* Add an AT_specification attribute to a DIE, and also make the back
+ pointer from the specification to the definition. */
+
+static inline void
+add_AT_specification (dw_die_ref die, dw_die_ref targ_die)
+{
+ add_AT_die_ref (die, DW_AT_specification, targ_die);
+ if (targ_die->die_definition)
+ abort ();
+ targ_die->die_definition = die;
+}
+
static inline dw_die_ref
AT_ref (dw_attr_ref a)
{
@@ -10629,7 +10643,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
else
{
subr_die = new_die (DW_TAG_subprogram, context_die, decl);
- add_AT_die_ref (subr_die, DW_AT_specification, old_die);
+ add_AT_specification (subr_die, old_die);
if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index)
add_AT_unsigned (subr_die, DW_AT_decl_file, file_index);
if (get_AT_unsigned (old_die, DW_AT_decl_line)
@@ -10849,7 +10863,7 @@ gen_variable_die (tree decl, dw_die_ref context_die)
&& get_AT_flag (old_die, DW_AT_declaration) == 1)
{
/* This is a definition of a C++ class level static. */
- add_AT_die_ref (var_die, DW_AT_specification, old_die);
+ add_AT_specification (var_die, old_die);
if (DECL_NAME (decl))
{
unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl));
@@ -11295,7 +11309,7 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die)
scope_die, type);
equate_type_number_to_die (type, type_die);
if (old_die)
- add_AT_die_ref (type_die, DW_AT_specification, old_die);
+ add_AT_specification (type_die, old_die);
else
add_name_attribute (type_die, type_tag (type));
}
@@ -12504,6 +12518,11 @@ prune_unused_types_mark (dw_die_ref die, int dokids)
/* Mark any referenced nodes. */
prune_unused_types_walk_attribs (die);
+
+ /* If this node is a specification,
+ also mark the definition, if it exists. */
+ if (get_AT_flag (die, DW_AT_declaration) && die->die_definition)
+ prune_unused_types_mark (die->die_definition, 1);
}
if (dokids && die->die_mark != 2)
OpenPOWER on IntegriCloud