sim: move engine init to dynamic modules.c
[binutils-gdb.git] / sim / common / sim-trace.c
index 5e84e13deca0d6c6375625adcbe4824d80901b71..2c3798933db34fc724c56c96aaf9c3dda8af5bc3 100644 (file)
@@ -1,5 +1,5 @@
 /* Simulator tracing/debugging support.
-   Copyright (C) 1997-2016 Free Software Foundation, Inc.
+   Copyright (C) 1997-2021 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
 This file is part of GDB, the GNU debugger.
@@ -17,10 +17,14 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-io.h"
 #include "sim-options.h"
 #include "sim-fpu.h"
+#include "sim/callback.h"
 
 #include "bfd.h"
 #include "libiberty.h"
@@ -29,16 +33,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "sim-assert.h"
 
-#ifdef HAVE_STRING_H
 #include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
-#endif
 
 #ifndef SIZE_PHASE
 #define SIZE_PHASE 8
@@ -897,7 +893,7 @@ dis_read (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
   return 0;
 }
 
-static int
+static int ATTRIBUTE_PRINTF (2, 3)
 dis_printf (SIM_CPU *cpu, const char *fmt, ...)
 {
   SIM_DESC sd = CPU_STATE (cpu);
@@ -919,7 +915,11 @@ trace_disasm (SIM_DESC sd, sim_cpu *cpu, address_word addr)
   if (trace_data->dis_bfd != bfd)
     {
       trace_data->dis_bfd = bfd;
-      trace_data->disassembler = disassembler (trace_data->dis_bfd);
+      trace_data->disassembler
+       = disassembler (bfd_get_arch (trace_data->dis_bfd),
+                       bfd_big_endian (trace_data->dis_bfd),
+                       bfd_get_mach (trace_data->dis_bfd),
+                       trace_data->dis_bfd);
       INIT_DISASSEMBLE_INFO (*info, cpu, dis_printf);
       info->read_memory_func = dis_read;
       info->arch = bfd_get_arch (bfd);