aboutsummaryrefslogtreecommitdiff
path: root/sim/aarch64
diff options
context:
space:
mode:
Diffstat (limited to 'sim/aarch64')
-rw-r--r--sim/aarch64/ChangeLog19
-rw-r--r--sim/aarch64/interp.c38
-rw-r--r--sim/aarch64/memory.c7
-rw-r--r--sim/aarch64/memory.h3
-rw-r--r--sim/aarch64/simulator.c6
-rw-r--r--sim/aarch64/simulator.h3
6 files changed, 38 insertions, 38 deletions
diff --git a/sim/aarch64/ChangeLog b/sim/aarch64/ChangeLog
index c6d635c..dcb4ac9 100644
--- a/sim/aarch64/ChangeLog
+++ b/sim/aarch64/ChangeLog
@@ -1,3 +1,22 @@
+2016-08-15 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c: Include bfd.h.
+ (symcount, symtab, aarch64_get_sym_value): Delete.
+ (remove_useless_symbols): Change count type to long.
+ (aarch64_get_func): Add SIM_DESC to arg list. Add symcount
+ and symtab local variables.
+ (sim_create_inferior): Delete storage. Replace symbol code
+ with a call to trace_load_symbols.
+ * memory.c: Delete bfd.h, elf/internal.h, and elf/common.h
+ includes.
+ (aarch64_get_heap_start): Change aarch64_get_sym_value to
+ trace_sym_value.
+ * memory.h: Delete bfd.h include.
+ (mem_add_blk): Delete unused prototype.
+ * simulator.c (bl, blr): Pass SIM_DESC to aarch64_get_func.
+ * simulator.c (aarch64_get_func): Add SIM_DESC to arg list.
+ (aarch64_get_sym_value): Delete.
+
2016-08-12 Nick Clifton <nickc@redhat.com>
* simulator.c (aarch64_step): Revert pervious delta.
diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
index 2a3ff26..2c72c13 100644
--- a/sim/aarch64/interp.c
+++ b/sim/aarch64/interp.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include "ansidecl.h"
+#include "bfd.h"
#include "gdb/callback.h"
#include "gdb/remote-sim.h"
#include "gdb/signals.h"
@@ -38,15 +39,12 @@
#include "memory.h"
#include "simulator.h"
-static unsigned long symcount = 0;
-static asymbol ** symtab = NULL;
-
/* Filter out (in place) symbols that are useless for disassembly.
COUNT is the number of elements in SYMBOLS.
Return the number of useful symbols. */
-static unsigned long
-remove_useless_symbols (asymbol **symbols, unsigned long count)
+static long
+remove_useless_symbols (asymbol **symbols, long count)
{
asymbol **in_ptr = symbols;
asymbol **out_ptr = symbols;
@@ -87,8 +85,10 @@ compare_symbols (const void *ap, const void *bp)
/* Find the name of the function at ADDR. */
const char *
-aarch64_get_func (uint64_t addr)
+aarch64_get_func (SIM_DESC sd, uint64_t addr)
{
+ long symcount = STATE_PROG_SYMS_COUNT (sd);
+ asymbol **symtab = STATE_PROG_SYMS (sd);
int min, max;
min = -1;
@@ -118,24 +118,11 @@ aarch64_get_func (uint64_t addr)
return "";
}
-uint64_t
-aarch64_get_sym_value (const char *name)
-{
- unsigned long i;
-
- for (i = 0; i < symcount; i++)
- if (strcmp (bfd_asymbol_name (symtab[i]), name) == 0)
- return bfd_asymbol_value (symtab[i]);
-
- return 0;
-}
-
SIM_RC
sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
char * const *argv, char * const *env)
{
sim_cpu *cpu = STATE_CPU (sd, 0);
- long storage = 0;
bfd_vma addr = 0;
if (abfd != NULL)
@@ -154,14 +141,13 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
STATE_PROG_ARGV (sd) = dupargv (argv);
}
- if (abfd != NULL)
- storage = bfd_get_symtab_upper_bound (abfd);
- if (storage > 0)
+ if (trace_load_symbols (sd))
{
- symtab = (asymbol **) xmalloc (storage);
- symcount = bfd_canonicalize_symtab (abfd, symtab);
- symcount = remove_useless_symbols (symtab, symcount);
- qsort (symtab, symcount, sizeof (asymbol *), compare_symbols);
+ STATE_PROG_SYMS_COUNT (sd) =
+ remove_useless_symbols (STATE_PROG_SYMS (sd),
+ STATE_PROG_SYMS_COUNT (sd));
+ qsort (STATE_PROG_SYMS (sd), STATE_PROG_SYMS_COUNT (sd),
+ sizeof (asymbol *), compare_symbols);
}
aarch64_init (cpu, addr);
diff --git a/sim/aarch64/memory.c b/sim/aarch64/memory.c
index 94c549f..744a76d 100644
--- a/sim/aarch64/memory.c
+++ b/sim/aarch64/memory.c
@@ -25,10 +25,7 @@
#include <stdlib.h>
#include <string.h>
-#include "bfd.h"
#include "libiberty.h"
-#include "elf/internal.h"
-#include "elf/common.h"
#include "memory.h"
#include "simulator.h"
@@ -163,10 +160,10 @@ aarch64_get_mem_ptr (sim_cpu *cpu, uint64_t address)
uint64_t
aarch64_get_heap_start (sim_cpu *cpu)
{
- uint64_t heap = aarch64_get_sym_value ("end");
+ uint64_t heap = trace_sym_value (CPU_STATE (cpu), "end");
if (heap == 0)
- heap = aarch64_get_sym_value ("_end");
+ heap = trace_sym_value (CPU_STATE (cpu), "_end");
if (heap == 0)
{
heap = STACK_TOP - 0x100000;
diff --git a/sim/aarch64/memory.h b/sim/aarch64/memory.h
index 3f63973..5a0a4ad 100644
--- a/sim/aarch64/memory.h
+++ b/sim/aarch64/memory.h
@@ -23,7 +23,6 @@
#define _MEMORY_H
#include <sys/types.h>
-#include "bfd.h"
#include "simulator.h"
extern void aarch64_get_mem_long_double (sim_cpu *, uint64_t, FRegister *);
@@ -53,6 +52,4 @@ extern void aarch64_set_mem_s8 (sim_cpu *, uint64_t, int8_t);
extern uint64_t aarch64_get_heap_start (sim_cpu *);
extern uint64_t aarch64_get_stack_start (sim_cpu *);
-extern void mem_add_blk (sim_cpu *, uint64_t, char *, uint64_t, bfd_boolean);
-
#endif /* _MEMORY_H */
diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c
index 67e61e7..e5ada18 100644
--- a/sim/aarch64/simulator.c
+++ b/sim/aarch64/simulator.c
@@ -13163,7 +13163,8 @@ bl (sim_cpu *cpu, int32_t offset)
" %*scall %" PRIx64 " [%s]"
" [args: %" PRIx64 " %" PRIx64 " %" PRIx64 "]",
stack_depth, " ", aarch64_get_next_PC (cpu),
- aarch64_get_func (aarch64_get_next_PC (cpu)),
+ aarch64_get_func (CPU_STATE (cpu),
+ aarch64_get_next_PC (cpu)),
aarch64_get_reg_u64 (cpu, 0, NO_SP),
aarch64_get_reg_u64 (cpu, 1, NO_SP),
aarch64_get_reg_u64 (cpu, 2, NO_SP)
@@ -13202,7 +13203,8 @@ blr (sim_cpu *cpu)
" %*scall %" PRIx64 " [%s]"
" [args: %" PRIx64 " %" PRIx64 " %" PRIx64 "]",
stack_depth, " ", aarch64_get_next_PC (cpu),
- aarch64_get_func (aarch64_get_next_PC (cpu)),
+ aarch64_get_func (CPU_STATE (cpu),
+ aarch64_get_next_PC (cpu)),
aarch64_get_reg_u64 (cpu, 0, NO_SP),
aarch64_get_reg_u64 (cpu, 1, NO_SP),
aarch64_get_reg_u64 (cpu, 2, NO_SP)
diff --git a/sim/aarch64/simulator.h b/sim/aarch64/simulator.h
index 128d242..fbee1ce 100644
--- a/sim/aarch64/simulator.h
+++ b/sim/aarch64/simulator.h
@@ -46,8 +46,7 @@ extern void aarch64_init (sim_cpu *, uint64_t);
hit an error. */
extern void aarch64_run (SIM_DESC);
-extern const char * aarch64_get_func (uint64_t);
-extern uint64_t aarch64_get_sym_value (const char *);
+extern const char * aarch64_get_func (SIM_DESC, uint64_t);
extern void aarch64_init_LIT_table (void);
#endif /* _SIMULATOR_H */