Revision | 522a0d4e3c0d397ffb45ec400d8cbd426dad9d17 (tree) |
---|---|
Time | 2015-10-29 02:57:16 |
Author | Richard Henderson <rth@twid...> |
Commiter | Richard Henderson |
target-*: Advance pc after recognizing a breakpoint
Some targets already had this within their logic, but make sure
it's present for all targets.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
@@ -2917,6 +2917,11 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb) | ||
2917 | 2917 | |
2918 | 2918 | if (unlikely(cpu_breakpoint_test(cs, ctx.pc, BP_ANY))) { |
2919 | 2919 | gen_excp(&ctx, EXCP_DEBUG, 0); |
2920 | + /* The address covered by the breakpoint must be included in | |
2921 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
2922 | + properly cleared -- thus we increment the PC here so that | |
2923 | + the logic setting tb->size below does the right thing. */ | |
2924 | + ctx.pc += 4; | |
2920 | 2925 | break; |
2921 | 2926 | } |
2922 | 2927 | if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) { |
@@ -11096,8 +11096,11 @@ void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb) | ||
11096 | 11096 | dc->is_jmp = DISAS_UPDATE; |
11097 | 11097 | } else { |
11098 | 11098 | gen_exception_internal_insn(dc, 0, EXCP_DEBUG); |
11099 | - /* Advance PC so that clearing the breakpoint will | |
11100 | - invalidate this TB. */ | |
11099 | + /* The address covered by the breakpoint must be | |
11100 | + included in [tb->pc, tb->pc + tb->size) in order | |
11101 | + to for it to be properly cleared -- thus we | |
11102 | + increment the PC here so that the logic setting | |
11103 | + tb->size below does the right thing. */ | |
11101 | 11104 | dc->pc += 4; |
11102 | 11105 | goto done_generating; |
11103 | 11106 | } |
@@ -11378,8 +11378,11 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb) | ||
11378 | 11378 | dc->is_jmp = DISAS_UPDATE; |
11379 | 11379 | } else { |
11380 | 11380 | gen_exception_internal_insn(dc, 0, EXCP_DEBUG); |
11381 | - /* Advance PC so that clearing the breakpoint will | |
11382 | - invalidate this TB. */ | |
11381 | + /* The address covered by the breakpoint must be | |
11382 | + included in [tb->pc, tb->pc + tb->size) in order | |
11383 | + to for it to be properly cleared -- thus we | |
11384 | + increment the PC here so that the logic setting | |
11385 | + tb->size below does the right thing. */ | |
11383 | 11386 | /* TODO: Advance PC by correct instruction length to |
11384 | 11387 | * avoid disassembler error messages */ |
11385 | 11388 | dc->pc += 2; |
@@ -3166,6 +3166,11 @@ void gen_intermediate_code(CPUCRISState *env, struct TranslationBlock *tb) | ||
3166 | 3166 | tcg_gen_movi_tl(env_pc, dc->pc); |
3167 | 3167 | t_gen_raise_exception(EXCP_DEBUG); |
3168 | 3168 | dc->is_jmp = DISAS_UPDATE; |
3169 | + /* The address covered by the breakpoint must be included in | |
3170 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
3171 | + properly cleared -- thus we increment the PC here so that | |
3172 | + the logic setting tb->size below does the right thing. */ | |
3173 | + dc->pc += 2; | |
3169 | 3174 | break; |
3170 | 3175 | } |
3171 | 3176 |
@@ -7962,6 +7962,11 @@ void gen_intermediate_code(CPUX86State *env, TranslationBlock *tb) | ||
7962 | 7962 | tb->flags & HF_RF_MASK |
7963 | 7963 | ? BP_GDB : BP_ANY))) { |
7964 | 7964 | gen_debug(dc, pc_ptr - dc->cs_base); |
7965 | + /* The address covered by the breakpoint must be included in | |
7966 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
7967 | + properly cleared -- thus we increment the PC here so that | |
7968 | + the logic setting tb->size below does the right thing. */ | |
7969 | + pc_ptr += 1; | |
7965 | 7970 | goto done_generating; |
7966 | 7971 | } |
7967 | 7972 | if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) { |
@@ -1078,6 +1078,11 @@ void gen_intermediate_code(CPULM32State *env, struct TranslationBlock *tb) | ||
1078 | 1078 | tcg_gen_movi_tl(cpu_pc, dc->pc); |
1079 | 1079 | t_gen_raise_exception(dc, EXCP_DEBUG); |
1080 | 1080 | dc->is_jmp = DISAS_UPDATE; |
1081 | + /* The address covered by the breakpoint must be included in | |
1082 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
1083 | + properly cleared -- thus we increment the PC here so that | |
1084 | + the logic setting tb->size below does the right thing. */ | |
1085 | + dc->pc += 4; | |
1081 | 1086 | break; |
1082 | 1087 | } |
1083 | 1088 |
@@ -3004,6 +3004,11 @@ void gen_intermediate_code(CPUM68KState *env, TranslationBlock *tb) | ||
3004 | 3004 | if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) { |
3005 | 3005 | gen_exception(dc, dc->pc, EXCP_DEBUG); |
3006 | 3006 | dc->is_jmp = DISAS_JUMP; |
3007 | + /* The address covered by the breakpoint must be included in | |
3008 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
3009 | + properly cleared -- thus we increment the PC here so that | |
3010 | + the logic setting tb->size below does the right thing. */ | |
3011 | + dc->pc += 2; | |
3007 | 3012 | break; |
3008 | 3013 | } |
3009 | 3014 |
@@ -1693,6 +1693,11 @@ void gen_intermediate_code(CPUMBState *env, struct TranslationBlock *tb) | ||
1693 | 1693 | if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) { |
1694 | 1694 | t_gen_raise_exception(dc, EXCP_DEBUG); |
1695 | 1695 | dc->is_jmp = DISAS_UPDATE; |
1696 | + /* The address covered by the breakpoint must be included in | |
1697 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
1698 | + properly cleared -- thus we increment the PC here so that | |
1699 | + the logic setting tb->size below does the right thing. */ | |
1700 | + dc->pc += 4; | |
1696 | 1701 | break; |
1697 | 1702 | } |
1698 | 1703 |
@@ -19594,8 +19594,10 @@ void gen_intermediate_code(CPUMIPSState *env, struct TranslationBlock *tb) | ||
19594 | 19594 | save_cpu_state(&ctx, 1); |
19595 | 19595 | ctx.bstate = BS_BRANCH; |
19596 | 19596 | gen_helper_raise_exception_debug(cpu_env); |
19597 | - /* Include the breakpoint location or the tb won't | |
19598 | - * be flushed when it must be. */ | |
19597 | + /* The address covered by the breakpoint must be included in | |
19598 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
19599 | + properly cleared -- thus we increment the PC here so that | |
19600 | + the logic setting tb->size below does the right thing. */ | |
19599 | 19601 | ctx.pc += 4; |
19600 | 19602 | goto done_generating; |
19601 | 19603 | } |
@@ -848,6 +848,11 @@ void gen_intermediate_code(CPUMoxieState *env, struct TranslationBlock *tb) | ||
848 | 848 | tcg_gen_movi_i32(cpu_pc, ctx.pc); |
849 | 849 | gen_helper_debug(cpu_env); |
850 | 850 | ctx.bstate = BS_EXCP; |
851 | + /* The address covered by the breakpoint must be included in | |
852 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
853 | + properly cleared -- thus we increment the PC here so that | |
854 | + the logic setting tb->size below does the right thing. */ | |
855 | + ctx.pc += 2; | |
851 | 856 | goto done_generating; |
852 | 857 | } |
853 | 858 |
@@ -1665,6 +1665,11 @@ void gen_intermediate_code(CPUOpenRISCState *env, struct TranslationBlock *tb) | ||
1665 | 1665 | tcg_gen_movi_tl(cpu_pc, dc->pc); |
1666 | 1666 | gen_exception(dc, EXCP_DEBUG); |
1667 | 1667 | dc->is_jmp = DISAS_UPDATE; |
1668 | + /* The address covered by the breakpoint must be included in | |
1669 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
1670 | + properly cleared -- thus we increment the PC here so that | |
1671 | + the logic setting tb->size below does the right thing. */ | |
1672 | + dc->pc += 4; | |
1668 | 1673 | break; |
1669 | 1674 | } |
1670 | 1675 |
@@ -11488,6 +11488,11 @@ void gen_intermediate_code(CPUPPCState *env, struct TranslationBlock *tb) | ||
11488 | 11488 | |
11489 | 11489 | if (unlikely(cpu_breakpoint_test(cs, ctx.nip, BP_ANY))) { |
11490 | 11490 | gen_debug_exception(ctxp); |
11491 | + /* The address covered by the breakpoint must be included in | |
11492 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
11493 | + properly cleared -- thus we increment the PC here so that | |
11494 | + the logic setting tb->size below does the right thing. */ | |
11495 | + ctx.nip += 4; | |
11491 | 11496 | break; |
11492 | 11497 | } |
11493 | 11498 |
@@ -5360,6 +5360,11 @@ void gen_intermediate_code(CPUS390XState *env, struct TranslationBlock *tb) | ||
5360 | 5360 | if (unlikely(cpu_breakpoint_test(cs, dc.pc, BP_ANY))) { |
5361 | 5361 | status = EXIT_PC_STALE; |
5362 | 5362 | do_debug = true; |
5363 | + /* The address covered by the breakpoint must be included in | |
5364 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
5365 | + properly cleared -- thus we increment the PC here so that | |
5366 | + the logic setting tb->size below does the right thing. */ | |
5367 | + dc.pc += 2; | |
5363 | 5368 | break; |
5364 | 5369 | } |
5365 | 5370 |
@@ -1855,6 +1855,11 @@ void gen_intermediate_code(CPUSH4State * env, struct TranslationBlock *tb) | ||
1855 | 1855 | tcg_gen_movi_i32(cpu_pc, ctx.pc); |
1856 | 1856 | gen_helper_debug(cpu_env); |
1857 | 1857 | ctx.bstate = BS_BRANCH; |
1858 | + /* The address covered by the breakpoint must be included in | |
1859 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
1860 | + properly cleared -- thus we increment the PC here so that | |
1861 | + the logic setting tb->size below does the right thing. */ | |
1862 | + ctx.pc += 2; | |
1858 | 1863 | break; |
1859 | 1864 | } |
1860 | 1865 |
@@ -5247,6 +5247,7 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb) | ||
5247 | 5247 | tcg_gen_insn_start(dc->pc, dc->npc); |
5248 | 5248 | } |
5249 | 5249 | num_insns++; |
5250 | + last_pc = dc->pc; | |
5250 | 5251 | |
5251 | 5252 | if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) { |
5252 | 5253 | if (dc->pc != pc_start) { |
@@ -5262,7 +5263,6 @@ void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb) | ||
5262 | 5263 | gen_io_start(); |
5263 | 5264 | } |
5264 | 5265 | |
5265 | - last_pc = dc->pc; | |
5266 | 5266 | insn = cpu_ldl_code(env, dc->pc); |
5267 | 5267 | |
5268 | 5268 | disas_sparc_insn(dc, insn); |
@@ -1917,9 +1917,11 @@ void gen_intermediate_code(CPUUniCore32State *env, TranslationBlock *tb) | ||
1917 | 1917 | gen_set_pc_im(dc->pc); |
1918 | 1918 | gen_exception(EXCP_DEBUG); |
1919 | 1919 | dc->is_jmp = DISAS_JUMP; |
1920 | - /* Advance PC so that clearing the breakpoint will | |
1921 | - invalidate this TB. */ | |
1922 | - dc->pc += 2; /* FIXME */ | |
1920 | + /* The address covered by the breakpoint must be included in | |
1921 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
1922 | + properly cleared -- thus we increment the PC here so that | |
1923 | + the logic setting tb->size below does the right thing. */ | |
1924 | + dc->pc += 4; | |
1923 | 1925 | goto done_generating; |
1924 | 1926 | } |
1925 | 1927 |
@@ -3088,6 +3088,11 @@ void gen_intermediate_code(CPUXtensaState *env, TranslationBlock *tb) | ||
3088 | 3088 | tcg_gen_movi_i32(cpu_pc, dc.pc); |
3089 | 3089 | gen_exception(&dc, EXCP_DEBUG); |
3090 | 3090 | dc.is_jmp = DISAS_UPDATE; |
3091 | + /* The address covered by the breakpoint must be included in | |
3092 | + [tb->pc, tb->pc + tb->size) in order to for it to be | |
3093 | + properly cleared -- thus we increment the PC here so that | |
3094 | + the logic setting tb->size below does the right thing. */ | |
3095 | + dc.pc += 2; | |
3091 | 3096 | break; |
3092 | 3097 | } |
3093 | 3098 |