summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2009-08-07 00:59:15 +0000
committerMichael Snyder <msnyder@specifix.com>2009-08-07 00:59:15 +0000
commit1a3f815b3e7906ef8828243b0a5857c04f897a85 (patch)
tree9e4cbf2ef34b0a4a57f7bd6aa0fc2680b74da767
parent015148ec751ddc25b013e844841f6c7d04fb1cd8 (diff)
downloadgdb-1a3f815b3e7906ef8828243b0a5857c04f897a85.tar.gz
2009-08-04 Hui Zhu <teawater@gmail.com>
Michael Snyder <msnyder@vmware.com> (Import from main branch) * record.c (record_mem_entry): New field 'mem_entry_not_accessible'. (record_arch_list_add_mem): Initialize 'mem_entry_not_accessible'. (record_wait): Set 'mem_entry_not_accessible' flag if target memory not readable. Don't try to change target memory if 'mem_entry_not_accessible' is set.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/record.c79
2 files changed, 62 insertions, 26 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0d8597eb03f..a8b3248b911 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2009-08-04 Hui Zhu <teawater@gmail.com>
+ Michael Snyder <msnyder@vmware.com>
+ (Import from main branch)
+ * record.c (record_mem_entry): New field 'mem_entry_not_accessible'.
+ (record_arch_list_add_mem): Initialize 'mem_entry_not_accessible'.
+ (record_wait): Set 'mem_entry_not_accessible' flag if target
+ memory not readable. Don't try to change target memory if
+ 'mem_entry_not_accessible' is set.
+
2009-08-06 Michael Snyder <msnyder@vmware.com>
* record.c (record_restore_checkpoint): Count instructions, not
diff --git a/gdb/record.c b/gdb/record.c
index 5b6add51bba..56dfe1a7b16 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -52,6 +52,9 @@ struct record_mem_entry
{
CORE_ADDR addr;
int len;
+ /* Set this flag if target memory for this entry
+ can no longer be accessed. */
+ int mem_entry_not_accessible;
gdb_byte *val;
};
@@ -283,6 +286,7 @@ record_arch_list_add_mem (CORE_ADDR addr, int len)
rec->type = record_mem;
rec->u.mem.addr = addr;
rec->u.mem.len = len;
+ rec->u.mem.mem_entry_not_accessible = 0;
if (target_read_memory (addr, rec->u.mem.val, len))
{
@@ -735,32 +739,55 @@ record_wait (struct target_ops *ops,
else if (record_list->type == record_mem)
{
/* mem */
- gdb_byte *mem = alloca (record_list->u.mem.len);
- if (record_debug > 1)
- fprintf_unfiltered (gdb_stdlog,
- "Process record: record_mem %s to "
- "inferior addr = %s len = %d.\n",
- host_address_to_string (record_list),
- paddress (gdbarch, record_list->u.mem.addr),
- record_list->u.mem.len);
-
- if (target_read_memory
- (record_list->u.mem.addr, mem, record_list->u.mem.len))
- error (_("Process record: error reading memory at "
- "addr = %s len = %d."),
- paddress (gdbarch, record_list->u.mem.addr),
- record_list->u.mem.len);
-
- if (target_write_memory
- (record_list->u.mem.addr, record_list->u.mem.val,
- record_list->u.mem.len))
- error (_
- ("Process record: error writing memory at "
- "addr = %s len = %d."),
- paddress (gdbarch, record_list->u.mem.addr),
- record_list->u.mem.len);
-
- memcpy (record_list->u.mem.val, mem, record_list->u.mem.len);
+ /* Nothing to do if the entry is flagged not_accessible. */
+ if (!record_list->u.mem.mem_entry_not_accessible)
+ {
+ gdb_byte *mem = alloca (record_list->u.mem.len);
+ if (record_debug > 1)
+ fprintf_unfiltered (gdb_stdlog,
+ "Process record: record_mem %s to "
+ "inferior addr = %s len = %d.\n",
+ host_address_to_string (record_list),
+ paddress (gdbarch,
+ record_list->u.mem.addr),
+ record_list->u.mem.len);
+
+ if (target_read_memory (record_list->u.mem.addr, mem,
+ record_list->u.mem.len))
+ {
+ if (execution_direction != EXEC_REVERSE)
+ error (_("Process record: error reading memory at "
+ "addr = %s len = %d."),
+ paddress (gdbarch, record_list->u.mem.addr),
+ record_list->u.mem.len);
+ else
+ /* Read failed --
+ flag entry as not_accessible. */
+ record_list->u.mem.mem_entry_not_accessible = 1;
+ }
+ else
+ {
+ if (target_write_memory (record_list->u.mem.addr,
+ record_list->u.mem.val,
+ record_list->u.mem.len))
+ {
+ if (execution_direction != EXEC_REVERSE)
+ error (_("Process record: error writing memory at "
+ "addr = %s len = %d."),
+ paddress (gdbarch, record_list->u.mem.addr),
+ record_list->u.mem.len);
+ else
+ /* Write failed --
+ flag entry as not_accessible. */
+ record_list->u.mem.mem_entry_not_accessible = 1;
+ }
+ else
+ {
+ memcpy (record_list->u.mem.val, mem,
+ record_list->u.mem.len);
+ }
+ }
+ }
}
else
{