static int die_is_declaration (struct die_info *, struct dwarf2_cu *cu);
static struct die_info *die_specification (struct die_info *die,
- struct dwarf2_cu *);
+ struct dwarf2_cu **);
static void free_line_header (struct line_header *lh);
static char *dwarf2_name (struct die_info *die, struct dwarf2_cu *);
static struct die_info *dwarf2_extension (struct die_info *die,
- struct dwarf2_cu *);
+ struct dwarf2_cu **);
static char *dwarf_tag_name (unsigned int);
static struct die_info *follow_die_ref (struct die_info *,
struct attribute *,
- struct dwarf2_cu *);
+ struct dwarf2_cu **);
/* memory allocation interface */
if (cu->language == language_cplus
|| cu->language == language_java)
{
- struct die_info *spec_die = die_specification (die, cu);
+ struct dwarf2_cu *spec_cu = cu;
+ struct die_info *spec_die = die_specification (die, &spec_cu);
/* NOTE: carlton/2004-01-23: We have to be careful in the
presence of DW_AT_specification. For example, with GCC 3.4,
if (spec_die != NULL)
{
- char *specification_prefix = determine_prefix (spec_die, cu);
+ char *specification_prefix = determine_prefix (spec_die, spec_cu);
processing_current_prefix = specification_prefix;
back_to = make_cleanup (xfree, specification_prefix);
}
determine_class_name (struct die_info *die, struct dwarf2_cu *cu)
{
struct cleanup *back_to = NULL;
- struct die_info *spec_die = die_specification (die, cu);
+ struct dwarf2_cu *spec_cu = cu;
+ struct die_info *spec_die = die_specification (die, &spec_cu);
char *new_prefix = NULL;
/* If this is the definition of a class that is declared by another
read_func_scope for a similar example. */
if (spec_die != NULL)
{
- char *specification_prefix = determine_prefix (spec_die, cu);
+ char *specification_prefix = determine_prefix (spec_die, spec_cu);
processing_current_prefix = specification_prefix;
back_to = make_cleanup (xfree, specification_prefix);
}
before. Also, add a using directive if it's an anonymous
namespace. */
- if (dwarf2_extension (die, cu) == NULL)
+ if (dwarf2_attr (die, DW_AT_extension, cu) == NULL)
{
struct type *type;
for (current_die = die;
current_die != NULL;
- current_die = dwarf2_extension (die, cu))
+ current_die = dwarf2_extension (die, &cu))
{
name = dwarf2_name (current_die, cu);
if (name != NULL)
}
if (spec)
- return dwarf2_attr (follow_die_ref (die, spec, cu), name, cu);
+ {
+ die = follow_die_ref (die, spec, &cu);
+ return dwarf2_attr (die, name, cu);
+ }
return NULL;
}
}
/* Return the die giving the specification for DIE, if there is
- one. */
+ one. *SPEC_CU is the CU containing DIE on input, and the CU
+ containing the return value on output. */
static struct die_info *
-die_specification (struct die_info *die, struct dwarf2_cu *cu)
+die_specification (struct die_info *die, struct dwarf2_cu **spec_cu)
{
- struct attribute *spec_attr = dwarf2_attr (die, DW_AT_specification, cu);
+ struct attribute *spec_attr = dwarf2_attr (die, DW_AT_specification,
+ *spec_cu);
if (spec_attr == NULL)
return NULL;
else
- return follow_die_ref (die, spec_attr, cu);
+ return follow_die_ref (die, spec_attr, spec_cu);
}
/* Free the line_header structure *LH, and any arrays and strings it
return builtin_type (gdbarch)->builtin_void;
}
else
- type_die = follow_die_ref (die, type_attr, cu);
+ type_die = follow_die_ref (die, type_attr, &cu);
type = tag_type_to_type (type_die, cu);
if (!type)
type_attr = dwarf2_attr (die, DW_AT_containing_type, cu);
if (type_attr)
{
- type_die = follow_die_ref (die, type_attr, cu);
+ type_die = follow_die_ref (die, type_attr, &cu);
type = tag_type_to_type (type_die, cu);
}
if (!type)
}
/* Return the die that this die in an extension of, or NULL if there
- is none. */
+ is none. *EXT_CU is the CU containing DIE on input, and the CU
+ containing the return value on output. */
static struct die_info *
-dwarf2_extension (struct die_info *die, struct dwarf2_cu *cu)
+dwarf2_extension (struct die_info *die, struct dwarf2_cu **ext_cu)
{
struct attribute *attr;
- attr = dwarf2_attr (die, DW_AT_extension, cu);
+ attr = dwarf2_attr (die, DW_AT_extension, *ext_cu);
if (attr == NULL)
return NULL;
- return follow_die_ref (die, attr, cu);
+ return follow_die_ref (die, attr, ext_cu);
}
/* Convert a DIE tag into its string name. */
static struct die_info *
follow_die_ref (struct die_info *src_die, struct attribute *attr,
- struct dwarf2_cu *cu)
+ struct dwarf2_cu **ref_cu)
{
struct die_info *die;
unsigned int offset;
struct die_info temp_die;
- struct dwarf2_cu *target_cu;
+ struct dwarf2_cu *target_cu, *cu = *ref_cu;
offset = dwarf2_get_ref_die_offset (attr, cu);
else
target_cu = cu;
+ *ref_cu = target_cu;
temp_die.offset = offset;
die = htab_find_with_hash (target_cu->die_hash, &temp_die, offset);
if (die)