diff mbox series

[v2,3/5] target/tricore: Raise EXCP_DEBUG in gen_goto_tb() for singlestep

Message ID 20200529072148.284037-4-kbastian@mail.uni-paderborn.de
State New
Headers show
Series TriCore fixes and gdbstub | expand

Commit Message

Bastian Koppelmann May 29, 2020, 7:21 a.m. UTC
this is needed for remote gdb connections.

Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
 target/tricore/translate.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Richard Henderson June 1, 2020, 9:04 p.m. UTC | #1
On 5/29/20 12:21 AM, Bastian Koppelmann wrote:
>          if (ctx->base.singlestep_enabled) {
> -            /* raise exception debug */
> +            generate_qemu_excp(ctx, EXCP_DEBUG);
>          }
>          tcg_gen_exit_tb(NULL, 0);

For preference, put an else here:

  if (singlestep) {
    generate_qemu_excp();
  } else {
    tcg_gen_exit_tb();
  }

else you emit dead code after the exception.

r~
diff mbox series

Patch

diff --git a/target/tricore/translate.c b/target/tricore/translate.c
index 608f72d384..7752630ac1 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -3238,6 +3238,14 @@  static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
 #endif
 }
 
+static void generate_qemu_excp(DisasContext *ctx, int excp)
+{
+    TCGv_i32 tmp = tcg_const_i32(excp);
+    gen_helper_qemu_excp(cpu_env, tmp);
+    ctx->base.is_jmp = DISAS_NORETURN;
+    tcg_temp_free(tmp);
+}
+
 static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
 {
     if (use_goto_tb(ctx, dest)) {
@@ -3247,7 +3255,7 @@  static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
     } else {
         gen_save_pc(dest);
         if (ctx->base.singlestep_enabled) {
-            /* raise exception debug */
+            generate_qemu_excp(ctx, EXCP_DEBUG);
         }
         tcg_gen_exit_tb(NULL, 0);
     }
@@ -3266,14 +3274,6 @@  static void generate_trap(DisasContext *ctx, int class, int tin)
     tcg_temp_free(tintemp);
 }
 
-static void generate_qemu_excp(DisasContext *ctx, int excp)
-{
-    TCGv_i32 tmp = tcg_const_i32(excp);
-    gen_helper_qemu_excp(cpu_env, tmp);
-    ctx->base.is_jmp = DISAS_NORETURN;
-    tcg_temp_free(tmp);
-}
-
 static inline void gen_branch_cond(DisasContext *ctx, TCGCond cond, TCGv r1,
                                    TCGv r2, int16_t address)
 {