Commit 3d2cfdf169da61ef5571aad8e7ae3ee0486b6060
1 parent
6fcfafb7
output disassembled code to monitor console
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1033 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
15 additions
and
6 deletions
disas.c
... | ... | @@ -222,6 +222,9 @@ const char *lookup_symbol(void *orig_addr) |
222 | 222 | |
223 | 223 | #if !defined(CONFIG_USER_ONLY) |
224 | 224 | |
225 | +void term_vprintf(const char *fmt, va_list ap); | |
226 | +void term_printf(const char *fmt, ...); | |
227 | + | |
225 | 228 | static int monitor_disas_is_physical; |
226 | 229 | |
227 | 230 | static int |
... | ... | @@ -239,16 +242,22 @@ monitor_read_memory (memaddr, myaddr, length, info) |
239 | 242 | return 0; |
240 | 243 | } |
241 | 244 | |
245 | +static int monitor_fprintf(FILE *stream, const char *fmt, ...) | |
246 | +{ | |
247 | + va_list ap; | |
248 | + va_start(ap, fmt); | |
249 | + term_vprintf(fmt, ap); | |
250 | + va_end(ap); | |
251 | + return 0; | |
252 | +} | |
253 | + | |
242 | 254 | void monitor_disas(target_ulong pc, int nb_insn, int is_physical, int flags) |
243 | 255 | { |
244 | - FILE *out; | |
245 | 256 | int count, i; |
246 | 257 | struct disassemble_info disasm_info; |
247 | 258 | int (*print_insn)(bfd_vma pc, disassemble_info *info); |
248 | 259 | |
249 | - out = stdout; | |
250 | - | |
251 | - INIT_DISASSEMBLE_INFO(disasm_info, out, fprintf); | |
260 | + INIT_DISASSEMBLE_INFO(disasm_info, NULL, monitor_fprintf); | |
252 | 261 | |
253 | 262 | monitor_disas_is_physical = is_physical; |
254 | 263 | 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) |
278 | 287 | #endif |
279 | 288 | |
280 | 289 | for(i = 0; i < nb_insn; i++) { |
281 | - fprintf(out, "0x%08lx: ", (unsigned long)pc); | |
290 | + term_printf("0x%08lx: ", (unsigned long)pc); | |
282 | 291 | count = print_insn(pc, &disasm_info); |
283 | - fprintf(out, "\n"); | |
292 | + term_printf("\n"); | |
284 | 293 | if (count < 0) |
285 | 294 | break; |
286 | 295 | pc += count; | ... | ... |