aboutsummaryrefslogtreecommitdiff
path: root/sim/aarch64/interp.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-12-30 23:26:05 -0500
committerMike Frysinger <vapier@gentoo.org>2016-01-05 14:37:46 -0500
commit1a846c62626357f9e966ef50917dca3a357c9644 (patch)
tree6e2eca8ef139daf4a31880dda49f460de3a3a335 /sim/aarch64/interp.c
parent824c862804128f6d31ae5f80fb741d12419da943 (diff)
downloadfsf-binutils-gdb-1a846c62626357f9e966ef50917dca3a357c9644.zip
fsf-binutils-gdb-1a846c62626357f9e966ef50917dca3a357c9644.tar.gz
fsf-binutils-gdb-1a846c62626357f9e966ef50917dca3a357c9644.tar.bz2
sim: aarch64: switch to common disassembler tracing
The output should largely be the same.
Diffstat (limited to 'sim/aarch64/interp.c')
-rw-r--r--sim/aarch64/interp.c96
1 files changed, 0 insertions, 96 deletions
diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
index 9b9dc48..7dc0a2b 100644
--- a/sim/aarch64/interp.c
+++ b/sim/aarch64/interp.c
@@ -38,58 +38,9 @@
#include "memory.h"
#include "simulator.h"
-#include "dis-asm.h"
-
-static struct disassemble_info info;
static unsigned long symcount = 0;
static asymbol ** symtab = NULL;
-/* FIXME: 1000 characters should be enough to hold the disassembled
- instruction plus any comments that come after it. But maybe with
- C++ programs this might not be enough. Not sure if it is worth
- adding logic to dynamically grow the buffer though. */
-static char opbuf[1000];
-
-static int op_printf (void *, const char *, ...) ATTRIBUTE_FPTR_PRINTF_2;
-
-static int
-op_printf (void *stream ATTRIBUTE_UNUSED, const char *fmt, ...)
-{
- size_t space_remaining;
- int ret;
- va_list ap;
-
- space_remaining = sizeof (opbuf) - strlen (opbuf);
- va_start (ap, fmt);
- /* Instead of printing to stream we store the text in opbuf.
- This allows us to use the sim_io_eprintf routine to output
- the text in aarch64_print_insn. */
- ret = vsnprintf (opbuf + strlen (opbuf), space_remaining, fmt, ap);
- va_end (ap);
- return ret;
-}
-
-void
-aarch64_print_insn (SIM_DESC sd, uint64_t addr)
-{
- int size;
-
- opbuf[0] = 0;
- size = print_insn_aarch64 (addr, & info);
- sim_io_eprintf (sd, " %*s\n", size, opbuf);
-}
-
-static int
-sim_dis_read (bfd_vma memaddr,
- bfd_byte * ptr,
- unsigned int length,
- struct disassemble_info * info)
-{
- aarch64_get_mem_blk (info->application_data, memaddr, (char *) ptr, length);
-
- return 0;
-}
-
/* Filter out (in place) symbols that are useless for disassembly.
COUNT is the number of elements in SYMBOLS.
Return the number of useful symbols. */
@@ -202,16 +153,6 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
STATE_PROG_ARGV (sd) = dupargv (argv);
}
- memset (& info, 0, sizeof (info));
- init_disassemble_info (& info, NULL, op_printf);
- info.read_memory_func = sim_dis_read;
- info.arch = bfd_get_arch (abfd);
- info.mach = bfd_get_mach (abfd);
- info.application_data = cpu;
- if (info.mach == 0)
- info.arch = bfd_arch_aarch64;
- disassemble_init_for_target (& info);
-
storage = bfd_get_symtab_upper_bound (abfd);
if (storage > 0)
{
@@ -384,41 +325,6 @@ free_state (SIM_DESC sd)
sim_state_free (sd);
}
-enum
-{
- OPTION_DISAS = OPTION_START,
-};
-
-static SIM_RC
-aarch64_option_handler (SIM_DESC sd ATTRIBUTE_UNUSED,
- sim_cpu * current_cpu ATTRIBUTE_UNUSED,
- int opt,
- char * arg ATTRIBUTE_UNUSED,
- int is_command ATTRIBUTE_UNUSED)
-{
- switch (opt)
- {
- case OPTION_DISAS:
- disas = TRUE;
- return SIM_RC_OK;
-
- default:
- sim_io_eprintf (sd, "Unknown AArch64 option %d\n", opt);
- return SIM_RC_FAIL;
- }
-}
-
-static DECLARE_OPTION_HANDLER (aarch64_option_handler);
-
-const OPTION aarch64_options[] =
-{
- { {"disas", no_argument, NULL, OPTION_DISAS },
- '\0', NULL, "Enable instruction disassembly",
- aarch64_option_handler, NULL },
-
- { {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL, NULL }
-};
-
SIM_DESC
sim_open (SIM_OPEN_KIND kind,
struct host_callback_struct * callback,
@@ -434,8 +340,6 @@ sim_open (SIM_OPEN_KIND kind,
SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
- sim_add_option_table (sd, NULL, aarch64_options);
-
/* Perform the initialization steps one by one. */
if (sim_cpu_alloc_all (sd, 1, 0) != SIM_RC_OK
|| sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK