This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix infinite loop in update_enumeration_type_from_children


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]