From: Doug Evans <dje@google.com>
To: Daniel Colascione <dancol@dancol.org>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: [COMMITTED PATCH] Fix infinite loop in update_enumeration_type_from_children
Date: Fri, 14 Nov 2014 00:39:00 -0000 [thread overview]
Message-ID: <21605.20309.594319.769762@ruffy2.mtv.corp.google.com> (raw)
In-Reply-To: <CADPb22QvmoHK_8B47EkBy6Y1BAa6ea71NcrqLFvBSroun-GHwA@mail.gmail.com>
Doug Evans writes:
> 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.
Committed.
2014-11-13 Doug Evans <dje@google.com>
* dwarf2read.c (update_enumeration_type_from_children): Avoid
infinite loop.
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)
prev parent reply other threads:[~2014-11-14 0:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 20:50 Daniel Colascione
2014-10-07 18:07 ` Pedro Alves
2014-10-08 5:58 ` Doug Evans
2014-11-09 22:05 ` Daniel Colascione
2014-11-12 15:52 ` Doug Evans
2014-11-14 0:39 ` Doug Evans [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=21605.20309.594319.769762@ruffy2.mtv.corp.google.com \
--to=dje@google.com \
--cc=dancol@dancol.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox