aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2014-11-13 15:43:12 -0800
committerDoug Evans <dje@google.com>2014-11-13 15:43:12 -0800
commit60f7655a4abc5baa3b8861ff896090dec2c3dcd7 (patch)
treecfd2ab312d0ab36e093773c56cea1b31c5a327f6 /gdb/dwarf2read.c
parent57494d81b631343380888b8a6ca55bf8a6110436 (diff)
downloadgdb-60f7655a4abc5baa3b8861ff896090dec2c3dcd7.zip
gdb-60f7655a4abc5baa3b8861ff896090dec2c3dcd7.tar.gz
gdb-60f7655a4abc5baa3b8861ff896090dec2c3dcd7.tar.bz2
dwarf2read.c (update_enumeration_type_from_children): Avoid infinite loop.
gdb/ChangeLog: * dwarf2read.c (update_enumeration_type_from_children): Avoid infinite loop.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ce37adf..1250bc7 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -13231,7 +13231,7 @@ update_enumeration_type_from_children (struct die_info *die,
struct dwarf2_cu *cu)
{
struct obstack obstack;
- struct die_info *child_die = die->child;
+ struct die_info *child_die;
int unsigned_enum = 1;
int flag_enum = 1;
ULONGEST mask = 0;
@@ -13240,13 +13240,16 @@ update_enumeration_type_from_children (struct die_info *die,
obstack_init (&obstack);
old_chain = make_cleanup_obstack_free (&obstack);
- while (child_die != NULL && child_die->tag)
+ for (child_die = die->child;
+ child_die != NULL && child_die->tag;
+ child_die = sibling_die (child_die))
{
struct attribute *attr;
LONGEST value;
const gdb_byte *bytes;
struct dwarf2_locexpr_baton *baton;
const char *name;
+
if (child_die->tag != DW_TAG_enumerator)
continue;
@@ -13274,7 +13277,6 @@ update_enumeration_type_from_children (struct die_info *die,
a flag type, no need to look at the rest of the enumerates. */
if (!unsigned_enum && !flag_enum)
break;
- child_die = sibling_die (child_die);
}
if (unsigned_enum)