* dwarf2read.c (dwarf2_attr): Avoid tail-recursive call.
authorTom Tromey <tromey@redhat.com>
Fri, 9 Mar 2012 20:06:18 +0000 (20:06 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 9 Mar 2012 20:06:18 +0000 (20:06 +0000)
gdb/ChangeLog
gdb/dwarf2read.c

index cb9127cc616e0f4ba5f169da066777378617e7ec..d458636951aaa342c36a7e2b58edc5459bca131b 100644 (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>
 
        * ravenscar-sparc-thread.c (_initialize_ravenscar_sparc): Add
index 6eed8d53b08c3809c7196bc09462c1d5742e9223..91331788c9926ed6a65a8c08bdc3e4269f5c4570 100644 (file)
@@ -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;