Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: one approach to fixing PR 14100
@ 2012-08-02 16:12 Tom Tromey
  2012-08-03 16:03 ` Tom Tromey
  2012-08-08 18:27 ` Mark Kettenis
  0 siblings, 2 replies; 11+ messages in thread
From: Tom Tromey @ 2012-08-02 16:12 UTC (permalink / raw)
  To: gdb-patches

PR 14100 concerns a way to crash gdb by C-c during a 'bt'.

The way this happens is that dwarf2_frame_cache initializes the frame's
prologue_cache.  Then, it continues to do some more work, including
(indirectly) reading target memory.

Then, target_read invokes QUIT, throwing an exception.
The cleanups are run, and eventually we get to
frame_cleanup_after_sniffer, which asserts that prologue_cache==NULL.

This fix assumes that what dwarf2_frame_cache is doing is not
unreasonable, and simply clears the prologue_cache field.

I am not sure whether this is really correct.

Another approach would be to change dwarf2_frame_cache to set the
prologue_cache at the end of its work rather than at the beginning.
Then, I suppose, we'd have to document this restriction and audit all
the other sniffers.

Thoughts?

This built and regtested on x86-64 Fedora 16.
Also I tried it by hand and couldn't reproduce the crash.

Tom

	* frame.c (frame_cleanup_after_sniffer): Remove assert.
	Clear frame's prologue_cache.
---
 gdb/frame.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/frame.c b/gdb/frame.c
index e012f2d..edb379c 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2392,8 +2392,11 @@ frame_cleanup_after_sniffer (void *arg)
   struct frame_info *frame = arg;
 
   /* The sniffer should not allocate a prologue cache if it did not
-     match this frame.  */
-  gdb_assert (frame->prologue_cache == NULL);
+     match this frame.  We used to assert that prologue_cache was NULL
+     here -- however, that ran afoul of code paths where the
+     prologue_cache was set by the sniffer, but some later processing
+     called QUIT.  */
+  frame->prologue_cache = NULL;
 
   /* No sniffer should extend the frame chain; sniff based on what is
      already certain.  */
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-08-09 20:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-02 16:12 RFC: one approach to fixing PR 14100 Tom Tromey
2012-08-03 16:03 ` Tom Tromey
2012-08-03 21:02   ` Jan Kratochvil
2012-08-04  1:58     ` Tom Tromey
2012-08-04  6:26       ` Jan Kratochvil
2012-08-06 15:31       ` Tom Tromey
2012-08-06 15:45         ` Jan Kratochvil
2012-08-09  9:42         ` Mark Kettenis
2012-08-09  9:46           ` Jan Kratochvil
2012-08-09 20:12             ` Tom Tromey
2012-08-08 18:27 ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox