aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-03-09 20:06:18 +0000
committerTom Tromey <tromey@redhat.com>2012-03-09 20:06:18 +0000
commita48e046c37f9e3914710a4726db12ded2b9c939f (patch)
tree16fb026dc5dde406ba1c348dab8345e77b09b653 /gdb/dwarf2read.c
parent48688b3e3b5297e232403ef1c881eeecce04a935 (diff)
downloadgdb-a48e046c37f9e3914710a4726db12ded2b9c939f.zip
gdb-a48e046c37f9e3914710a4726db12ded2b9c939f.tar.gz
gdb-a48e046c37f9e3914710a4726db12ded2b9c939f.tar.bz2
* dwarf2read.c (dwarf2_attr): Avoid tail-recursive call.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 6eed8d5..9133178 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -10708,22 +10708,24 @@ set_cu_language (unsigned int lang, struct dwarf2_cu *cu)
static struct attribute *
dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu)
{
- unsigned int i;
- struct attribute *spec = NULL;
-
- for (i = 0; i < die->num_attrs; ++i)
+ for (;;)
{
- 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];
- }
+ unsigned int i;
+ struct attribute *spec = NULL;
+
+ for (i = 0; i < die->num_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);
- return dwarf2_attr (die, name, cu);
}
return NULL;