From 3d2cfdf169da61ef5571aad8e7ae3ee0486b6060 Mon Sep 17 00:00:00 2001 From: bellard Date: Sun, 1 Aug 2004 21:49:07 +0000 Subject: [PATCH] output disassembled code to monitor console git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1033 c046a42c-6fe2-441c-8c8c-71466251a162 --- disas.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/disas.c b/disas.c index e315299ccf..ccdcd2450e 100644 --- a/disas.c +++ b/disas.c @@ -222,6 +222,9 @@ const char *lookup_symbol(void *orig_addr) #if !defined(CONFIG_USER_ONLY) +void term_vprintf(const char *fmt, va_list ap); +void term_printf(const char *fmt, ...); + static int monitor_disas_is_physical; static int @@ -239,16 +242,22 @@ monitor_read_memory (memaddr, myaddr, length, info) return 0; } +static int monitor_fprintf(FILE *stream, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + term_vprintf(fmt, ap); + va_end(ap); + return 0; +} + void monitor_disas(target_ulong pc, int nb_insn, int is_physical, int flags) { - FILE *out; int count, i; struct disassemble_info disasm_info; int (*print_insn)(bfd_vma pc, disassemble_info *info); - out = stdout; - - INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf); + INIT_DISASSEMBLE_INFO(disasm_info, NULL, monitor_fprintf); monitor_disas_is_physical = is_physical; disasm_info.read_memory_func = monitor_read_memory; @@ -278,9 +287,9 @@ void monitor_disas(target_ulong pc, int nb_insn, int is_physical, int flags) #endif for(i = 0; i < nb_insn; i++) { - fprintf(out, "0x%08lx: ", (unsigned long)pc); + term_printf("0x%08lx: ", (unsigned long)pc); count = print_insn(pc, &disasm_info); - fprintf(out, "\n"); + term_printf("\n"); if (count < 0) break; pc += count; -- GitLab