Commit 5a38f081904fdae0251fb16befc2cdb4bc894e27
1 parent
73822ec8
Adopt cpu_copy to new breakpoint API (Jan Kaszka)
Latest changes to the cpu_breakpoint/watchpoint API broke cpu_copy. This patch fixes it by cloning the breakpoint and watchpoint lists appropriately. Thanks to Lionel Landwerlin for pointing out. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6321 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
23 additions
and
1 deletions
exec.c
| ... | ... | @@ -1654,12 +1654,34 @@ void cpu_abort(CPUState *env, const char *fmt, ...) |
| 1654 | 1654 | CPUState *cpu_copy(CPUState *env) |
| 1655 | 1655 | { |
| 1656 | 1656 | CPUState *new_env = cpu_init(env->cpu_model_str); |
| 1657 | - /* preserve chaining and index */ | |
| 1658 | 1657 | CPUState *next_cpu = new_env->next_cpu; |
| 1659 | 1658 | int cpu_index = new_env->cpu_index; |
| 1659 | +#if defined(TARGET_HAS_ICE) | |
| 1660 | + CPUBreakpoint *bp; | |
| 1661 | + CPUWatchpoint *wp; | |
| 1662 | +#endif | |
| 1663 | + | |
| 1660 | 1664 | memcpy(new_env, env, sizeof(CPUState)); |
| 1665 | + | |
| 1666 | + /* Preserve chaining and index. */ | |
| 1661 | 1667 | new_env->next_cpu = next_cpu; |
| 1662 | 1668 | new_env->cpu_index = cpu_index; |
| 1669 | + | |
| 1670 | + /* Clone all break/watchpoints. | |
| 1671 | + Note: Once we support ptrace with hw-debug register access, make sure | |
| 1672 | + BP_CPU break/watchpoints are handled correctly on clone. */ | |
| 1673 | + TAILQ_INIT(&env->breakpoints); | |
| 1674 | + TAILQ_INIT(&env->watchpoints); | |
| 1675 | +#if defined(TARGET_HAS_ICE) | |
| 1676 | + TAILQ_FOREACH(bp, &env->breakpoints, entry) { | |
| 1677 | + cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL); | |
| 1678 | + } | |
| 1679 | + TAILQ_FOREACH(wp, &env->watchpoints, entry) { | |
| 1680 | + cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1, | |
| 1681 | + wp->flags, NULL); | |
| 1682 | + } | |
| 1683 | +#endif | |
| 1684 | + | |
| 1663 | 1685 | return new_env; |
| 1664 | 1686 | } |
| 1665 | 1687 | ... | ... |