* dwarf2read.c (dwarf2_attr): Avoid tail-recursive call.

This commit is contained in:
Tom Tromey
2012-03-09 20:06:18 +00:00
parent 48688b3e3b
commit a48e046c37
2 changed files with 19 additions and 13 deletions

View File

@ -1,3 +1,7 @@
2012-03-09 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (dwarf2_attr): Avoid tail-recursive call.
2012-03-08 Joel Brobecker <brobecker@adacore.com> 2012-03-08 Joel Brobecker <brobecker@adacore.com>
* ravenscar-sparc-thread.c (_initialize_ravenscar_sparc): Add * ravenscar-sparc-thread.c (_initialize_ravenscar_sparc): Add

View File

@ -10708,22 +10708,24 @@ set_cu_language (unsigned int lang, struct dwarf2_cu *cu)
static struct attribute * static struct attribute *
dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu) dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu)
{ {
unsigned int i; for (;;)
struct attribute *spec = NULL;
for (i = 0; i < die->num_attrs; ++i)
{ {
if (die->attrs[i].name == name) unsigned int i;
return &die->attrs[i]; struct attribute *spec = NULL;
if (die->attrs[i].name == DW_AT_specification
|| die->attrs[i].name == DW_AT_abstract_origin) for (i = 0; i < die->num_attrs; ++i)
spec = &die->attrs[i]; {
} if (die->attrs[i].name == name)
return &die->attrs[i];
if (die->attrs[i].name == DW_AT_specification
|| die->attrs[i].name == DW_AT_abstract_origin)
spec = &die->attrs[i];
}
if (!spec)
break;
if (spec)
{
die = follow_die_ref (die, spec, &cu); die = follow_die_ref (die, spec, &cu);
return dwarf2_attr (die, name, cu);
} }
return NULL; return NULL;