From 49133c575cfbdfb34fc55d26b323229ced906a39 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Sat, 27 Dec 2008 20:28:12 +0000 Subject: [PATCH] 2008-12-26 Michael Snyder * record.h: Don't export record_not_record. * infrun.c (proceed): Don't call record_not_record_set. * record.h (record_not_record): Rename to in_record_wait. (record_not_record_set): Rename to in_record_wait_set. (record_not_record_cleanup): Rename to in_record_wait_cleanup. (record_store_registers): Check in_record_wait flag. (record_xfer_partial): Ditto. --- gdb/ChangeLog | 10 ++++++++++ gdb/infrun.c | 6 ------ gdb/record.c | 36 +++++++++++++++++++++++------------- gdb/record.h | 1 - 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 39ecb43eb4d..9e10ccd4e40 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2008-12-26 Michael Snyder + + * record.h: Don't export record_not_record. + * infrun.c (proceed): Don't call record_not_record_set. + * record.h (record_not_record): Rename to in_record_wait. + (record_not_record_set): Rename to in_record_wait_set. + (record_not_record_cleanup): Rename to in_record_wait_cleanup. + (record_store_registers): Check in_record_wait flag. + (record_xfer_partial): Ditto. + 2008-12-26 Michael Snyder * Marker: adding teawater patches to branch. diff --git a/gdb/infrun.c b/gdb/infrun.c index 95022a28daf..e3955162eb1 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1312,12 +1312,6 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step) if (step < 0) stop_after_trap = 1; - /* When GDB resume the inferior, process record target doesn't need to - record the memory and register store operation of GDB. So set - record_not_record to 1. */ - if (RECORD_IS_USED) - record_not_record_set (); - if (addr == (CORE_ADDR) -1) { if (pc == stop_pc && breakpoint_here_p (pc) diff --git a/gdb/record.c b/gdb/record.c index 8e2d13df98d..71900b07fcb 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -47,7 +47,7 @@ static int record_resume_step = 0; static enum target_signal record_resume_siggnal; static int record_get_sig = 0; static sigset_t record_maskall; -static int record_not_record = 0; +static int in_record_wait = 0; int record_will_store_registers = 0; extern struct bp_location *bp_location_chain; @@ -364,19 +364,19 @@ record_message (struct gdbarch *gdbarch) } } -/* Things to clean up if we QUIT out of function that set - record_not_record. */ +/* Things to clean up if we error or QUIT out of function that set + in_record_wait (ie. command that called 'proceed'). */ static void -record_not_record_cleanups (void *ignore) +in_record_wait_cleanups (void *ignore) { - record_not_record = 0; + in_record_wait = 0; } void -record_not_record_set (void) +in_record_wait_set (void) { - struct cleanup *old_cleanups = make_cleanup (record_not_record_cleanups, 0); - record_not_record = 1; + struct cleanup *old_cleanups = make_cleanup (in_record_wait_cleanups, 0); + in_record_wait = 1; } static void @@ -483,6 +483,7 @@ record_wait_cleanups (void *ignore) static ptid_t record_wait (ptid_t ptid, struct target_waitstatus *status) { + in_record_wait_set (); if (record_debug) { fprintf_unfiltered (gdb_stdlog, @@ -696,10 +697,14 @@ record_wait (ptid_t ptid, struct target_waitstatus *status) paddr_nz ((CORE_ADDR)record_list), record_list->u.reg.num); } + /* MVS: This step fetches the reg from the target. */ regcache_cooked_read (regcache, record_list->u.reg.num, reg); + /* MVS: This step writes the execution log reg to the target. */ regcache_cooked_write (regcache, record_list->u.reg.num, record_list->u.reg.val); + /* MVS: And this step saves the target reg in the exec log. */ memcpy (record_list->u.reg.val, reg, MAX_REGISTER_SIZE); + /* MVS: Net result -- swap. */ } else if (record_list->type == record_mem) { @@ -713,6 +718,8 @@ record_wait (ptid_t ptid, struct target_waitstatus *status) paddr_nz (record_list->u.mem.addr), record_list->u.mem.len); } + + /* MVS: This step fetches 'mem' from the target. */ if (target_read_memory (record_list->u.mem.addr, mem, record_list->u.mem.len)) { @@ -720,6 +727,8 @@ record_wait (ptid_t ptid, struct target_waitstatus *status) paddr_nz (record_list->u.mem.addr), record_list->u.mem.len); } + + /* MVS: This step writes from the exec log to the target. */ if (target_write_memory (record_list->u.mem.addr, record_list->u.mem.val, record_list->u.mem.len)) @@ -729,7 +738,9 @@ record_wait (ptid_t ptid, struct target_waitstatus *status) paddr_nz (record_list->u.mem.addr), record_list->u.mem.len); } + /* MVS: And this step writes target 'mem' to the exec log. */ memcpy (record_list->u.mem.val, mem, record_list->u.mem.len); + /* MVS: Net result: swap. */ } else { @@ -937,7 +948,7 @@ record_registers_change (struct regcache *regcache, int regnum) static void record_store_registers (struct regcache *regcache, int regno) { - if (!record_not_record) + if (!in_record_wait) { if (RECORD_IS_REPLAY) { @@ -1000,7 +1011,7 @@ record_xfer_partial (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte * readbuf, const gdb_byte * writebuf, ULONGEST offset, LONGEST len) { - if (!record_not_record + if (!in_record_wait && (object == TARGET_OBJECT_MEMORY || object == TARGET_OBJECT_RAW_MEMORY) && writebuf) { @@ -1058,7 +1069,6 @@ record_xfer_partial (struct target_ops *ops, enum target_object object, record_insn_num++; } } - return record_beneath_to_xfer_partial (ops, object, annex, readbuf, writebuf, offset, len); } @@ -1071,7 +1081,7 @@ record_xfer_partial (struct target_ops *ops, enum target_object object, static int record_insert_breakpoint (struct bp_target_info *bp_tgt) { - if (!RECORD_IS_REPLAY) + if (!RECORD_IS_USED) { return record_beneath_to_insert_breakpoint (bp_tgt); } @@ -1082,7 +1092,7 @@ record_insert_breakpoint (struct bp_target_info *bp_tgt) static int record_remove_breakpoint (struct bp_target_info *bp_tgt) { - if (!RECORD_IS_REPLAY) + if (!RECORD_IS_USED) { return record_beneath_to_remove_breakpoint (bp_tgt); } diff --git a/gdb/record.h b/gdb/record.h index fd692730052..6cb3480cb34 100644 --- a/gdb/record.h +++ b/gdb/record.h @@ -80,7 +80,6 @@ extern int record_arch_list_add_reg (int num); extern int record_arch_list_add_mem (CORE_ADDR addr, int len); extern int record_arch_list_add_end (int need_dasm); extern void record_message (struct gdbarch *gdbarch); -extern void record_not_record_set (void); extern void (*record_beneath_to_resume) (ptid_t, int, enum target_signal); extern ptid_t (*record_beneath_to_wait) (ptid_t, struct target_waitstatus *); -- 2.47.2