summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2008-10-06 17:52:18 +0000
committerMichael Snyder <msnyder@vmware.com>2008-10-06 17:52:18 +0000
commite3243c8f75607ce571f3cf74d1bf7a4e00c2454c (patch)
tree92d53f3461b67296866e54781a29e1b713d9203c
parent9745dc3a942720232c24fef510e874ceb3700e23 (diff)
downloadbinutils-gdb-e3243c8f75607ce571f3cf74d1bf7a4e00c2454c.tar.gz
2008-10-04 Hui Zhu <teawater@gmail.com>
Change from "to_prepare_to_store" to "to_store_registers". * record.c (record_beneath_to_prepare_to_store): Removed. (record_beneath_to_store_registers): New function pointer. Instead "record_beneath_to_prepare_to_store". Will point to the low strata target "to_store_registers" function. (record_prepare_to_store): Removed. (record_store_registers): New function. Instead "record_prepare_to_store". Record the change of registers from GDB. (init_record_ops): Change record_prepare_to_store to record_store_registers. * record.h (record_beneath_to_prepare_to_store): Removed. (record_beneath_to_store_registers): New extern. (record_regcache_raw_write_regnum): Remove. * target.c (update_current_target): Change record_beneath_to_prepare_to_store to record_beneath_to_store_registers. 2008-10-06 Michael Snyder <msnyder@promb-2s-dhcp59.eng.vmware.com> * regcache.c (regcache_raw_write): Remove global variable. No need to include "record.h" now. * record.c (record_regcache_raw_write_regnum): Remove.
-rw-r--r--gdb/ChangeLog26
-rw-r--r--gdb/record.c53
-rw-r--r--gdb/record.h3
-rw-r--r--gdb/regcache.c2
-rw-r--r--gdb/target.c6
5 files changed, 70 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 88eb812e8e3..e6e66eaa7da 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,29 @@
+2008-10-04 Hui Zhu <teawater@gmail.com>
+
+ Change from "to_prepare_to_store" to "to_store_registers".
+ * record.c (record_beneath_to_prepare_to_store): Removed.
+ (record_beneath_to_store_registers): New function pointer.
+ Instead "record_beneath_to_prepare_to_store". Will point
+ to the low strata target "to_store_registers" function.
+ (record_prepare_to_store): Removed.
+ (record_store_registers): New function.
+ Instead "record_prepare_to_store". Record the change of
+ registers from GDB.
+ (init_record_ops): Change record_prepare_to_store to
+ record_store_registers.
+ * record.h (record_beneath_to_prepare_to_store): Removed.
+ (record_beneath_to_store_registers): New extern.
+ (record_regcache_raw_write_regnum): Remove.
+ * target.c (update_current_target): Change
+ record_beneath_to_prepare_to_store to
+ record_beneath_to_store_registers.
+
+2008-10-06 Michael Snyder <msnyder@promb-2s-dhcp59.eng.vmware.com>
+
+ * regcache.c (regcache_raw_write): Remove global variable.
+ No need to include "record.h" now.
+ * record.c (record_regcache_raw_write_regnum): Remove.
+
2008-10-05 Michael Snyder <msnyder@vmware.com>
* reverse.c (exec_reverse_once): Call do_cleanups explicitly.
diff --git a/gdb/record.c b/gdb/record.c
index 51243cf0746..7b513ccfae8 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -51,7 +51,6 @@ enum exec_direction_kind record_exec_direction = EXEC_FORWARD;
static int record_get_sig = 0;
static sigset_t record_maskall;
static int record_not_record = 0;
-int record_regcache_raw_write_regnum = 0;
int record_will_store_registers = 0;
extern struct bp_location *bp_location_chain;
@@ -61,7 +60,7 @@ extern CORE_ADDR displaced_step_original, displaced_step_copy;
/* The real beneath function pointers. */
void (*record_beneath_to_resume) (ptid_t, int, enum target_signal);
ptid_t (*record_beneath_to_wait) (ptid_t, struct target_waitstatus *);
-void (*record_beneath_to_prepare_to_store) (struct regcache *);
+void (*record_beneath_to_store_registers) (struct regcache *, int regno);
LONGEST (*record_beneath_to_xfer_partial) (struct target_ops * ops,
enum target_object object,
const char *annex,
@@ -833,23 +832,51 @@ record_registers_change (struct regcache *regcache, int regnum)
}
}
-/* XXX: I don't know how to do if GDB call function target_store_registers
- without call function target_prepare_to_store. */
-
static void
-record_prepare_to_store (struct regcache *regcache)
+record_store_registers (struct regcache *regcache, int regno)
{
if (!record_not_record)
{
if (RECORD_IS_REPLAY)
{
+ int n;
struct cleanup *old_cleanups;
+
/* Let user choice if he want to write register or not. */
- if (!nquery (_("Becuse GDB is in replay mode, changing the value of a register will destroy the record from this point forward. Change register %s?"),
- gdbarch_register_name (get_regcache_arch
- (regcache),
- record_regcache_raw_write_regnum)))
+ if (regno < 0)
+ {
+ n =
+ nquery (_
+ ("Becuse GDB is in replay mode, changing the value of a register will destroy the record from this point forward. Change all register?"));
+ }
+ else
+ {
+ n =
+ nquery (_
+ ("Becuse GDB is in replay mode, changing the value of a register will destroy the record from this point forward. Change register %s?"),
+ gdbarch_register_name (get_regcache_arch (regcache),
+ regno));
+ }
+
+ if (!n)
{
+ /* Invalidate the value of regcache that set in function
+ "regcache_raw_write". */
+ if (regno < 0)
+ {
+ int i;
+ for (i = 0;
+ i < gdbarch_num_regs (get_regcache_arch (regcache));
+ i++)
+ {
+ regcache_invalidate (regcache, i);
+ }
+ }
+ else
+ {
+ regcache_invalidate (regcache, regno);
+ }
+
error (_("Record: record cancel the operation."));
}
@@ -857,9 +884,9 @@ record_prepare_to_store (struct regcache *regcache)
record_list_release_next ();
}
- record_registers_change (regcache, record_regcache_raw_write_regnum);
+ record_registers_change (regcache, regno);
}
- record_beneath_to_prepare_to_store (regcache);
+ record_beneath_to_store_registers (regcache, regno);
}
/* record_xfer_partial -- behavior is conditional on RECORD_IS_REPLAY.
@@ -992,7 +1019,7 @@ init_record_ops (void)
record_ops.to_mourn_inferior = record_mourn_inferior;
record_ops.to_kill = record_kill;
record_ops.to_create_inferior = find_default_create_inferior; /* Make record suppport command "run". */
- record_ops.to_prepare_to_store = record_prepare_to_store;
+ record_ops.to_store_registers = record_store_registers;
record_ops.to_xfer_partial = record_xfer_partial;
record_ops.to_insert_breakpoint = record_insert_breakpoint;
record_ops.to_remove_breakpoint = record_remove_breakpoint;
diff --git a/gdb/record.h b/gdb/record.h
index ea06d65cef8..69451705694 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -78,7 +78,6 @@ extern struct regcache *record_regcache;
extern struct target_ops record_ops;
extern int record_resume_step;
-extern int record_regcache_raw_write_regnum;
extern enum exec_direction_kind record_exec_direction;
extern int record_arch_list_add_reg (int num);
@@ -89,7 +88,7 @@ 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 *);
-extern void (*record_beneath_to_prepare_to_store) (struct regcache *);
+extern void (*record_beneath_to_store_registers) (struct regcache *, int regno);
extern LONGEST (*record_beneath_to_xfer_partial) (struct target_ops * ops,
enum target_object object,
const char *annex,
diff --git a/gdb/regcache.c b/gdb/regcache.c
index bf54bb7055d..199b626a1a7 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -29,7 +29,6 @@
#include "gdb_string.h"
#include "gdbcmd.h" /* For maintenanceprintlist. */
#include "observer.h"
-#include "record.h"
/*
* DATA STRUCTURE
@@ -659,7 +658,6 @@ regcache_raw_write (struct regcache *regcache, int regnum,
old_chain = save_inferior_ptid ();
inferior_ptid = regcache->ptid;
- record_regcache_raw_write_regnum = regnum;
target_prepare_to_store (regcache);
memcpy (register_buffer (regcache, regnum), buf,
regcache->descr->sizeof_register[regnum]);
diff --git a/gdb/target.c b/gdb/target.c
index 17473767b06..3cf44722b75 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -401,7 +401,7 @@ update_current_target (void)
current_target.FIELD = (TARGET)->FIELD
record_beneath_to_resume = NULL;
- record_beneath_to_prepare_to_store = NULL;
+ record_beneath_to_store_registers = NULL;
record_beneath_to_xfer_partial = NULL;
record_beneath_to_insert_breakpoint = NULL;
record_beneath_to_remove_breakpoint = NULL;
@@ -506,9 +506,9 @@ update_current_target (void)
{
record_beneath_to_wait = t->to_wait;
}
- if (!record_beneath_to_prepare_to_store)
+ if (!record_beneath_to_store_registers)
{
- record_beneath_to_prepare_to_store = t->to_prepare_to_store;
+ record_beneath_to_store_registers = t->to_store_registers;
}
if (!record_beneath_to_xfer_partial)
{