return REG_VALID;
}
-struct regcache *
+std::unique_ptr<struct regcache>
frame_save_as_regcache (struct frame_info *this_frame)
{
struct address_space *aspace = get_frame_address_space (this_frame);
- struct regcache *regcache = new regcache (get_frame_arch (this_frame),
- aspace);
- struct cleanup *cleanups = make_cleanup_regcache_xfree (regcache);
+ std::unique_ptr<struct regcache> regcache
+ (new struct regcache (get_frame_arch (this_frame), aspace));
- regcache_save (regcache, do_frame_register_read, this_frame);
- discard_cleanups (cleanups);
+ regcache_save (regcache.get (), do_frame_register_read, this_frame);
return regcache;
}
frame_pop (struct frame_info *this_frame)
{
struct frame_info *prev_frame;
- struct regcache *scratch;
- struct cleanup *cleanups;
if (get_frame_type (this_frame) == DUMMY_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. */
- scratch = frame_save_as_regcache (prev_frame);
- cleanups = make_cleanup_regcache_xfree (scratch);
+ std::unique_ptr<struct regcache> scratch
+ = frame_save_as_regcache (prev_frame);
/* 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
(arguably a bug in the target code mind). */
/* Now copy those saved registers into the current regcache.
Here, regcache_cpy() calls regcache_restore(). */
- regcache_cpy (get_current_regcache (), scratch);
- do_cleanups (cleanups);
+ regcache_cpy (get_current_regcache (), scratch.get ());
/* We've made right mess of GDB's local state, just discard
everything. */
}
}
-#if GDB_SELF_TEST
-struct frame_info *
-create_test_frame (struct regcache *regcache)
-{
- struct frame_info *this_frame = XCNEW (struct frame_info);
-
- sentinel_frame = create_sentinel_frame (NULL, regcache);
- sentinel_frame->prev = this_frame;
- sentinel_frame->prev_p = 1;;
- this_frame->prev_arch.p = 1;
- this_frame->prev_arch.arch = get_regcache_arch (regcache);
- this_frame->next = sentinel_frame;
-
- return this_frame;
-}
-#endif
-
/* Create an arbitrary (i.e. address specified by user) or innermost frame.
Always returns a non-NULL value. */
/* Clean up after a failed (wrong unwinder) attempt to unwind past
FRAME. */
-static void
-frame_cleanup_after_sniffer (void *arg)
+void
+frame_cleanup_after_sniffer (struct frame_info *frame)
{
- struct frame_info *frame = (struct frame_info *) arg;
-
/* The sniffer should not allocate a prologue cache if it did not
match this frame. */
gdb_assert (frame->prologue_cache == NULL);
}
/* Set FRAME's unwinder temporarily, so that we can call a sniffer.
- Return a cleanup which should be called if unwinding fails, and
- discarded if it succeeds. */
+ If sniffing fails, the caller should be sure to call
+ frame_cleanup_after_sniffer. */
-struct cleanup *
+void
frame_prepare_for_sniffer (struct frame_info *frame,
const struct frame_unwind *unwind)
{
gdb_assert (frame->unwind == NULL);
frame->unwind = unwind;
- return make_cleanup (frame_cleanup_after_sniffer, frame);
}
static struct cmd_list_element *set_backtrace_cmdlist;
static struct cmd_list_element *show_backtrace_cmdlist;
static void
-set_backtrace_cmd (char *args, int from_tty)
+set_backtrace_cmd (const char *args, int from_tty)
{
help_list (set_backtrace_cmdlist, "set backtrace ", all_commands,
gdb_stdout);
}
static void
-show_backtrace_cmd (char *args, int from_tty)
+show_backtrace_cmd (const char *args, int from_tty)
{
cmd_show_list (show_backtrace_cmdlist, from_tty, "");
}