From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Don't let two frames with the same id end up in the frame chain. (Re: [PATCH 1/2] avoid infinite loop with bad debuginfo)
Date: Thu, 21 Nov 2013 00:33:00 -0000 [thread overview]
Message-ID: <871u2aixbc.fsf@fleche.redhat.com> (raw)
In-Reply-To: <528CFEDE.1040505@redhat.com> (Pedro Alves's message of "Wed, 20 Nov 2013 18:26:38 +0000")
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Tom> Really not looking forward to writing the test.
Pedro> Yeah, me neither. :-P
Well, I took at stab at it today, and totally failed.
I will try to catch you on irc tomorrow to pick your brain, if that's ok
with you, to try to understand how I could get a test case.
Pedro> Subject: Don't let two frames with the same id end up in the frame chain.
Pedro> The UNWIND_SAME_ID check is done between THIS_FRAME and the next
Pedro> frame. But at this point, it's already too late -- we ended up with
Pedro> two frames with the same ID in the frame chain. Each frame having its
Pedro> own ID is an invariant assumed throughout GDB. So this patch applies
Pedro> the UNWIND_SAME_ID detection earlier, right after the previous frame
Pedro> is unwond, discarding the dup frame if a cycle is detected.
s/unwond/unwound/
FWIW I have nearly the identical patch here :)
I think it's a good idea.
I also have the appended, which makes the frame stash behave a little
nicer if an unwinder gives a duplicate frame id. Probably not needed in
addition to the patch you sent, but on the other hand, cheap.
Tom
diff --git a/gdb/frame.c b/gdb/frame.c
index 63f20d5..dd419c9 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -203,7 +203,13 @@ frame_stash_add (struct frame_info *frame)
slot = (struct frame_info **) htab_find_slot (frame_stash,
frame,
INSERT);
- *slot = frame;
+
+ /* While it is invalid for two frames to have the same ID, it
+ may happen due to a bug elsewhere in gdb. And, should this
+ happen, it is better for the frame stash to return the newer
+ frame. So, ignore duplicates here. */
+ if (*slot == NULL)
+ *slot = frame;
}
}
next prev parent reply other threads:[~2013-11-20 21:21 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 20:51 [PATCH 0/2] fix multi-threaded unwinding on AArch64 Tom Tromey
2013-11-13 20:51 ` [PATCH 2/2] handle an unspecified return address column Tom Tromey
2013-11-22 18:22 ` Tom Tromey
2013-11-26 13:55 ` Joel Brobecker
2013-11-26 14:30 ` Mark Kettenis
2013-11-26 14:37 ` Joel Brobecker
2013-11-26 14:41 ` Mark Kettenis
2013-11-26 14:42 ` Joel Brobecker
2013-11-26 14:50 ` Tom Tromey
2013-11-26 15:05 ` Tom Tromey
2013-11-26 15:16 ` Tom Tromey
2013-11-26 16:11 ` Joel Brobecker
2013-11-13 22:03 ` [PATCH 1/2] avoid infinite loop with bad debuginfo Tom Tromey
2013-11-14 17:34 ` Pedro Alves
2013-11-18 18:25 ` Tom Tromey
2013-11-19 15:10 ` Pedro Alves
2013-11-19 15:47 ` Tom Tromey
2013-11-19 16:33 ` Pedro Alves
2013-11-19 19:07 ` Tom Tromey
2013-11-19 20:24 ` Pedro Alves
2013-11-19 20:56 ` Tom Tromey
2013-11-20 18:27 ` [PATCH] Don't let two frames with the same id end up in the frame chain. (Re: [PATCH 1/2] avoid infinite loop with bad debuginfo) Pedro Alves
2013-11-21 0:33 ` Tom Tromey [this message]
2013-11-21 16:40 ` Pedro Alves
2013-11-21 19:25 ` Tom Tromey
2013-11-22 14:13 ` [COMMITTED] Make use of the frame stash to detect wider stack cycles. (was: Re: [PATCH] Don't let two frames with the same id end up in the frame chain. (Re: [PATCH 1/2] avoid infinite loop with bad debuginfo)) Pedro Alves
2013-11-22 14:29 ` [PATCH] Don't let two frames with the same id end up in the frame chain. (Re: [PATCH 1/2] avoid infinite loop with bad debuginfo) Pedro Alves
2013-11-22 14:52 ` [PATCH 1/2] avoid infinite loop with bad debuginfo Pedro Alves
2013-11-22 17:16 ` Tom Tromey
2013-11-22 17:56 ` Pedro Alves
2013-11-19 15:52 ` Tom Tromey
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=871u2aixbc.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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