Received: from eggs.gnu.org ([2001:4830:134:3::10]:58608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehtPv-0001ux-2E for qemu-devel@nongnu.org; Sat, 03 Feb 2018 03:43:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehtPs-0000Sb-Vq for qemu-devel@nongnu.org; Sat, 03 Feb 2018 03:43:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51762) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehtPs-0000RZ-Og for qemu-devel@nongnu.org; Sat, 03 Feb 2018 03:43:20 -0500 From: Markus Armbruster Date: Sat, 3 Feb 2018 09:43:15 +0100 Message-Id: <20180203084315.20497-15-armbru@redhat.com> In-Reply-To: <20180203084315.20497-1-armbru@redhat.com> References: <20180203084315.20497-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v8 14/14] target: Use qemu_log() instead of fprintf(stderr, ...) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: alistair.francis@xilinx.com, eblake@redhat.com, f4bug@amsat.org From: Alistair Francis Convert fprintf(stderr, ...) to use qemu_log(). Double prints in target/ppc/translate.c were manually remove. A fprintf() in target/sh4/translate.c was kept as it's inside a #if 0. The #if 0 and fflush() was removed around the unimplemented log in target/sh4/translate.c as well. Signed-off-by: Alistair Francis [Trivial conflict with 6f1c2af641d resolved] Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/cris/translate.c | 2 +- target/ppc/translate.c | 36 ++++++++++-------------------------- target/sh4/translate.c | 7 ++----- target/unicore32/translate.c | 2 +- 4 files changed, 14 insertions(+), 33 deletions(-) diff --git a/target/cris/translate.c b/target/cris/translate.c index f51a731db9..ff31311ed0 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -137,7 +137,7 @@ typedef struct DisasContext { =20 static void gen_BUG(DisasContext *dc, const char *file, int line) { - fprintf(stderr, "BUG: pc=3D%x %s %d\n", dc->pc, file, line); + qemu_log("BUG: pc=3D%x %s %d\n", dc->pc, file, line); if (qemu_log_separate()) { qemu_log("BUG: pc=3D%x %s %d\n", dc->pc, file, line); } diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 4132f67bb1..172c9f2001 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -3933,12 +3933,8 @@ static inline void gen_op_mfspr(DisasContext *ctx) * allowing userland application to read the PVR */ if (sprn !=3D SPR_PVR) { - fprintf(stderr, "Trying to read privileged spr %d (0x%03= x) at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); - if (qemu_log_separate()) { - qemu_log("Trying to read privileged spr %d (0x%03x) = at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - = 4); - } + qemu_log("Trying to read privileged spr %d (0x%03x) at " + TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); } gen_priv_exception(ctx, POWERPC_EXCP_PRIV_REG); } @@ -3950,12 +3946,8 @@ static inline void gen_op_mfspr(DisasContext *ctx) return; } /* Not defined */ - fprintf(stderr, "Trying to read invalid spr %d (0x%03x) at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); - if (qemu_log_separate()) { - qemu_log("Trying to read invalid spr %d (0x%03x) at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); - } + qemu_log("Trying to read invalid spr %d (0x%03x) at " + TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); =20 /* The behaviour depends on MSR:PR and SPR# bit 0x10, * it can generate a priv, a hv emu or a no-op @@ -4096,12 +4088,8 @@ static void gen_mtspr(DisasContext *ctx) (*write_cb)(ctx, sprn, rS(ctx->opcode)); } else { /* Privilege exception */ - fprintf(stderr, "Trying to write privileged spr %d (0x%03x) = at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); - if (qemu_log_separate()) { - qemu_log("Trying to write privileged spr %d (0x%03x) at = " - TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); - } + qemu_log("Trying to write privileged spr %d (0x%03x) at " + TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); gen_priv_exception(ctx, POWERPC_EXCP_PRIV_REG); } } else { @@ -4113,12 +4101,8 @@ static void gen_mtspr(DisasContext *ctx) } =20 /* Not defined */ - if (qemu_log_separate()) { - qemu_log("Trying to write invalid spr %d (0x%03x) at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); - } - fprintf(stderr, "Trying to write invalid spr %d (0x%03x) at " - TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); + qemu_log("Trying to write invalid spr %d (0x%03x) at " + TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); =20 =20 /* The behaviour depends on MSR:PR and SPR# bit 0x10, @@ -7381,8 +7365,8 @@ void gen_intermediate_code(CPUState *cs, struct Tra= nslationBlock *tb) break; } if (tcg_check_temp_count()) { - fprintf(stderr, "Opcode %02x %02x %02x %02x (%08x) leaked " - "temporaries\n", opc1(ctx.opcode), opc2(ctx.opcode), + qemu_log("Opcode %02x %02x %02x %02x (%08x) leaked " + "temporaries\n", opc1(ctx.opcode), opc2(ctx.opcode)= , opc3(ctx.opcode), opc4(ctx.opcode), ctx.opcode); exit(1); } diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 012156b97b..6c2dca5cf2 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -1827,11 +1827,8 @@ static void _decode_opc(DisasContext * ctx) } break; } -#if 0 - fprintf(stderr, "unknown instruction 0x%04x at pc 0x%08x\n", - ctx->opcode, ctx->base.pc_next); - fflush(stderr); -#endif + qemu_log_mask(LOG_UNIMP, "unknown instruction 0x%04x at pc 0x%08x\n"= , + ctx->opcode, ctx->base.pc_next); do_illegal: if (ctx->envflags & DELAY_SLOT_MASK) { do_illegal_slot: diff --git a/target/unicore32/translate.c b/target/unicore32/translate.c index 5b51f2166d..4b3c0463da 100644 --- a/target/unicore32/translate.c +++ b/target/unicore32/translate.c @@ -1936,7 +1936,7 @@ void gen_intermediate_code(CPUState *cs, Translatio= nBlock *tb) disas_uc32_insn(env, dc); =20 if (num_temps) { - fprintf(stderr, "Internal resource leak before %08x\n", dc->= pc); + qemu_log("Internal resource leak before %08x\n", dc->pc); num_temps =3D 0; } =20 --=20 2.13.6