2003-04-29 22:41:16 +02:00
|
|
|
/* General "disassemble this chunk" code. Used for debugging. */
|
2016-01-29 18:50:05 +01:00
|
|
|
#include "qemu/osdep.h"
|
2019-04-17 21:18:04 +02:00
|
|
|
#include "disas/dis-asm.h"
|
2003-04-29 22:41:16 +02:00
|
|
|
#include "elf.h"
|
2019-04-17 21:18:03 +02:00
|
|
|
#include "qemu/qemu-print.h"
|
2003-04-29 22:41:16 +02:00
|
|
|
|
2012-10-24 11:12:21 +02:00
|
|
|
#include "disas/disas.h"
|
2017-09-14 18:41:12 +02:00
|
|
|
#include "disas/capstone.h"
|
2003-10-27 22:13:58 +01:00
|
|
|
|
2012-09-08 14:40:00 +02:00
|
|
|
typedef struct CPUDebug {
|
|
|
|
struct disassemble_info info;
|
2015-05-24 23:20:41 +02:00
|
|
|
CPUState *cpu;
|
2012-09-08 14:40:00 +02:00
|
|
|
} CPUDebug;
|
|
|
|
|
2003-04-29 22:41:16 +02:00
|
|
|
/* Filled in by elfload.c. Simplistic, but will do for now. */
|
2004-12-20 00:18:01 +01:00
|
|
|
struct syminfo *syminfos = NULL;
|
2003-04-29 22:41:16 +02:00
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
/*
|
|
|
|
* Get LENGTH bytes from info's buffer, at host address memaddr.
|
|
|
|
* Transfer them to myaddr.
|
|
|
|
*/
|
|
|
|
static int host_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
|
|
|
|
struct disassemble_info *info)
|
2003-06-09 17:23:31 +02:00
|
|
|
{
|
2003-10-27 22:13:58 +01:00
|
|
|
if (memaddr < info->buffer_vma
|
2020-09-10 23:40:54 +02:00
|
|
|
|| memaddr + length > info->buffer_vma + info->buffer_length) {
|
2003-10-27 22:13:58 +01:00
|
|
|
/* Out of bounds. Use EIO because GDB uses it. */
|
|
|
|
return EIO;
|
2020-09-10 23:40:54 +02:00
|
|
|
}
|
2003-10-27 22:13:58 +01:00
|
|
|
memcpy (myaddr, info->buffer + (memaddr - info->buffer_vma), length);
|
|
|
|
return 0;
|
2003-06-09 17:23:31 +02:00
|
|
|
}
|
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
/*
|
|
|
|
* Get LENGTH bytes from info's buffer, at target address memaddr.
|
|
|
|
* Transfer them to myaddr.
|
|
|
|
*/
|
|
|
|
static int target_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
|
|
|
|
struct disassemble_info *info)
|
2003-10-27 22:13:58 +01:00
|
|
|
{
|
2012-09-08 14:40:00 +02:00
|
|
|
CPUDebug *s = container_of(info, CPUDebug, info);
|
2020-09-10 23:40:54 +02:00
|
|
|
int r = cpu_memory_rw_debug(s->cpu, memaddr, myaddr, length, 0);
|
2020-05-18 17:53:04 +02:00
|
|
|
return r ? EIO : 0;
|
2003-10-27 22:13:58 +01:00
|
|
|
}
|
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
/*
|
|
|
|
* Print an error message. We can assume that this is in response to
|
|
|
|
* an error return from {host,target}_read_memory.
|
|
|
|
*/
|
|
|
|
static void perror_memory(int status, bfd_vma memaddr,
|
|
|
|
struct disassemble_info *info)
|
2003-06-09 17:23:31 +02:00
|
|
|
{
|
2020-09-10 23:40:54 +02:00
|
|
|
if (status != EIO) {
|
|
|
|
/* Can't happen. */
|
|
|
|
info->fprintf_func(info->stream, "Unknown error %d\n", status);
|
|
|
|
} else {
|
|
|
|
/* Address between memaddr and memaddr + len was out of bounds. */
|
|
|
|
info->fprintf_func(info->stream,
|
|
|
|
"Address 0x%" PRIx64 " is out of bounds.\n",
|
|
|
|
memaddr);
|
|
|
|
}
|
2003-06-09 17:23:31 +02:00
|
|
|
}
|
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
/* Print address in hex. */
|
|
|
|
static void print_address(bfd_vma addr, struct disassemble_info *info)
|
2003-06-09 17:23:31 +02:00
|
|
|
{
|
2020-09-10 23:40:54 +02:00
|
|
|
info->fprintf_func(info->stream, "0x%" PRIx64, addr);
|
2003-06-09 17:23:31 +02:00
|
|
|
}
|
|
|
|
|
2012-06-25 06:55:55 +02:00
|
|
|
/* Print address in hex, truncated to the width of a host virtual address. */
|
2020-09-10 23:40:54 +02:00
|
|
|
static void host_print_address(bfd_vma addr, struct disassemble_info *info)
|
2012-06-25 06:55:55 +02:00
|
|
|
{
|
2020-09-10 23:40:54 +02:00
|
|
|
print_address((uintptr_t)addr, info);
|
2012-06-25 06:55:55 +02:00
|
|
|
}
|
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
/* Stub prevents some fruitless earching in optabs disassemblers. */
|
|
|
|
static int symbol_at_address(bfd_vma addr, struct disassemble_info *info)
|
2003-06-09 17:23:31 +02:00
|
|
|
{
|
2020-09-10 23:40:54 +02:00
|
|
|
return 1;
|
2003-06-09 17:23:31 +02:00
|
|
|
}
|
|
|
|
|
2013-08-17 08:29:45 +02:00
|
|
|
static int print_insn_objdump(bfd_vma pc, disassemble_info *info,
|
|
|
|
const char *prefix)
|
|
|
|
{
|
|
|
|
int i, n = info->buffer_length;
|
|
|
|
uint8_t *buf = g_malloc(n);
|
|
|
|
|
|
|
|
info->read_memory_func(pc, buf, n, info);
|
|
|
|
|
|
|
|
for (i = 0; i < n; ++i) {
|
|
|
|
if (i % 32 == 0) {
|
|
|
|
info->fprintf_func(info->stream, "\n%s: ", prefix);
|
|
|
|
}
|
|
|
|
info->fprintf_func(info->stream, "%02x", buf[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free(buf);
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int print_insn_od_host(bfd_vma pc, disassemble_info *info)
|
|
|
|
{
|
|
|
|
return print_insn_objdump(pc, info, "OBJD-H");
|
|
|
|
}
|
|
|
|
|
|
|
|
static int print_insn_od_target(bfd_vma pc, disassemble_info *info)
|
|
|
|
{
|
|
|
|
return print_insn_objdump(pc, info, "OBJD-T");
|
|
|
|
}
|
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
static void initialize_debug(CPUDebug *s)
|
|
|
|
{
|
|
|
|
memset(s, 0, sizeof(*s));
|
|
|
|
s->info.arch = bfd_arch_unknown;
|
|
|
|
s->info.cap_arch = -1;
|
|
|
|
s->info.cap_insn_unit = 4;
|
|
|
|
s->info.cap_insn_split = 4;
|
|
|
|
s->info.memory_error_func = perror_memory;
|
|
|
|
s->info.symbol_at_address_func = symbol_at_address;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void initialize_debug_target(CPUDebug *s, CPUState *cpu)
|
|
|
|
{
|
|
|
|
initialize_debug(s);
|
|
|
|
|
|
|
|
s->cpu = cpu;
|
|
|
|
s->info.read_memory_func = target_read_memory;
|
|
|
|
s->info.print_address_func = print_address;
|
|
|
|
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
|
s->info.endian = BFD_ENDIAN_BIG;
|
|
|
|
#else
|
|
|
|
s->info.endian = BFD_ENDIAN_LITTLE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
|
|
|
if (cc->disas_set_info) {
|
|
|
|
cc->disas_set_info(cpu, &s->info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void initialize_debug_host(CPUDebug *s)
|
|
|
|
{
|
|
|
|
initialize_debug(s);
|
|
|
|
|
|
|
|
s->info.read_memory_func = host_read_memory;
|
|
|
|
s->info.print_address_func = host_print_address;
|
|
|
|
#ifdef HOST_WORDS_BIGENDIAN
|
|
|
|
s->info.endian = BFD_ENDIAN_BIG;
|
|
|
|
#else
|
|
|
|
s->info.endian = BFD_ENDIAN_LITTLE;
|
|
|
|
#endif
|
|
|
|
#if defined(CONFIG_TCG_INTERPRETER)
|
|
|
|
s->info.print_insn = print_insn_tci;
|
|
|
|
#elif defined(__i386__)
|
|
|
|
s->info.mach = bfd_mach_i386_i386;
|
|
|
|
s->info.print_insn = print_insn_i386;
|
|
|
|
s->info.cap_arch = CS_ARCH_X86;
|
|
|
|
s->info.cap_mode = CS_MODE_32;
|
|
|
|
s->info.cap_insn_unit = 1;
|
|
|
|
s->info.cap_insn_split = 8;
|
|
|
|
#elif defined(__x86_64__)
|
|
|
|
s->info.mach = bfd_mach_x86_64;
|
|
|
|
s->info.print_insn = print_insn_i386;
|
|
|
|
s->info.cap_arch = CS_ARCH_X86;
|
|
|
|
s->info.cap_mode = CS_MODE_64;
|
|
|
|
s->info.cap_insn_unit = 1;
|
|
|
|
s->info.cap_insn_split = 8;
|
|
|
|
#elif defined(_ARCH_PPC)
|
|
|
|
s->info.disassembler_options = (char *)"any";
|
|
|
|
s->info.print_insn = print_insn_ppc;
|
|
|
|
s->info.cap_arch = CS_ARCH_PPC;
|
|
|
|
# ifdef _ARCH_PPC64
|
|
|
|
s->info.cap_mode = CS_MODE_64;
|
|
|
|
# endif
|
|
|
|
#elif defined(__riscv) && defined(CONFIG_RISCV_DIS)
|
|
|
|
#if defined(_ILP32) || (__riscv_xlen == 32)
|
|
|
|
s->info.print_insn = print_insn_riscv32;
|
|
|
|
#elif defined(_LP64)
|
|
|
|
s->info.print_insn = print_insn_riscv64;
|
|
|
|
#else
|
|
|
|
#error unsupported RISC-V ABI
|
|
|
|
#endif
|
2020-09-12 02:59:01 +02:00
|
|
|
#elif defined(__aarch64__)
|
2020-09-10 23:40:54 +02:00
|
|
|
s->info.cap_arch = CS_ARCH_ARM64;
|
2020-09-12 02:59:01 +02:00
|
|
|
# ifdef CONFIG_ARM_A64_DIS
|
|
|
|
s->info.print_insn = print_insn_arm_a64;
|
|
|
|
# endif
|
2020-09-10 23:40:54 +02:00
|
|
|
#elif defined(__alpha__)
|
|
|
|
s->info.print_insn = print_insn_alpha;
|
|
|
|
#elif defined(__sparc__)
|
|
|
|
s->info.print_insn = print_insn_sparc;
|
|
|
|
s->info.mach = bfd_mach_sparc_v9b;
|
|
|
|
#elif defined(__arm__)
|
|
|
|
/* TCG only generates code for arm mode. */
|
|
|
|
s->info.print_insn = print_insn_arm;
|
|
|
|
s->info.cap_arch = CS_ARCH_ARM;
|
|
|
|
#elif defined(__MIPSEB__)
|
|
|
|
s->info.print_insn = print_insn_big_mips;
|
|
|
|
#elif defined(__MIPSEL__)
|
|
|
|
s->info.print_insn = print_insn_little_mips;
|
|
|
|
#elif defined(__m68k__)
|
|
|
|
s->info.print_insn = print_insn_m68k;
|
|
|
|
#elif defined(__s390__)
|
|
|
|
s->info.print_insn = print_insn_s390;
|
2020-01-03 22:24:59 +01:00
|
|
|
s->info.cap_arch = CS_ARCH_SYSZ;
|
|
|
|
s->info.cap_insn_unit = 2;
|
|
|
|
s->info.cap_insn_split = 6;
|
2020-09-10 23:40:54 +02:00
|
|
|
#elif defined(__hppa__)
|
|
|
|
s->info.print_insn = print_insn_hppa;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2017-09-14 17:38:35 +02:00
|
|
|
/* Disassemble this for me please... (debugging). */
|
2015-05-24 23:20:41 +02:00
|
|
|
void target_disas(FILE *out, CPUState *cpu, target_ulong code,
|
2017-09-14 17:38:35 +02:00
|
|
|
target_ulong size)
|
2003-04-29 22:41:16 +02:00
|
|
|
{
|
2005-01-04 00:35:10 +01:00
|
|
|
target_ulong pc;
|
2003-04-29 22:41:16 +02:00
|
|
|
int count;
|
2012-09-08 14:40:00 +02:00
|
|
|
CPUDebug s;
|
2003-04-29 22:41:16 +02:00
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
initialize_debug_target(&s, cpu);
|
|
|
|
s.info.fprintf_func = fprintf;
|
|
|
|
s.info.stream = out;
|
2012-09-08 14:40:00 +02:00
|
|
|
s.info.buffer_vma = code;
|
|
|
|
s.info.buffer_length = size;
|
2015-06-24 05:57:33 +02:00
|
|
|
|
2017-09-14 18:41:12 +02:00
|
|
|
if (s.info.cap_arch >= 0 && cap_disas_target(&s.info, code, size)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-06-24 05:57:32 +02:00
|
|
|
if (s.info.print_insn == NULL) {
|
|
|
|
s.info.print_insn = print_insn_od_target;
|
2013-08-17 08:29:45 +02:00
|
|
|
}
|
2003-10-27 22:13:58 +01:00
|
|
|
|
2009-02-13 22:44:41 +01:00
|
|
|
for (pc = code; size > 0; pc += count, size -= count) {
|
2005-02-01 00:32:31 +01:00
|
|
|
fprintf(out, "0x" TARGET_FMT_lx ": ", pc);
|
2015-06-24 05:57:32 +02:00
|
|
|
count = s.info.print_insn(pc, &s.info);
|
2005-01-04 00:35:10 +01:00
|
|
|
fprintf(out, "\n");
|
|
|
|
if (count < 0)
|
|
|
|
break;
|
2009-04-22 00:26:22 +02:00
|
|
|
if (size < count) {
|
|
|
|
fprintf(out,
|
|
|
|
"Disassembler disagrees with translator over instruction "
|
|
|
|
"decoding\n"
|
|
|
|
"Please report this to qemu-devel@nongnu.org\n");
|
|
|
|
break;
|
|
|
|
}
|
2005-01-04 00:35:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-22 11:27:14 +02:00
|
|
|
static int plugin_printf(FILE *stream, const char *fmt, ...)
|
|
|
|
{
|
2020-09-11 00:13:38 +02:00
|
|
|
/* We abuse the FILE parameter to pass a GString. */
|
|
|
|
GString *s = (GString *)stream;
|
2019-05-22 11:27:14 +02:00
|
|
|
int initial_len = s->len;
|
2020-09-11 00:13:38 +02:00
|
|
|
va_list va;
|
2019-05-22 11:27:14 +02:00
|
|
|
|
|
|
|
va_start(va, fmt);
|
|
|
|
g_string_append_vprintf(s, fmt, va);
|
|
|
|
va_end(va);
|
|
|
|
|
|
|
|
return s->len - initial_len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void plugin_print_address(bfd_vma addr, struct disassemble_info *info)
|
|
|
|
{
|
|
|
|
/* does nothing */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We should only be dissembling one instruction at a time here. If
|
|
|
|
* there is left over it usually indicates the front end has read more
|
|
|
|
* bytes than it needed.
|
|
|
|
*/
|
|
|
|
char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size)
|
|
|
|
{
|
|
|
|
CPUDebug s;
|
2020-09-11 00:13:38 +02:00
|
|
|
GString *ds = g_string_new(NULL);
|
2019-05-22 11:27:14 +02:00
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
initialize_debug_target(&s, cpu);
|
|
|
|
s.info.fprintf_func = plugin_printf;
|
2020-09-11 00:13:38 +02:00
|
|
|
s.info.stream = (FILE *)ds; /* abuse this slot */
|
2019-05-22 11:27:14 +02:00
|
|
|
s.info.buffer_vma = addr;
|
|
|
|
s.info.buffer_length = size;
|
|
|
|
s.info.print_address_func = plugin_print_address;
|
|
|
|
|
|
|
|
if (s.info.cap_arch >= 0 && cap_disas_plugin(&s.info, addr, size)) {
|
2020-09-11 00:13:38 +02:00
|
|
|
; /* done */
|
|
|
|
} else if (s.info.print_insn) {
|
|
|
|
s.info.print_insn(addr, &s.info);
|
|
|
|
} else {
|
|
|
|
; /* cannot disassemble -- return empty string */
|
2019-05-22 11:27:14 +02:00
|
|
|
}
|
|
|
|
|
2020-09-11 00:13:38 +02:00
|
|
|
/* Return the buffer, freeing the GString container. */
|
|
|
|
return g_string_free(ds, false);
|
2019-05-22 11:27:14 +02:00
|
|
|
}
|
|
|
|
|
2005-01-04 00:35:10 +01:00
|
|
|
/* Disassemble this for me please... (debugging). */
|
2020-10-31 04:59:01 +01:00
|
|
|
void disas(FILE *out, const void *code, unsigned long size)
|
2005-01-04 00:35:10 +01:00
|
|
|
{
|
2012-04-12 15:44:35 +02:00
|
|
|
uintptr_t pc;
|
2005-01-04 00:35:10 +01:00
|
|
|
int count;
|
2012-09-08 14:40:00 +02:00
|
|
|
CPUDebug s;
|
2005-01-04 00:35:10 +01:00
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
initialize_debug_host(&s);
|
|
|
|
s.info.fprintf_func = fprintf;
|
|
|
|
s.info.stream = out;
|
2012-09-08 14:40:00 +02:00
|
|
|
s.info.buffer = code;
|
|
|
|
s.info.buffer_vma = (uintptr_t)code;
|
|
|
|
s.info.buffer_length = size;
|
2017-09-14 18:41:12 +02:00
|
|
|
|
2020-09-10 21:15:04 +02:00
|
|
|
if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) {
|
2017-09-14 18:41:12 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
if (s.info.print_insn == NULL) {
|
|
|
|
s.info.print_insn = print_insn_od_host;
|
2013-08-17 08:29:45 +02:00
|
|
|
}
|
2012-04-12 15:44:35 +02:00
|
|
|
for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) {
|
|
|
|
fprintf(out, "0x%08" PRIxPTR ": ", pc);
|
2020-09-10 23:40:54 +02:00
|
|
|
count = s.info.print_insn(pc, &s.info);
|
2020-05-13 19:51:32 +02:00
|
|
|
fprintf(out, "\n");
|
|
|
|
if (count < 0) {
|
|
|
|
break;
|
|
|
|
}
|
2003-04-29 22:41:16 +02:00
|
|
|
}
|
2020-05-13 19:51:32 +02:00
|
|
|
|
2003-04-29 22:41:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Look up symbol for debugging purpose. Returns "" if unknown. */
|
2005-01-04 00:35:10 +01:00
|
|
|
const char *lookup_symbol(target_ulong orig_addr)
|
2003-04-29 22:41:16 +02:00
|
|
|
{
|
2008-10-22 17:11:31 +02:00
|
|
|
const char *symbol = "";
|
2004-12-20 00:18:01 +01:00
|
|
|
struct syminfo *s;
|
2007-09-17 10:09:54 +02:00
|
|
|
|
2004-12-20 00:18:01 +01:00
|
|
|
for (s = syminfos; s; s = s->next) {
|
2008-10-22 17:11:31 +02:00
|
|
|
symbol = s->lookup_symbol(s, orig_addr);
|
|
|
|
if (symbol[0] != '\0') {
|
|
|
|
break;
|
|
|
|
}
|
2003-04-29 22:41:16 +02:00
|
|
|
}
|
2008-10-22 17:11:31 +02:00
|
|
|
|
|
|
|
return symbol;
|
2003-04-29 22:41:16 +02:00
|
|
|
}
|
2004-04-04 14:57:25 +02:00
|
|
|
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
|
2012-12-17 18:19:49 +01:00
|
|
|
#include "monitor/monitor.h"
|
2004-08-01 23:49:07 +02:00
|
|
|
|
2004-04-04 14:57:25 +02:00
|
|
|
static int
|
2017-09-19 16:40:40 +02:00
|
|
|
physical_read_memory(bfd_vma memaddr, bfd_byte *myaddr, int length,
|
2008-08-17 22:21:51 +02:00
|
|
|
struct disassemble_info *info)
|
2004-04-04 14:57:25 +02:00
|
|
|
{
|
2018-12-14 14:30:49 +01:00
|
|
|
CPUDebug *s = container_of(info, CPUDebug, info);
|
2020-05-18 17:53:04 +02:00
|
|
|
MemTxResult res;
|
2018-12-14 14:30:49 +01:00
|
|
|
|
2020-05-18 17:53:04 +02:00
|
|
|
res = address_space_read(s->cpu->as, memaddr, MEMTXATTRS_UNSPECIFIED,
|
|
|
|
myaddr, length);
|
|
|
|
return res == MEMTX_OK ? 0 : EIO;
|
2004-04-04 14:57:25 +02:00
|
|
|
}
|
|
|
|
|
2017-09-14 17:38:35 +02:00
|
|
|
/* Disassembler for the monitor. */
|
2015-05-24 23:20:41 +02:00
|
|
|
void monitor_disas(Monitor *mon, CPUState *cpu,
|
2017-09-14 17:38:35 +02:00
|
|
|
target_ulong pc, int nb_insn, int is_physical)
|
2004-04-04 14:57:25 +02:00
|
|
|
{
|
|
|
|
int count, i;
|
2012-09-08 14:40:00 +02:00
|
|
|
CPUDebug s;
|
2004-04-04 14:57:25 +02:00
|
|
|
|
2020-09-10 23:40:54 +02:00
|
|
|
initialize_debug_target(&s, cpu);
|
|
|
|
s.info.fprintf_func = qemu_fprintf;
|
|
|
|
if (is_physical) {
|
|
|
|
s.info.read_memory_func = physical_read_memory;
|
2015-06-24 05:57:33 +02:00
|
|
|
}
|
2020-09-10 23:40:54 +02:00
|
|
|
s.info.buffer_vma = pc;
|
2015-06-24 05:57:33 +02:00
|
|
|
|
2017-09-14 18:41:12 +02:00
|
|
|
if (s.info.cap_arch >= 0 && cap_disas_monitor(&s.info, pc, nb_insn)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-06-24 05:57:33 +02:00
|
|
|
if (!s.info.print_insn) {
|
|
|
|
monitor_printf(mon, "0x" TARGET_FMT_lx
|
|
|
|
": Asm output not supported on this arch\n", pc);
|
|
|
|
return;
|
|
|
|
}
|
2004-04-04 14:57:25 +02:00
|
|
|
|
|
|
|
for(i = 0; i < nb_insn; i++) {
|
2009-03-06 00:01:23 +01:00
|
|
|
monitor_printf(mon, "0x" TARGET_FMT_lx ": ", pc);
|
2015-06-24 05:57:32 +02:00
|
|
|
count = s.info.print_insn(pc, &s.info);
|
2009-03-06 00:01:23 +01:00
|
|
|
monitor_printf(mon, "\n");
|
2004-04-04 14:57:25 +02:00
|
|
|
if (count < 0)
|
|
|
|
break;
|
|
|
|
pc += count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|