tests/arm-cpu-features: Do not assume PMU availability
[qemu/ar7.git] / disas / objdump.c
blob9859f234195011dd8d560714a0e4cfd51cfb6d6d
1 /*
2 * Dump disassembly as text, for processing by scripts/disas-objdump.pl.
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
6 #include "qemu/osdep.h"
7 #include "disas-internal.h"
10 static int print_insn_objdump(bfd_vma pc, disassemble_info *info,
11 const char *prefix)
13 int i, n = info->buffer_length;
14 g_autofree uint8_t *buf = g_malloc(n);
16 if (info->read_memory_func(pc, buf, n, info) == 0) {
17 for (i = 0; i < n; ++i) {
18 if (i % 32 == 0) {
19 info->fprintf_func(info->stream, "\n%s: ", prefix);
21 info->fprintf_func(info->stream, "%02x", buf[i]);
23 } else {
24 info->fprintf_func(info->stream, "unable to read memory");
26 return n;
29 int print_insn_od_host(bfd_vma pc, disassemble_info *info)
31 return print_insn_objdump(pc, info, "OBJD-H");
34 int print_insn_od_target(bfd_vma pc, disassemble_info *info)
36 return print_insn_objdump(pc, info, "OBJD-T");