gdb/
[deliverable/binutils-gdb.git] / gdb / record.c
index 85e75a09ca281e373e4b8bda7fb2a8509d61b503..650f2a1399e3a75981d9ec66abc1312e4765c959 100644 (file)
@@ -51,6 +51,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;
 };
 
@@ -154,7 +157,7 @@ record_list_release_next (void)
   while (tmp)
     {
       rec = tmp->next;
-      if (tmp->type == record_reg)
+      if (tmp->type == record_end)
        record_insn_num--;
       else if (tmp->type == record_reg)
        xfree (tmp->u.reg.val);
@@ -275,6 +278,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))
     {
@@ -510,7 +514,6 @@ record_close (int quitting)
 }
 
 static int record_resume_step = 0;
-static enum target_signal record_resume_siggnal;
 static int record_resume_error;
 
 static void
@@ -518,7 +521,6 @@ record_resume (struct target_ops *ops, ptid_t ptid, int step,
                enum target_signal siggnal)
 {
   record_resume_step = step;
-  record_resume_siggnal = siggnal;
 
   if (!RECORD_IS_REPLAY)
     {
@@ -594,7 +596,7 @@ record_wait (struct target_ops *ops,
        {
          /* This is a single step.  */
          return record_beneath_to_wait (record_beneath_to_wait_ops,
-                                        ptid, status, 0);
+                                        ptid, status, options);
        }
       else
        {
@@ -605,7 +607,7 @@ record_wait (struct target_ops *ops,
          while (1)
            {
              ret = record_beneath_to_wait (record_beneath_to_wait_ops,
-                                           ptid, status, 0);
+                                           ptid, status, options);
 
              if (status->kind == TARGET_WAITKIND_STOPPED
                  && status->value.sig == TARGET_SIGNAL_TRAP)
@@ -634,7 +636,7 @@ record_wait (struct target_ops *ops,
                        }
                      record_beneath_to_resume (record_beneath_to_resume_ops,
                                                ptid, 1,
-                                               record_resume_siggnal);
+                                               TARGET_SIGNAL_0);
                      continue;
                    }
                }
@@ -727,32 +729,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
            {
@@ -932,7 +957,6 @@ record_store_registers (struct target_ops *ops, struct regcache *regcache,
       if (RECORD_IS_REPLAY)
        {
          int n;
-         struct cleanup *old_cleanups;
 
          /* Let user choose if he wants to write register or not.  */
          if (regno < 0)
This page took 0.025169 seconds and 4 git commands to generate.