Export the single step function from the AArch64 simulator.
authorNick Clifton <nickc@redhat.com>
Thu, 11 Aug 2016 14:04:40 +0000 (15:04 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 11 Aug 2016 14:04:40 +0000 (15:04 +0100)
* interp.c (sim_create_inferior): Allow for being called with a
NULL abfd parameter.  If a bfd is provided, initialise the sim
with that start address.
* simulator.c (HALT_NYI): Just print out the numeric value of the
instruction when not tracing.
(aarch64_step): Change from static to global.
* simulator.h: Add a prototype for aarch64_step().

sim/aarch64/ChangeLog
sim/aarch64/interp.c
sim/aarch64/simulator.c
sim/aarch64/simulator.h

index 78015efdc095ccbb52786dc940319682efa6370c..d32a81bd41c1d778bad3793233fef76c350e2c97 100644 (file)
@@ -1,3 +1,11 @@
+2016-08-11  Nick Clifton  <nickc@redhat.com>
+
+       * interp.c (sim_create_inferior): Allow for being called with a
+       NULL abfd parameter.  If a bfd is provided, initialise the sim
+       with that start address.
+       * simulator.c (HALT_NYI): Just print out the numeric value of the
+       instruction when not tracing.
+
 2016-07-27  Alan Modra  <amodra@gmail.com>
 
        * memory.c: Don't include libbfd.h.
index 8ae78c43a2b2d4b526bfd59d54bbe780f9394fb0..2a3ff2622a1b30fc3bd2cfcd7c58e0999c13c2f3 100644 (file)
@@ -135,7 +135,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
                     char * const *argv, char * const *env)
 {
   sim_cpu *cpu = STATE_CPU (sd, 0);
-  long storage;
+  long storage = 0;
   bfd_vma addr = 0;
 
   if (abfd != NULL)
@@ -154,7 +154,8 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
       STATE_PROG_ARGV (sd) = dupargv (argv);
     }
 
-  storage = bfd_get_symtab_upper_bound (abfd);
+  if (abfd != NULL)
+    storage = bfd_get_symtab_upper_bound (abfd);
   if (storage > 0)
     {
       symtab = (asymbol **) xmalloc (storage);
@@ -163,7 +164,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
       qsort (symtab, symcount, sizeof (asymbol *), compare_symbols);
     }
 
-  aarch64_init (cpu, bfd_get_start_address (abfd));
+  aarch64_init (cpu, addr);
 
   return SIM_RC_OK;
 }
@@ -332,7 +333,6 @@ sim_open (SIM_OPEN_KIND                  kind,
          struct bfd *                   abfd,
          char * const *                 argv)
 {
-  int i;
   sim_cpu *cpu;
   SIM_DESC sd = sim_state_alloc (kind, callback);
 
index 45844e2f429441f0acd9d96497772cee10a42f05..150bf34e0709db4a459d32bd617a52521e6f8a3b 100644 (file)
                  " exe addr %" PRIx64,                                 \
                  __LINE__, aarch64_get_PC (cpu));                      \
       if (! TRACE_ANY_P (cpu))                                         \
-       {                                                               \
-         sim_io_eprintf (CPU_STATE (cpu), "SIM Error: Unimplemented instruction: "); \
-         trace_disasm (CPU_STATE (cpu), cpu, aarch64_get_PC (cpu));    \
-       }                                                               \
+        sim_io_eprintf (CPU_STATE (cpu), "SIM Error: Unimplemented instruction: %#08x\n", \
+                        aarch64_get_instr (cpu));                      \
       sim_engine_halt (CPU_STATE (cpu), cpu, NULL, aarch64_get_PC (cpu),\
                       sim_stopped, SIM_SIGABRT);                       \
     }                                                                  \
@@ -14074,7 +14072,7 @@ aarch64_decode_and_execute (sim_cpu *cpu, uint64_t pc)
     }
 }
 
-static bfd_boolean
+bfd_boolean
 aarch64_step (sim_cpu *cpu)
 {
   uint64_t pc = aarch64_get_PC (cpu);
index 08bed3d754f35a3ade3e6c8e7189694524fc8fe4..a17bd21860b157c52b717a2794758347dc8ce1e7 100644 (file)
@@ -47,6 +47,10 @@ extern void         aarch64_init (sim_cpu *, uint64_t);
 
 extern void         aarch64_run (SIM_DESC);
 
+/* Call this to execute one instruction at the current PC.  */
+
+extern bfd_boolean  aarch64_step (sim_cpu *);
+
 extern const char * aarch64_get_func (uint64_t);
 extern uint64_t     aarch64_get_sym_value (const char *);
 extern void         aarch64_init_LIT_table (void);