]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2008-11-06 Hui Zhu <teawater@gmail.com> reverse-20080930-branch
authorHui Zhu <teawater@gmail.com>
Thu, 6 Nov 2008 02:18:11 +0000 (02:18 +0000)
committerHui Zhu <teawater@gmail.com>
Thu, 6 Nov 2008 02:18:11 +0000 (02:18 +0000)
* record.c (record_wait): Set pc if forward execute,
gdbarch_decr_pc_after_break is not 0 and this is not single
step in replay mode.
* linux-nat.c (my_waitpid_record): Add
gdbarch_decr_pc_after_break to pc if need.

gdb/ChangeLog
gdb/linux-nat.c
gdb/record.c

index 1a94d2c92968001a86b4b12697101114c2eda6cc..9192ed20b70a6e402f54543c8cbf3578bf7c804a 100644 (file)
@@ -1,3 +1,11 @@
+2008-11-06  Hui Zhu  <teawater@gmail.com>
+
+       * record.c (record_wait): Set pc if forward execute,
+       gdbarch_decr_pc_after_break is not 0 and this is not single
+       step in replay mode.
+       * linux-nat.c (my_waitpid_record): Add
+       gdbarch_decr_pc_after_break to pc if need.
+
 2008-11-05  Hui Zhu  <teawater@gmail.com>
 
        * record.c (record_wait): Check breakpint before forward
index b63f863e5636d8225eb9f03523189ef80f781358..2f4c62153cb4b705de89a7167faf68c91eda6ab2 100644 (file)
@@ -514,7 +514,9 @@ my_waitpid_record (int pid, int *status, int flags)
   struct bp_location *bl;
   struct breakpoint *b;
   CORE_ADDR pc;
+  CORE_ADDR decr_pc_after_break;
   struct lwp_info *lp;
+  int is_breakpoint = 1;
 
 wait_begin:
   ret = my_waitpid (pid, status, flags);
@@ -530,7 +532,7 @@ wait_begin:
 
   if (WIFSTOPPED (*status) && WSTOPSIG (*status) == SIGTRAP)
     {
-      /* Check if there is a breakpoint */
+      /* Check if there is a breakpoint */
       pc = 0;
       registers_changed ();
       for (bl = bp_location_chain; bl; bl = bl->global_next)
@@ -602,7 +604,26 @@ wait_begin:
       goto wait_begin;
     }
 
+  is_breakpoint = 0;
+
 out:
+  /* Add gdbarch_decr_pc_after_break to pc because pc will be break at address
+     add gdbarch_decr_pc_after_break when inferior non-step execute.  */
+  if (is_breakpoint)
+    {
+      decr_pc_after_break = gdbarch_decr_pc_after_break
+       (get_regcache_arch (get_thread_regcache (pid_to_ptid (ret))));
+      if (decr_pc_after_break)
+       {
+         if (!pc)
+           {
+             pc = regcache_read_pc (get_thread_regcache (pid_to_ptid (ret)));
+           }
+         regcache_write_pc (get_thread_regcache (pid_to_ptid (ret)),
+                            pc + decr_pc_after_break);
+       }
+    }
+
   return ret;
 }
 
index 191cb3e53951ae78bcb10184439628727d8f2f0c..fec545f7ded4a4faa3061514ef297a9c00026bd8 100644 (file)
@@ -513,6 +513,14 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
                                      "Process record: break at 0x%s.\n",
                                      paddr_nz (tmp_pc));
                }
+             if (gdbarch_decr_pc_after_break (get_regcache_arch (regcache))
+                 && !record_resume_step)
+               {
+                 regcache_write_pc (regcache,
+                                    tmp_pc +
+                                    gdbarch_decr_pc_after_break
+                                    (get_regcache_arch (regcache)));
+               }
              goto replay_out;
            }
        }
@@ -655,6 +663,15 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
                                              "Process record: break at 0x%s.\n",
                                              paddr_nz (tmp_pc));
                        }
+                     if (gdbarch_decr_pc_after_break (get_regcache_arch (regcache))
+                         && execution_direction == EXEC_FORWARD
+                         && !record_resume_step)
+                       {
+                         regcache_write_pc (regcache,
+                                            tmp_pc +
+                                            gdbarch_decr_pc_after_break
+                                            (get_regcache_arch (regcache)));
+                       }
                      continue_flag = 0;
                    }
                }