--- infrun.c | 2 +- record.c | 38 ++++++++++++++++++++------------------ record.h | 2 +- 3 files changed, 22 insertions(+), 20 deletions(-) --- a/infrun.c +++ b/infrun.c @@ -2731,7 +2731,7 @@ adjust_pc_after_break (struct execution_ struct cleanup *old_cleanups = NULL; if (RECORD_IS_USED) - old_cleanups = record_gdb_operation_disable_set (); + old_cleanups = record_disable_set (); /* When using hardware single-step, a SIGTRAP is reported for both a completed single-step and a software breakpoint. Need to --- a/record.c +++ b/record.c @@ -671,16 +671,16 @@ record_message_wrapper_safe (struct regc /* Set to 1 if record_store_registers and record_xfer_partial doesn't need record. */ -static int record_gdb_operation_disable = 0; +static int record_disable = 0; struct cleanup * -record_gdb_operation_disable_set (void) +record_disable_set (void) { struct cleanup *old_cleanups = NULL; old_cleanups = - make_cleanup_restore_integer (&record_gdb_operation_disable); - record_gdb_operation_disable = 1; + make_cleanup_restore_integer (&record_disable); + record_disable = 1; return old_cleanups; } @@ -1007,7 +1007,8 @@ record_resume (struct target_ops *ops, p if (!RECORD_IS_REPLAY) { - record_message (get_current_regcache (), signal); + if (!record_disable) + record_message (get_current_regcache (), signal); record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1, signal); } @@ -1061,8 +1062,6 @@ record_wait (struct target_ops *ops, ptid_t ptid, struct target_waitstatus *status, int options) { - struct cleanup *set_cleanups = record_gdb_operation_disable_set (); - if (record_debug) fprintf_unfiltered (gdb_stdlog, "Process record: record_wait " @@ -1071,9 +1070,9 @@ record_wait (struct target_ops *ops, if (!RECORD_IS_REPLAY && ops != &record_core_ops) { - if (record_resume_step) + if (record_resume_step || record_disable) { - /* This is a single step. */ + /* This is a single step or record is disabled. */ return record_beneath_to_wait (record_beneath_to_wait_ops, ptid, status, options); } @@ -1082,6 +1081,7 @@ record_wait (struct target_ops *ops, /* This is not a single step. */ ptid_t ret; CORE_ADDR tmp_pc; + struct cleanup *set_cleanups = record_disable_set (); while (1) { @@ -1145,6 +1145,7 @@ record_wait (struct target_ops *ops, break; } + do_cleanups (set_cleanups); return ret; } } @@ -1157,6 +1158,7 @@ record_wait (struct target_ops *ops, int first_record_end = 1; struct cleanup *old_cleanups = make_cleanup (record_wait_cleanups, 0); CORE_ADDR tmp_pc; + struct cleanup *set_cleanups = record_disable_set (); record_hw_watchpoint = 0; status->kind = TARGET_WAITKIND_STOPPED; @@ -1309,10 +1311,10 @@ replay_out: else status->value.sig = TARGET_SIGNAL_TRAP; + do_cleanups (set_cleanups); discard_cleanups (old_cleanups); } - do_cleanups (set_cleanups); return inferior_ptid; } @@ -1436,7 +1438,7 @@ static void record_store_registers (struct target_ops *ops, struct regcache *regcache, int regno) { - if (!record_gdb_operation_disable) + if (!record_disable) { if (RECORD_IS_REPLAY) { @@ -1495,7 +1497,7 @@ record_xfer_partial (struct target_ops * const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { - if (!record_gdb_operation_disable + if (!record_disable && (object == TARGET_OBJECT_MEMORY || object == TARGET_OBJECT_RAW_MEMORY) && writebuf) { @@ -1561,7 +1563,7 @@ record_insert_breakpoint (struct gdbarch { if (!RECORD_IS_REPLAY) { - struct cleanup *old_cleanups = record_gdb_operation_disable_set (); + struct cleanup *old_cleanups = record_disable_set (); int ret = record_beneath_to_insert_breakpoint (gdbarch, bp_tgt); do_cleanups (old_cleanups); @@ -1580,7 +1582,7 @@ record_remove_breakpoint (struct gdbarch { if (!RECORD_IS_REPLAY) { - struct cleanup *old_cleanups = record_gdb_operation_disable_set (); + struct cleanup *old_cleanups = record_disable_set (); int ret = record_beneath_to_remove_breakpoint (gdbarch, bp_tgt); do_cleanups (old_cleanups); @@ -1735,7 +1737,7 @@ record_core_store_registers (struct targ struct regcache *regcache, int regno) { - if (record_gdb_operation_disable) + if (record_disable) regcache_raw_collect (regcache, regno, record_core_regbuf + MAX_REGISTER_SIZE * regno); else @@ -1752,7 +1754,7 @@ record_core_xfer_partial (struct target_ { if (object == TARGET_OBJECT_MEMORY) { - if (record_gdb_operation_disable || !writebuf) + if (record_disable || !writebuf) { struct target_section *p; @@ -2375,7 +2377,7 @@ cmd_record_save (char *args, int from_tt gdbarch = get_regcache_arch (regcache); /* Disable the GDB operation record. */ - set_cleanups = record_gdb_operation_disable_set (); + set_cleanups = record_disable_set (); /* Reverse execute to the begin of record list. */ while (1) @@ -2549,7 +2551,7 @@ static void record_goto_insn (struct record_entry *entry, enum exec_direction_kind dir) { - struct cleanup *set_cleanups = record_gdb_operation_disable_set (); + struct cleanup *set_cleanups = record_disable_set (); struct regcache *regcache = get_current_regcache (); struct gdbarch *gdbarch = get_regcache_arch (regcache); --- a/record.h +++ b/record.h @@ -27,6 +27,6 @@ extern int record_debug; extern int record_arch_list_add_reg (struct regcache *regcache, int num); extern int record_arch_list_add_mem (CORE_ADDR addr, int len); extern int record_arch_list_add_end (void); -extern struct cleanup *record_gdb_operation_disable_set (void); +extern struct cleanup *record_disable_set (void); #endif /* _RECORD_H_ */