aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-01-21 22:17:59 -0500
committerMike Frysinger <vapier@gentoo.org>2016-08-15 07:00:11 -0700
commit5357150c97899af2cc93072780a9c3a128c5b1ae (patch)
treef61415d77e934b9f54994e92e7f00b30da499890 /sim
parent31925464a80970e37c06192a0c49f8948a2f5da0 (diff)
downloadgdb-5357150c97899af2cc93072780a9c3a128c5b1ae.zip
gdb-5357150c97899af2cc93072780a9c3a128c5b1ae.tar.gz
gdb-5357150c97899af2cc93072780a9c3a128c5b1ae.tar.bz2
sim: unify symbol table handling
The common sim tracing code already handles loading and tracking of symbols from the target program so that it can show symbol info in trace/disassembly calls. Once we touch up the trace code and add a few API callbacks, ports don't need to do loading and searching of symbol tables themselves anymore.
Diffstat (limited to 'sim')
-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
-rw-r--r--sim/common/ChangeLog12
-rw-r--r--sim/common/sim-base.h4
-rw-r--r--sim/common/sim-trace.c89
-rw-r--r--sim/common/sim-trace.h4
-rw-r--r--sim/lm32/ChangeLog6
-rw-r--r--sim/lm32/sim-if.c24
-rw-r--r--sim/m68hc11/ChangeLog6
-rw-r--r--sim/m68hc11/interp.c49
-rw-r--r--sim/msp430/ChangeLog10
-rw-r--r--sim/msp430/msp430-sim.c46
-rw-r--r--sim/msp430/sim-main.h8
17 files changed, 164 insertions, 170 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 */
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index e8da2b1..0d4ec46 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,15 @@
+2016-08-15 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-base.h (sim_state_base): Add prog_syms_count.
+ (STATE_PROG_SYMS_COUNT): Define.
+ * sim-trace.c (trace_uninstall): Free STATE_PROG_SYMS memory.
+ (trace_load_symbols): New function.
+ (trace_sym_value): Likewise.
+ (trace_prefix): Change STATE_CPU(cpu) to sd. Replace symbol
+ loading logic with a call to trace_load_symbols.
+ * sim-trace.h (trace_load_symbols, trace_sym_value): New
+ prototypes.
+
2016-08-13 Mike Frysinger <vapier@gentoo.org>
* cgen-types.h (mode_names): Mark const.
diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h
index 350b352..76167eb 100644
--- a/sim/common/sim-base.h
+++ b/sim/common/sim-base.h
@@ -160,6 +160,10 @@ typedef struct {
struct bfd_symbol **prog_syms;
#define STATE_PROG_SYMS(sd) ((sd)->base.prog_syms)
+ /* Number of prog_syms symbols. */
+ long prog_syms_count;
+#define STATE_PROG_SYMS_COUNT(sd) ((sd)->base.prog_syms_count)
+
/* The program's text section. */
struct bfd_section *text_section;
/* Starting and ending text section addresses from the bfd. */
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
index e299cf8..5e84e13 100644
--- a/sim/common/sim-trace.c
+++ b/sim/common/sim-trace.c
@@ -510,6 +510,9 @@ trace_uninstall (SIM_DESC sd)
fclose (cfile);
}
}
+
+ if (STATE_PROG_SYMS (sd))
+ free (STATE_PROG_SYMS (sd));
}
/* compute the nr of trace data units consumed by data */
@@ -685,6 +688,57 @@ trace_results (SIM_DESC sd,
trace_printf (sd, cpu, "\n");
}
+int
+trace_load_symbols (SIM_DESC sd)
+{
+ bfd *abfd;
+ asymbol **asymbols;
+ long symsize;
+ long symbol_count;
+
+ /* Already loaded, so nothing to do. */
+ if (STATE_PROG_SYMS (sd))
+ return 1;
+
+ abfd = STATE_PROG_BFD (sd);
+ if (abfd == NULL)
+ return 0;
+
+ symsize = bfd_get_symtab_upper_bound (abfd);
+ if (symsize < 0)
+ return 0;
+
+ asymbols = xmalloc (symsize);
+ symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
+ if (symbol_count < 0)
+ {
+ free (asymbols);
+ return 0;
+ }
+
+ STATE_PROG_SYMS (sd) = asymbols;
+ STATE_PROG_SYMS_COUNT (sd) = symbol_count;
+ return 1;
+}
+
+bfd_vma
+trace_sym_value (SIM_DESC sd, const char *name)
+{
+ asymbol **asymbols;
+ long i;
+
+ if (!trace_load_symbols (sd))
+ return -1;
+
+ asymbols = STATE_PROG_SYMS (sd);
+
+ for (i = 0; i < STATE_PROG_SYMS_COUNT (sd); ++i)
+ if (strcmp (asymbols[i]->name, name) == 0)
+ return bfd_asymbol_value (asymbols[i]);
+
+ return -1;
+}
+
void
trace_prefix (SIM_DESC sd,
sim_cpu *cpu,
@@ -744,9 +798,9 @@ trace_prefix (SIM_DESC sd,
{
char buf[256];
buf[0] = 0;
- if (STATE_TEXT_SECTION (CPU_STATE (cpu))
- && pc >= STATE_TEXT_START (CPU_STATE (cpu))
- && pc < STATE_TEXT_END (CPU_STATE (cpu)))
+ if (STATE_TEXT_SECTION (sd)
+ && pc >= STATE_TEXT_START (sd)
+ && pc < STATE_TEXT_END (sd))
{
const char *pc_filename = (const char *)0;
const char *pc_function = (const char *)0;
@@ -754,31 +808,14 @@ trace_prefix (SIM_DESC sd,
bfd *abfd;
asymbol **asymbols;
- abfd = STATE_PROG_BFD (CPU_STATE (cpu));
- asymbols = STATE_PROG_SYMS (CPU_STATE (cpu));
- if (asymbols == NULL)
- {
- long symsize;
- long symbol_count;
+ if (!trace_load_symbols (sd))
+ sim_engine_abort (sd, cpu, cia, "could not load symbols");
- symsize = bfd_get_symtab_upper_bound (abfd);
- if (symsize < 0)
- {
- sim_engine_abort (sd, cpu, cia, "could not read symbols");
- }
- asymbols = (asymbol **) xmalloc (symsize);
- symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
- if (symbol_count < 0)
- {
- sim_engine_abort (sd, cpu, cia, "could not canonicalize symbols");
- }
- STATE_PROG_SYMS (CPU_STATE (cpu)) = asymbols;
- }
+ abfd = STATE_PROG_BFD (sd);
+ asymbols = STATE_PROG_SYMS (sd);
- if (bfd_find_nearest_line (abfd,
- STATE_TEXT_SECTION (CPU_STATE (cpu)),
- asymbols,
- pc - STATE_TEXT_START (CPU_STATE (cpu)),
+ if (bfd_find_nearest_line (abfd, STATE_TEXT_SECTION (sd), asymbols,
+ pc - STATE_TEXT_START (sd),
&pc_filename, &pc_function, &pc_linenum))
{
char *p = buf;
diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h
index 40de5bf..d3392ae 100644
--- a/sim/common/sim-trace.h
+++ b/sim/common/sim-trace.h
@@ -671,6 +671,10 @@ extern void trace_vprintf (SIM_DESC, sim_cpu *, const char *, va_list);
/* Non-zero if "--debug-insn" specified. */
#define DEBUG_INSN_P(cpu) DEBUG_P (cpu, DEBUG_INSN_IDX)
+/* Symbol related helpers. */
+int trace_load_symbols (SIM_DESC);
+bfd_vma trace_sym_value (SIM_DESC, const char *name);
+
extern void sim_debug_printf (sim_cpu *, const char *, ...)
__attribute__((format (printf, 2, 3)));
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index c1b442d..51869ba 100644
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,3 +1,9 @@
+2016-08-15 Mike Frysinger <vapier@gentoo.org>
+
+ * sim-if.c (find_limit): Change prototype to take a SIM_DESC.
+ Replace symbol lookup code with a call to trace_sym_value.
+ (sim_open): Update find_limit call.
+
2016-01-10 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index 860c1e6..aad3a35 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -71,27 +71,15 @@ find_base (bfd *prog_bfd)
}
static unsigned long
-find_limit (bfd *prog_bfd)
+find_limit (SIM_DESC sd)
{
- struct bfd_symbol **asymbols;
- long symsize;
- long symbol_count;
- long s;
+ bfd_vma addr;
- symsize = bfd_get_symtab_upper_bound (prog_bfd);
- if (symsize < 0)
- return 0;
- asymbols = (asymbol **) xmalloc (symsize);
- symbol_count = bfd_canonicalize_symtab (prog_bfd, asymbols);
- if (symbol_count < 0)
+ addr = trace_sym_value (sd, "_fstack");
+ if (addr == -1)
return 0;
- for (s = 0; s < symbol_count; s++)
- {
- if (!strcmp (asymbols[s]->name, "_fstack"))
- return (asymbols[s]->value + 65536) & ~(0xffffUL);
- }
- return 0;
+ return (addr + 65536) & ~(0xffffUL);
}
/* Create an instance of the simulator. */
@@ -159,7 +147,7 @@ sim_open (kind, callback, abfd, argv)
{
/* It doesn't, so we should try to allocate enough memory to hold program. */
base = find_base (STATE_PROG_BFD (sd));
- limit = find_limit (STATE_PROG_BFD (sd));
+ limit = find_limit (sd);
if (limit == 0)
{
sim_io_eprintf (sd,
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index e7619d3..5564c0a 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,9 @@
+2016-08-15 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (sim_get_bank_parameters): Delete abfd arg.
+ Replace all symbol lookup code with calls to trace_sym_value.
+ (sim_prepare_for_program): Update sim_get_bank_parameters call.
+
2016-08-13 Mike Frysinger <vapier@gentoo.org>
* dv-m68hc11.c (m68hc11cpu_port_event): Adjust cpu prototype style.
diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c
index ab20571..8a80656 100644
--- a/sim/m68hc11/interp.c
+++ b/sim/m68hc11/interp.c
@@ -292,50 +292,25 @@ sim_hw_configure (SIM_DESC sd)
/* Get the memory bank parameters by looking at the global symbols
defined by the linker. */
static int
-sim_get_bank_parameters (SIM_DESC sd, bfd* abfd)
+sim_get_bank_parameters (SIM_DESC sd)
{
sim_cpu *cpu;
- long symsize;
- long symbol_count, i;
unsigned size;
- asymbol** asymbols;
- asymbol** current;
+ bfd_vma addr;
cpu = STATE_CPU (sd, 0);
- symsize = bfd_get_symtab_upper_bound (abfd);
- if (symsize < 0)
- {
- sim_io_eprintf (sd, "Cannot read symbols of program");
- return 0;
- }
- asymbols = (asymbol **) xmalloc (symsize);
- symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
- if (symbol_count < 0)
- {
- sim_io_eprintf (sd, "Cannot read symbols of program");
- return 0;
- }
+ addr = trace_sym_value (sd, BFD_M68HC11_BANK_START_NAME);
+ if (addr != -1)
+ cpu->bank_start = addr;
- size = 0;
- for (i = 0, current = asymbols; i < symbol_count; i++, current++)
- {
- const char* name = bfd_asymbol_name (*current);
+ size = trace_sym_value (sd, BFD_M68HC11_BANK_SIZE_NAME);
+ if (size == -1)
+ size = 0;
- if (strcmp (name, BFD_M68HC11_BANK_START_NAME) == 0)
- {
- cpu->bank_start = bfd_asymbol_value (*current);
- }
- else if (strcmp (name, BFD_M68HC11_BANK_SIZE_NAME) == 0)
- {
- size = bfd_asymbol_value (*current);
- }
- else if (strcmp (name, BFD_M68HC11_BANK_VIRTUAL_NAME) == 0)
- {
- cpu->bank_virtual = bfd_asymbol_value (*current);
- }
- }
- free (asymbols);
+ addr = trace_sym_value (sd, BFD_M68HC11_BANK_VIRTUAL_NAME);
+ if (addr != -1)
+ cpu->bank_virtual = addr;
cpu->bank_end = cpu->bank_start + size;
cpu->bank_shift = 0;
@@ -387,7 +362,7 @@ sim_prepare_for_program (SIM_DESC sd, bfd* abfd)
if (elf_flags & E_M68HC12_BANKS)
{
- if (sim_get_bank_parameters (sd, abfd) != 0)
+ if (sim_get_bank_parameters (sd) != 0)
sim_io_eprintf (sd, "Memory bank parameters are not initialized\n");
}
}
diff --git a/sim/msp430/ChangeLog b/sim/msp430/ChangeLog
index 9f06b48..b78b96f 100644
--- a/sim/msp430/ChangeLog
+++ b/sim/msp430/ChangeLog
@@ -1,3 +1,13 @@
+2016-08-15 Mike Frysinger <vapier@gentoo.org>
+
+ * msp430-sim.c: Delete bfd.h include.
+ (lookup_symbol, msp430_sim_close): Delete.
+ (sim_open): Change lookup_symbol to trace_sym_value.
+ * sim-main.h (struct sim_state): Delete symbol_table and
+ number_of_symbols.
+ (STATE_SYMBOL_TABLE, STATE_NUM_SYMBOLS, msp430_sim_close,
+ SIM_CLOSE_HOOK): Delete.
+
2016-01-10 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/msp430/msp430-sim.c b/sim/msp430/msp430-sim.c
index 5a6b3ed..4971cb8 100644
--- a/sim/msp430/msp430-sim.c
+++ b/sim/msp430/msp430-sim.c
@@ -26,7 +26,6 @@
#include <inttypes.h>
#include <unistd.h>
#include <assert.h>
-#include "bfd.h"
#include "opcode/msp430-decode.h"
#include "sim-main.h"
#include "sim-syscall.h"
@@ -44,39 +43,6 @@ msp430_pc_store (SIM_CPU *cpu, sim_cia newpc)
cpu->state.regs[0] = newpc;
}
-static long
-lookup_symbol (SIM_DESC sd, const char *name)
-{
- struct bfd *abfd = STATE_PROG_BFD (sd);
- asymbol **symbol_table = STATE_SYMBOL_TABLE (sd);
- long number_of_symbols = STATE_NUM_SYMBOLS (sd);
- long i;
-
- if (abfd == NULL)
- return -1;
-
- if (symbol_table == NULL)
- {
- long storage_needed;
-
- storage_needed = bfd_get_symtab_upper_bound (abfd);
- if (storage_needed <= 0)
- return -1;
-
- STATE_SYMBOL_TABLE (sd) = symbol_table = xmalloc (storage_needed);
- STATE_NUM_SYMBOLS (sd) = number_of_symbols =
- bfd_canonicalize_symtab (abfd, symbol_table);
- }
-
- for (i = 0; i < number_of_symbols; i++)
- if (strcmp (symbol_table[i]->name, name) == 0)
- {
- long val = symbol_table[i]->section->vma + symbol_table[i]->value;
- return val;
- }
- return -1;
-}
-
static int
msp430_reg_fetch (SIM_CPU *cpu, int regno, unsigned char *buf, int len)
{
@@ -207,20 +173,14 @@ sim_open (SIM_OPEN_KIND kind,
assert (MAX_NR_PROCESSORS == 1);
msp430_initialize_cpu (sd, MSP430_CPU (sd));
- MSP430_CPU (sd)->state.cio_breakpoint = lookup_symbol (sd, "C$$IO$$");
- MSP430_CPU (sd)->state.cio_buffer = lookup_symbol (sd, "__CIOBUF__");
+ MSP430_CPU (sd)->state.cio_breakpoint = trace_sym_value (sd, "C$$IO$$");
+ MSP430_CPU (sd)->state.cio_buffer = trace_sym_value (sd, "__CIOBUF__");
if (MSP430_CPU (sd)->state.cio_buffer == -1)
- MSP430_CPU (sd)->state.cio_buffer = lookup_symbol (sd, "_CIOBUF_");
+ MSP430_CPU (sd)->state.cio_buffer = trace_sym_value (sd, "_CIOBUF_");
return sd;
}
-void
-msp430_sim_close (SIM_DESC sd, int quitting)
-{
- free (STATE_SYMBOL_TABLE (sd));
-}
-
SIM_RC
sim_create_inferior (SIM_DESC sd,
struct bfd *abfd,
diff --git a/sim/msp430/sim-main.h b/sim/msp430/sim-main.h
index 4a2ab22..da48ec6 100644
--- a/sim/msp430/sim-main.h
+++ b/sim/msp430/sim-main.h
@@ -37,11 +37,6 @@ struct sim_state
{
sim_cpu *cpu[MAX_NR_PROCESSORS];
- asymbol **symbol_table;
- long number_of_symbols;
-#define STATE_SYMBOL_TABLE(sd) ((sd)->symbol_table)
-#define STATE_NUM_SYMBOLS(sd) ((sd)->number_of_symbols)
-
/* Simulator specific members. */
sim_state_base base;
};
@@ -54,7 +49,4 @@ struct sim_state
#include "sim-engine.h"
#include "sim-options.h"
-extern void msp430_sim_close (SIM_DESC sd, int quitting);
-#define SIM_CLOSE_HOOK(...) msp430_sim_close (__VA_ARGS__)
-
#endif /* _MSP430_MAIN_SIM_H_ */