diff options
author | Hui Zhu <teawater@gmail.com> | 2008-11-06 02:18:11 +0000 |
---|---|---|
committer | Hui Zhu <teawater@gmail.com> | 2008-11-06 02:18:11 +0000 |
commit | ec629fe1bbf72a9ceffea9252821fdd11e08449e (patch) | |
tree | fc51d06e64324f1977b926aa7be4ea177ad6c5a0 | |
parent | 5a67a15b9cbbf3f84d529129bc82f2d3e583481d (diff) | |
download | gdb-reverse-20080930-branch.zip gdb-reverse-20080930-branch.tar.gz gdb-reverse-20080930-branch.tar.bz2 |
2008-11-06 Hui Zhu <teawater@gmail.com>reverse-20080930-branch
* 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.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/linux-nat.c | 23 | ||||
-rw-r--r-- | gdb/record.c | 17 |
3 files changed, 47 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a94d2c..9192ed2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index b63f863..2f4c621 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -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; } diff --git a/gdb/record.c b/gdb/record.c index 191cb3e..fec545f 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -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; } } |