Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nathan Froyd <froydnj@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] fix assertion when returning from initial frame
Date: Wed, 21 Feb 2007 16:24:00 -0000	[thread overview]
Message-ID: <20070221162434.GL4200@sparrowhawk.codesourcery.com> (raw)

The following patch fixes an assertion when a user attempts to return
from the initial frame (or a frame for which GDB cannot find the
previous frame due to limited debugging information).  frame_pop always
assumed that a previous frame could be found; it now checks that it
actually finds a previous frame before proceeding.

OK?  (I do not have gdb commit privileges.)

-Nathan


2007-02-21  Nathan Froyd  <froydnj@codesourcery.com>

	* frame.c (frame_pop): Check to see whether there's a frame to
	which we can pop first.

--- frame.c	(revision 163834)
+++ frame.c	(local)
@@ -524,13 +524,22 @@ frame_save_as_regcache (struct frame_inf
 void
 frame_pop (struct frame_info *this_frame)
 {
+  struct frame_info *prev_frame;
+  struct regcache *scratch;
+  struct cleanup *cleanups;
+
+  /* Ensure that we have a frame to pop to.  */
+  prev_frame = get_prev_frame_1 (this_frame);
+
+  if (!prev_frame)
+    error (_("Cannot pop the initial frame."));
+
   /* Make a copy of all the register values unwound from this frame.
      Save them in a scratch buffer so that there isn't a race between
      trying to extract the old values from the current_regcache while
      at the same time writing new values into that same cache.  */
-  struct regcache *scratch
-    = frame_save_as_regcache (get_prev_frame_1 (this_frame));
-  struct cleanup *cleanups = make_cleanup_regcache_xfree (scratch);
+  scratch = frame_save_as_regcache (prev_frame);
+  cleanups = make_cleanup_regcache_xfree (scratch);
 
   /* FIXME: cagney/2003-03-16: It should be possible to tell the
      target's register cache that it is about to be hit with a burst


             reply	other threads:[~2007-02-21 16:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21 16:24 Nathan Froyd [this message]
2007-02-27 17:16 ` Daniel Jacobowitz
2007-02-27 17:32   ` Christopher Faylor

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=20070221162434.GL4200@sparrowhawk.codesourcery.com \
    --to=froydnj@codesourcery.com \
    --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