aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2007-03-13 14:05:25 +0000
committerNathan Froyd <froydnj@codesourcery.com>2007-03-13 14:05:25 +0000
commit348473d521cdd873312796f2753862d118c1ac99 (patch)
treecd994812bb66793f1f0d4bd6b20741f86e2161c2 /gdb/frame.c
parenta2f9cf0ddf3113a84439d2f3398f6c3fa400b433 (diff)
downloadgdb-348473d521cdd873312796f2753862d118c1ac99.zip
gdb-348473d521cdd873312796f2753862d118c1ac99.tar.gz
gdb-348473d521cdd873312796f2753862d118c1ac99.tar.bz2
* frame.c (frame_pop): Check to see whether there's a frame to
which we can pop first.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index a40bbb2..8a14b29 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -514,13 +514,22 @@ frame_save_as_regcache (struct frame_info *this_frame)
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