Fix infinite loop in update_enumeration_type_from_children
Commit Message
Comments
Please see the contribution check list:
http://sourceware.org/gdb/wiki/ContributionChecklist
Thanks,
Pedro Alves
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.
On 10/08/2014 06:58 AM, Doug Evans wrote:
> Changing the loop to a for loop is another way to go, and arguably preferable.
Either way, it looks like this bug is unfixed in master. Now that I have
papers, can this patch (or an equivalent for-loop version) be committed?
On Sun, Nov 9, 2014 at 2:05 PM, Daniel Colascione <dancol@dancol.org> wrote:
> On 10/08/2014 06:58 AM, Doug Evans wrote:
>> Changing the loop to a for loop is another way to go, and arguably preferable.
>
> Either way, it looks like this bug is unfixed in master. Now that I have
> papers, can this patch (or an equivalent for-loop version) be committed?
Hi.
I kinda like the for-loop version better.
I'll get that checked in today.
@@ -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);