GNU Binutils with patches for OS216
Revisão | ec629fe1bbf72a9ceffea9252821fdd11e08449e (tree) |
---|---|
Hora | 2008-11-06 11:18:11 |
Autor | Hui Zhu <teawater@gmai...> |
Commiter | Hui Zhu |
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.
@@ -1,3 +1,11 @@ | ||
1 | +2008-11-06 Hui Zhu <teawater@gmail.com> | |
2 | + | |
3 | + * record.c (record_wait): Set pc if forward execute, | |
4 | + gdbarch_decr_pc_after_break is not 0 and this is not single | |
5 | + step in replay mode. | |
6 | + * linux-nat.c (my_waitpid_record): Add | |
7 | + gdbarch_decr_pc_after_break to pc if need. | |
8 | + | |
1 | 9 | 2008-11-05 Hui Zhu <teawater@gmail.com> |
2 | 10 | |
3 | 11 | * record.c (record_wait): Check breakpint before forward |
@@ -514,7 +514,9 @@ my_waitpid_record (int pid, int *status, int flags) | ||
514 | 514 | struct bp_location *bl; |
515 | 515 | struct breakpoint *b; |
516 | 516 | CORE_ADDR pc; |
517 | + CORE_ADDR decr_pc_after_break; | |
517 | 518 | struct lwp_info *lp; |
519 | + int is_breakpoint = 1; | |
518 | 520 | |
519 | 521 | wait_begin: |
520 | 522 | ret = my_waitpid (pid, status, flags); |
@@ -530,7 +532,7 @@ wait_begin: | ||
530 | 532 | |
531 | 533 | if (WIFSTOPPED (*status) && WSTOPSIG (*status) == SIGTRAP) |
532 | 534 | { |
533 | - /* Check if there is a breakpoint */ | |
535 | + /* Check if there is a breakpoint. */ | |
534 | 536 | pc = 0; |
535 | 537 | registers_changed (); |
536 | 538 | for (bl = bp_location_chain; bl; bl = bl->global_next) |
@@ -602,7 +604,26 @@ wait_begin: | ||
602 | 604 | goto wait_begin; |
603 | 605 | } |
604 | 606 | |
607 | + is_breakpoint = 0; | |
608 | + | |
605 | 609 | out: |
610 | + /* Add gdbarch_decr_pc_after_break to pc because pc will be break at address | |
611 | + add gdbarch_decr_pc_after_break when inferior non-step execute. */ | |
612 | + if (is_breakpoint) | |
613 | + { | |
614 | + decr_pc_after_break = gdbarch_decr_pc_after_break | |
615 | + (get_regcache_arch (get_thread_regcache (pid_to_ptid (ret)))); | |
616 | + if (decr_pc_after_break) | |
617 | + { | |
618 | + if (!pc) | |
619 | + { | |
620 | + pc = regcache_read_pc (get_thread_regcache (pid_to_ptid (ret))); | |
621 | + } | |
622 | + regcache_write_pc (get_thread_regcache (pid_to_ptid (ret)), | |
623 | + pc + decr_pc_after_break); | |
624 | + } | |
625 | + } | |
626 | + | |
606 | 627 | return ret; |
607 | 628 | } |
608 | 629 |
@@ -513,6 +513,14 @@ record_wait (ptid_t ptid, struct target_waitstatus *status) | ||
513 | 513 | "Process record: break at 0x%s.\n", |
514 | 514 | paddr_nz (tmp_pc)); |
515 | 515 | } |
516 | + if (gdbarch_decr_pc_after_break (get_regcache_arch (regcache)) | |
517 | + && !record_resume_step) | |
518 | + { | |
519 | + regcache_write_pc (regcache, | |
520 | + tmp_pc + | |
521 | + gdbarch_decr_pc_after_break | |
522 | + (get_regcache_arch (regcache))); | |
523 | + } | |
516 | 524 | goto replay_out; |
517 | 525 | } |
518 | 526 | } |
@@ -655,6 +663,15 @@ record_wait (ptid_t ptid, struct target_waitstatus *status) | ||
655 | 663 | "Process record: break at 0x%s.\n", |
656 | 664 | paddr_nz (tmp_pc)); |
657 | 665 | } |
666 | + if (gdbarch_decr_pc_after_break (get_regcache_arch (regcache)) | |
667 | + && execution_direction == EXEC_FORWARD | |
668 | + && !record_resume_step) | |
669 | + { | |
670 | + regcache_write_pc (regcache, | |
671 | + tmp_pc + | |
672 | + gdbarch_decr_pc_after_break | |
673 | + (get_regcache_arch (regcache))); | |
674 | + } | |
658 | 675 | continue_flag = 0; |
659 | 676 | } |
660 | 677 | } |