summaryrefslogtreecommitdiff
path: root/disas.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-08-01 21:49:07 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-08-01 21:49:07 +0000
commit3d2cfdf169da61ef5571aad8e7ae3ee0486b6060 (patch)
tree5bfa49646a75c97e6557ab1bfc9119fb896de57e /disas.c
parent6fcfafb742459e29e29fd61ed174108064643915 (diff)
output disassembled code to monitor console
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1033 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'disas.c')
-rw-r--r--disas.c21
1 files 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;