+2017-10-03 Tom Tromey <tom@tromey.com>
+
+ * record-full.h (record_full_gdb_operation_disable_set): Return
+ scoped_restore_tmpl<int>.
+ * infrun.c (adjust_pc_after_break): Update.
+ (handle_signal_stop): Update.
+ * record-full.c (record_full_gdb_operation_disable_set): Return
+ scoped_restore_tmpl<int>.
+ (record_full_wait_1, record_full_insert_breakpoint)
+ (record_full_remove_breakpoint, record_full_save)
+ (record_full_goto_insn): Update.
+
2017-10-02 Tom Tromey <tom@tromey.com>
PR rust/22236:
|| (target_is_non_stop_p ()
&& moribund_breakpoint_here_p (aspace, breakpoint_pc)))
{
- struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);
+ gdb::optional<scoped_restore_tmpl<int>> restore_operation_disable;
if (record_full_is_used ())
- record_full_gdb_operation_disable_set ();
+ restore_operation_disable.emplace
+ (record_full_gdb_operation_disable_set ());
/* When using hardware single-step, a SIGTRAP is reported for both
a completed single-step and a software breakpoint. Need to
|| (thread->stepped_breakpoint
&& thread->prev_pc == breakpoint_pc))
regcache_write_pc (regcache, breakpoint_pc);
-
- do_cleanups (old_cleanups);
}
}
decr_pc = gdbarch_decr_pc_after_break (gdbarch);
if (decr_pc != 0)
{
- struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);
+ gdb::optional<scoped_restore_tmpl<int>>
+ restore_operation_disable;
if (record_full_is_used ())
- record_full_gdb_operation_disable_set ();
+ restore_operation_disable.emplace
+ (record_full_gdb_operation_disable_set ());
regcache_write_pc (regcache, stop_pc + decr_pc);
-
- do_cleanups (old_cleanups);
}
}
else
static int record_full_gdb_operation_disable = 0;
-struct cleanup *
+scoped_restore_tmpl<int>
record_full_gdb_operation_disable_set (void)
{
- struct cleanup *old_cleanups = NULL;
-
- old_cleanups =
- make_cleanup_restore_integer (&record_full_gdb_operation_disable);
- record_full_gdb_operation_disable = 1;
-
- return old_cleanups;
+ return make_scoped_restore (&record_full_gdb_operation_disable, 1);
}
/* Flag set to TRUE for target_stopped_by_watchpoint. */
ptid_t ptid, struct target_waitstatus *status,
int options)
{
- struct cleanup *set_cleanups = record_full_gdb_operation_disable_set ();
+ scoped_restore restore_operation_disable
+ = record_full_gdb_operation_disable_set ();
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
signal (SIGINT, handle_sigint);
- do_cleanups (set_cleanups);
return inferior_ptid;
}
However, we do have to insert software single-step
breakpoints, in case the target can't hardware step. To keep
things simple, we always insert. */
- struct cleanup *old_cleanups;
int ret;
- old_cleanups = record_full_gdb_operation_disable_set ();
+ scoped_restore restore_operation_disable
+ = record_full_gdb_operation_disable_set ();
ret = ops->beneath->to_insert_breakpoint (ops->beneath, gdbarch, bp_tgt);
- do_cleanups (old_cleanups);
if (ret != 0)
return ret;
{
if (bp->in_target_beneath)
{
- struct cleanup *old_cleanups;
int ret;
- old_cleanups = record_full_gdb_operation_disable_set ();
+ scoped_restore restore_operation_disable
+ = record_full_gdb_operation_disable_set ();
ret = ops->beneath->to_remove_breakpoint (ops->beneath, gdbarch,
bp_tgt, reason);
- do_cleanups (old_cleanups);
-
if (ret != 0)
return ret;
}
uint32_t magic;
struct regcache *regcache;
struct gdbarch *gdbarch;
- struct cleanup *set_cleanups;
int save_size = 0;
asection *osec = NULL;
int bfd_offset = 0;
gdbarch = get_regcache_arch (regcache);
/* Disable the GDB operation record. */
- set_cleanups = record_full_gdb_operation_disable_set ();
+ scoped_restore restore_operation_disable
+ = record_full_gdb_operation_disable_set ();
/* Reverse execute to the begin of record list. */
while (1)
record_full_list = record_full_list->prev;
}
- do_cleanups (set_cleanups);
unlink_file.keep ();
/* Succeeded. */
record_full_goto_insn (struct record_full_entry *entry,
enum exec_direction_kind dir)
{
- struct cleanup *set_cleanups = record_full_gdb_operation_disable_set ();
+ scoped_restore restore_operation_disable
+ = record_full_gdb_operation_disable_set ();
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = get_regcache_arch (regcache);
else
record_full_list = record_full_list->next;
} while (record_full_list != entry);
- do_cleanups (set_cleanups);
}
/* Alias for "target record-full". */