This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fix infinite loop in update_enumeration_type_from_children
- From: Doug Evans <dje at google dot com>
- To: Daniel Colascione <dancol at dancol dot org>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 8 Oct 2014 01:58:31 -0400
- Subject: Re: Fix infinite loop in update_enumeration_type_from_children
- Authentication-results: sourceware.org; auth=none
- References: <543300A0 dot 50705 at dancol dot org>
On Mon, Oct 6, 2014 at 4:50 PM, Daniel Colascione <dancol@dancol.org> wrote:
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 9d0ee13..d324b6d 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -13247,12 +13247,16 @@ update_enumeration_type_from_children (struct
> die_info *die,
> const gdb_byte *bytes;
> struct dwarf2_locexpr_baton *baton;
> const char *name;
> - if (child_die->tag != DW_TAG_enumerator)
> + if (child_die->tag != DW_TAG_enumerator) {
> + child_die = sibling_die (child_die);
> continue;
> + }
>
> attr = dwarf2_attr (child_die, DW_AT_const_value, cu);
> - if (attr == NULL)
> + if (attr == NULL) {
> + child_die = sibling_die (child_die);
> continue;
> + }
>
> name = dwarf2_name (child_die, cu);
> if (name == NULL)
>
Thanks for finding this.
Changing the loop to a for loop is another way to go, and arguably preferable.