Skip to contentSkip to conversation

Remove duplicate cpu logging, v2

PATCH New Richard Henderson 1 participant 6 messages Apr 28, 2010

lore
Share & tools
lore
#0 lore raw

cover Remove duplicate cpu logging, v2

Changes from v1->v2:
* Change cpu-exec.c to include the ifdef conditions that had been used in translate.c, i.e. DEBUG_DISAS, enabled by default.

r~

Richard Henderson (5):
target-i386: Remove duplicate CPU log.
target-mips: Remove duplicate CPU log.
target-ppc: Remove duplicate cpu log.
target-sh4: Remove duplicate CPU log.
Enable -d cpu logging by default.

 cpu-exec.c              |   22 +++-------------------
 target-i386/translate.c |    1 -
 target-mips/translate.c |    6 ------
 target-ppc/translate.c  |    2 --
 target-sh4/translate.c  |    6 ------
 5 files changed, 3 insertions(+), 34 deletions(-)
#1 lore raw

PATCH 1/5 target-i386: Remove duplicate CPU log.

The proper logging for -d cpu is done in generic code.

---
 target-i386/translate.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
target-i386/translate.c +0 -1
index 6311b68..38c6016 100644
@@ -7891,7 +7891,6 @@ static inline void gen_intermediate_code_internal(CPUState *env,
     }
 
 #ifdef DEBUG_DISAS
-    log_cpu_state_mask(CPU_LOG_TB_CPU, env, X86_DUMP_CCOP);
     if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
         int disas_flags;
         qemu_log("----------------\n");
Signature · 1 line
1.6.6.1
#2 lore raw

PATCH 2/5 target-mips: Remove duplicate CPU log.

In reply to Richard Henderson

Logging for -d cpu is done in generic code.

---
 target-mips/translate.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
target-mips/translate.c +0 -6
index 7cb539d..c95ecb1 100644
@@ -9426,11 +9426,6 @@ gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
     max_insns = tb->cflags & CF_COUNT_MASK;
     if (max_insns == 0)
         max_insns = CF_COUNT_MASK;
-#ifdef DEBUG_DISAS
-    qemu_log_mask(CPU_LOG_TB_CPU, "------------------------------------------------\n");
-    /* FIXME: This may print out stale hflags from env... */
-    log_cpu_state_mask(CPU_LOG_TB_CPU, env, 0);
-#endif
     LOG_DISAS("\ntb %p idx %d hflags %04x\n", tb, ctx.mem_idx, ctx.hflags);
     gen_icount_start();
     while (ctx.bstate == BS_NONE) {
@@ -9544,7 +9539,6 @@ done_generating:
         log_target_disas(pc_start, ctx.pc - pc_start, 0);
         qemu_log("\n");
     }
-    qemu_log_mask(CPU_LOG_TB_CPU, "---------------- %d %08x\n", ctx.bstate, ctx.hflags);
 #endif
 }
 
Signature · 1 line
1.6.6.1
#3 lore raw

PATCH 3/5 target-ppc: Remove duplicate cpu log.

In reply to Richard Henderson

Logging for -d cpu is done in generic code.

---
 target-ppc/translate.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
target-ppc/translate.c +0 -2
index 3d9d5ee..86cca51 100644
@@ -9109,8 +9109,6 @@ static inline void gen_intermediate_code_internal(CPUState *env,
         tb->icount = num_insns;
     }
 #if defined(DEBUG_DISAS)
-    qemu_log_mask(CPU_LOG_TB_CPU, "---------------- excp: %04x\n", ctx.exception);
-    log_cpu_state_mask(CPU_LOG_TB_CPU, env, 0);
     if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
         int flags;
         flags = env->bfd_mach;
Signature · 1 line
1.6.6.1
#4 lore raw

PATCH 4/5 target-sh4: Remove duplicate CPU log.

In reply to Richard Henderson

Logging for -d cpu is done in generic code.

---
 target-sh4/translate.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
target-sh4/translate.c +0 -6
index 3537f8c..d0d6c00 100644
@@ -1916,12 +1916,6 @@ gen_intermediate_code_internal(CPUState * env, TranslationBlock * tb,
     ctx.features = env->features;
     ctx.has_movcal = (tb->flags & TB_FLAG_PENDING_MOVCA);
 
-#ifdef DEBUG_DISAS
-    qemu_log_mask(CPU_LOG_TB_CPU,
-                 "------------------------------------------------\n");
-    log_cpu_state_mask(CPU_LOG_TB_CPU, env, 0);
-#endif
-
     ii = -1;
     num_insns = 0;
     max_insns = tb->cflags & CF_COUNT_MASK;
Signature · 1 line
1.6.6.1
#5 lore raw

PATCH 5/5 Enable -d cpu logging by default.

In reply to Richard Henderson

When -d cpu logging was handled by target-foo/translate.c, it was controled by DEBUG_DISAS, which is enabled by default. Use the same condition in cpu_exec.

At the same time, reduce the if-deffery by assuming no flags update is required for the target.

---
 cpu-exec.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)
cpu-exec.c +3 -19
index 0f84857..dc81e79 100644
@@ -546,40 +546,24 @@ int cpu_exec(CPUState *env1)
                     env->exception_index = EXCP_INTERRUPT;
                     cpu_loop_exit();
                 }
-#ifdef CONFIG_DEBUG_EXEC
+#if defined(DEBUG_DISAS) || defined(CONFIG_DEBUG_EXEC)
                 if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
                     /* restore flags in standard format */
 #if defined(TARGET_I386)
                     env->eflags = env->eflags | helper_cc_compute_all(CC_OP) | (DF & DF_MASK);
                     log_cpu_state(env, X86_DUMP_CCOP);
                     env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
-#elif defined(TARGET_ARM)
-                    log_cpu_state(env, 0);
-#elif defined(TARGET_SPARC)
-                    log_cpu_state(env, 0);
-#elif defined(TARGET_PPC)
-                    log_cpu_state(env, 0);
 #elif defined(TARGET_M68K)
                     cpu_m68k_flush_flags(env, env->cc_op);
                     env->cc_op = CC_OP_FLAGS;
                     env->sr = (env->sr & 0xffe0)
                               | env->cc_dest | (env->cc_x << 4);
                     log_cpu_state(env, 0);
-#elif defined(TARGET_MICROBLAZE)
-                    log_cpu_state(env, 0);
-#elif defined(TARGET_MIPS)
-                    log_cpu_state(env, 0);
-#elif defined(TARGET_SH4)
-		    log_cpu_state(env, 0);
-#elif defined(TARGET_ALPHA)
-                    log_cpu_state(env, 0);
-#elif defined(TARGET_CRIS)
-                    log_cpu_state(env, 0);
 #else
-#error unsupported target CPU
+                    log_cpu_state(env, 0);
 #endif
                 }
-#endif
+#endif /* DEBUG_DISAS || CONFIG_DEBUG_EXEC */
                 spin_lock(&tb_lock);
                 tb = tb_find_fast();
                 /* Note: we do it here to avoid a gcc bug on Mac OS X when
Signature · 1 line
1.6.6.1