Remove some of the fprintf(stderr, "*
Subsystems (2)
PATCH v4 45/45 target: Use qemu_log() instead of fprintf(stderr, ...)
In reply to Alistair Francis---
target/cris/translate.c | 2 +- target/ppc/translate.c | 22 +++++++++++----------- target/sh4/translate.c | 4 ++-- target/unicore32/translate.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-)
target/cris/translate.c +1 -1
@@ -137,7 +137,7 @@ typedef struct DisasContext {static void gen_BUG (DisasContext *dc,const char *file,int line) { -fprintf (stderr,"BUG: pc=%x %s %d\n" , dc->pc, file, line); +qemu_log ("BUG: pc=%x %s %d\n" , dc->pc, file, line);if (qemu_log_separate ()) {qemu_log ("BUG: pc=%x %s %d\n" , dc->pc, file, line); }
target/ppc/translate.c +11 -11
@@ -3945,11 +3945,11 @@ static inline void gen_op_mfspr(DisasContext *ctx)* allowing userland application to read the PVR */ if (sprn !=SPR_PVR ) { -fprintf (stderr,"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 );if (qemu_log_separate ()) {qemu_log ("Trying to read privileged spr %d (0x%03x) at " - TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); + TARGET_FMT_lx"\n" , sprn, sprn, ctx->nip -4 ); } }gen_priv_exception (ctx,POWERPC_EXCP_PRIV_REG );
@@ -3962,8 +3962,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 ); +qemu_log ("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 );
@@ -4108,8 +4108,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 ); +qemu_log ("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 );
@@ -4129,8 +4129,8 @@ static void gen_mtspr(DisasContext *ctx)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 );/* The behaviour depends on MSR:PR and SPR# bit 0x10,
@@ -7372,8 +7372,8 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *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 ); }
target/sh4/translate.c +2 -2
@@ -427,7 +427,7 @@ static void _decode_opc(DisasContext * ctx) }#if 0 -fprintf (stderr,"Translating opcode 0x%04x\n" , ctx->opcode); +qemu_log ("Translating opcode 0x%04x\n" , ctx->opcode);#endif switch (ctx->opcode) {
@@ -1788,7 +1788,7 @@ static void _decode_opc(DisasContext * ctx)break ; }#if 0 -fprintf (stderr,"unknown instruction 0x%04x at pc 0x%08x\n" , +qemu_log_mask (LOG_UNIMP ,"unknown instruction 0x%04x at pc 0x%08x\n" , ctx->opcode, ctx->pc);fflush (stderr);#endif
target/unicore32/translate.c +1 -1
@@ -1936,7 +1936,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)disas_uc32_insn (env, dc);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 =0 ; }
Signature · 1 line
2.14.1
Hi Alistair,
Quoted 60 lines · Alistair Francis
Continue on improving QEMUs logging/error messages by removing more fprintf()'s.
Unfortunatley my Coccinelle skills aren't that great so it's all done in some nasty regex and a little bit of manual work.
V4:
- Reorder patch 3 (the audio func patch)
- Add all tags
- Small fixes
V3:
- Rebase
- All sorts of style fixes
- Remove "qemu: " prefixes from print messages
V2:
- Fix build issues
- Drop block patches
- Split the hw patches into subdirectories
- RemoveAUDIO_FUNCmacro as well
- Add some__FUNCTION__rename fixes in a seperate patch
- Create aqemu_log()conversion patch for target/Alistair Francis (45):
audio: ReplaceAUDIO_FUNCwith__func__
Replace all occurances of__FUNCTION__with__func__Fixes after renaming__FUNCTION__to__func__
tests: Replace fprintf(stderr, "*\n" witherror_report()hw/arm: Replace fprintf(stderr, "*\n" witherror_report()hw/block: Replace fprintf(stderr, "*\n" witherror_report()hw/bt: Replace fprintf(stderr, "*\n" witherror_report()hw/char: Replace fprintf(stderr, "*\n" witherror_report()hw/core: Replace fprintf(stderr, "*\n" witherror_report()hw/cris: Replace fprintf(stderr, "*\n" witherror_report()hw/display: Replace fprintf(stderr, "*\n" witherror_report()hw/dma: Replace fprintf(stderr, "*\n" witherror_report()hw/gpio: Replace fprintf(stderr, "*\n" witherror_report()hw/i2c: Replace fprintf(stderr, "*\n" witherror_report()hw/i386: Replace fprintf(stderr, "*\n" witherror_report()hw/ide: Replace fprintf(stderr, "*\n" witherror_report()hw/input: Replace fprintf(stderr, "*\n" witherror_report()hw/intc: Replace fprintf(stderr, "*\n" witherror_report()hw/ipmi: Replace fprintf(stderr, "*\n" witherror_report()hw/isa: Replace fprintf(stderr, "*\n" witherror_report()hw/lm32: Replace fprintf(stderr, "*\n" witherror_report()hw/microblaze: Replace fprintf(stderr, "*\n" witherror_report()hw/mips: Replace fprintf(stderr, "*\n" witherror_report()hw/misc: Replace fprintf(stderr, "*\n" witherror_report()hw/moxie: Replace fprintf(stderr, "*\n" witherror_report()hw/net: Replace fprintf(stderr, "*\n" witherror_report()hw/nios2: Replace fprintf(stderr, "*\n" witherror_report()hw/nvram: Replace fprintf(stderr, "*\n" witherror_report()hw/openrisc: Replace fprintf(stderr, "*\n" witherror_report()hw/pci*: Replace fprintf(stderr, "*\n" witherror_report()hw/ppc: Replace fprintf(stderr, "*\n" witherror_report()hw/s390x: Replace fprintf(stderr, "*\n" witherror_report()hw/scsi: Replace fprintf(stderr, "*\n" witherror_report()hw/sd: Replace fprintf(stderr, "*\n" witherror_report()hw/sh4: Replace fprintf(stderr, "*\n" witherror_report()hw/sparc*: Replace fprintf(stderr, "*\n" witherror_report()hw/ssi: Replace fprintf(stderr, "*\n" witherror_report()
Quoted 8 lines
hw/timer: Replace fprintf(stderr, "*\n" with
error_report()hw/usb: Replace fprintf(stderr, "*\n" witherror_report()hw/watchdog: Replace fprintf(stderr, "*\n" witherror_report()hw/xen*: Replace fprintf(stderr, "*\n" witherror_report()
util: Replace fprintf(stderr, "*\n" witherror_report()
ui: Replace fprintf(stderr, "*\n" witherror_report()
tcg: Replace fprintf(stderr, "*\n" witherror_report()
target: Useqemu_log()instead offprintf(stderr, ...)
You should split this series :)
- all the reviewed patches Cc'ing qemu-trivial@,
- respin the rest, it will be much less scary.
Regards,
Phil.