Commit 47fcfa7b by Scott Snyder Committed by Benjamin Kosnik

re PR debug/11325 (nested class debug info missing)


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.

From-SVN: r73676
parent 6bbb4ad3
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> 2003-11-16 Nick Clifton <nickc@redhat.com>
* config/stormy16/stormy16.h (BUILD_VA_LIST_TYPE): Delete. * config/stormy16/stormy16.h (BUILD_VA_LIST_TYPE): Delete.
......
...@@ -3332,6 +3332,7 @@ typedef struct die_struct GTY(()) ...@@ -3332,6 +3332,7 @@ typedef struct die_struct GTY(())
dw_die_ref die_parent; dw_die_ref die_parent;
dw_die_ref die_child; dw_die_ref die_child;
dw_die_ref die_sib; dw_die_ref die_sib;
dw_die_ref die_definition; /* ref from a specification to its definition */
dw_offset die_offset; dw_offset die_offset;
unsigned long die_abbrev; unsigned long die_abbrev;
int die_mark; int die_mark;
...@@ -3599,6 +3600,7 @@ static void add_AT_string (dw_die_ref, enum dwarf_attribute, const char *); ...@@ -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 inline const char *AT_string (dw_attr_ref);
static int AT_string_form (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_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 dw_die_ref AT_ref (dw_attr_ref);
static inline int AT_ref_external (dw_attr_ref); static inline int AT_ref_external (dw_attr_ref);
static inline void set_AT_ref_external (dw_attr_ref, int); 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_ ...@@ -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_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 static inline dw_die_ref
AT_ref (dw_attr_ref a) AT_ref (dw_attr_ref a)
{ {
...@@ -10629,7 +10643,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) ...@@ -10629,7 +10643,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
else else
{ {
subr_die = new_die (DW_TAG_subprogram, context_die, decl); 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) if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index)
add_AT_unsigned (subr_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) if (get_AT_unsigned (old_die, DW_AT_decl_line)
...@@ -10849,7 +10863,7 @@ gen_variable_die (tree decl, dw_die_ref context_die) ...@@ -10849,7 +10863,7 @@ gen_variable_die (tree decl, dw_die_ref context_die)
&& get_AT_flag (old_die, DW_AT_declaration) == 1) && get_AT_flag (old_die, DW_AT_declaration) == 1)
{ {
/* This is a definition of a C++ class level static. */ /* 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)) if (DECL_NAME (decl))
{ {
unsigned file_index = lookup_filename (DECL_SOURCE_FILE (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) ...@@ -11295,7 +11309,7 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die)
scope_die, type); scope_die, type);
equate_type_number_to_die (type, type_die); equate_type_number_to_die (type, type_die);
if (old_die) if (old_die)
add_AT_die_ref (type_die, DW_AT_specification, old_die); add_AT_specification (type_die, old_die);
else else
add_name_attribute (type_die, type_tag (type)); add_name_attribute (type_die, type_tag (type));
} }
...@@ -12504,6 +12518,11 @@ prune_unused_types_mark (dw_die_ref die, int dokids) ...@@ -12504,6 +12518,11 @@ prune_unused_types_mark (dw_die_ref die, int dokids)
/* Mark any referenced nodes. */ /* Mark any referenced nodes. */
prune_unused_types_walk_attribs (die); 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) if (dokids && die->die_mark != 2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment