mirror of https://gitlab.com/qemu-project/qemu
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
988 B
C
38 lines
988 B
C
/*
|
|
* Dump disassembly as text, for processing by scripts/disas-objdump.pl.
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "disas-internal.h"
|
|
|
|
|
|
static int print_insn_objdump(bfd_vma pc, disassemble_info *info,
|
|
const char *prefix)
|
|
{
|
|
int i, n = info->buffer_length;
|
|
g_autofree uint8_t *buf = g_malloc(n);
|
|
|
|
if (info->read_memory_func(pc, buf, n, info) == 0) {
|
|
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]);
|
|
}
|
|
} else {
|
|
info->fprintf_func(info->stream, "unable to read memory");
|
|
}
|
|
return n;
|
|
}
|
|
|
|
int print_insn_od_host(bfd_vma pc, disassemble_info *info)
|
|
{
|
|
return print_insn_objdump(pc, info, "OBJD-H");
|
|
}
|
|
|
|
int print_insn_od_target(bfd_vma pc, disassemble_info *info)
|
|
{
|
|
return print_insn_objdump(pc, info, "OBJD-T");
|
|
}
|