aboutsummaryrefslogtreecommitdiff
path: root/sim/lm32
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/lm32
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/lm32')
-rw-r--r--sim/lm32/ChangeLog6
-rw-r--r--sim/lm32/sim-if.c24
2 files changed, 12 insertions, 18 deletions
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,