aboutsummaryrefslogtreecommitdiff
path: root/sim/erc32
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-04-04 22:38:04 +0100
committerAndrew Burgess <aburgess@redhat.com>2022-04-04 22:41:24 +0100
commit7b01c1cc1d111ba0afa51e60fa9842d3b971e2d1 (patch)
treeba53406de8080613704aa3247a77dd9a360e1521 /sim/erc32
parent0578e87f93b09e4cc41d3982eb1672bcfc81042d (diff)
downloadgdb-7b01c1cc1d111ba0afa51e60fa9842d3b971e2d1.zip
gdb-7b01c1cc1d111ba0afa51e60fa9842d3b971e2d1.tar.gz
gdb-7b01c1cc1d111ba0afa51e60fa9842d3b971e2d1.tar.bz2
sim: fixes for libopcodes styled disassembler
In commit: commit 60a3da00bd5407f07d64dff82a4dae98230dfaac Date: Sat Jan 22 11:38:18 2022 +0000 objdump/opcodes: add syntax highlighting to disassembler output I broke several sim/ targets by forgetting to update their uses of the libopcodes disassembler to take account of the new styled printing. These should all be fixed by this commit. I've not tried to add actual styled output to the simulator traces, instead, the styled print routines just ignore the style and print the output unstyled.
Diffstat (limited to 'sim/erc32')
-rw-r--r--sim/erc32/interf.c3
-rw-r--r--sim/erc32/sis.c18
-rw-r--r--sim/erc32/sis.h3
3 files changed, 22 insertions, 2 deletions
diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c
index d04d07c..78dec6f 100644
--- a/sim/erc32/interf.c
+++ b/sim/erc32/interf.c
@@ -244,7 +244,8 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *callback,
#ifdef F_GETFL
termsave = fcntl(0, F_GETFL, 0);
#endif
- INIT_DISASSEMBLE_INFO(dinfo, stdout,(fprintf_ftype)fprintf);
+ INIT_DISASSEMBLE_INFO(dinfo, stdout,(fprintf_ftype)fprintf,
+ fprintf_styled);
#ifdef HOST_LITTLE_ENDIAN
dinfo.endian = BFD_ENDIAN_LITTLE;
#else
diff --git a/sim/erc32/sis.c b/sim/erc32/sis.c
index 66a27d0..12eb21f 100644
--- a/sim/erc32/sis.c
+++ b/sim/erc32/sis.c
@@ -139,6 +139,21 @@ run_sim(struct pstate *sregs, uint64_t icount, int dis)
}
int
+fprintf_styled (void *stream, enum disassembler_style style,
+ const char *fmt, ...)
+{
+ int ret;
+ FILE *out = (FILE *) stream;
+ va_list args;
+
+ va_start (args, fmt);
+ ret = vfprintf (out, fmt, args);
+ va_end (args);
+
+ return ret;
+}
+
+int
main(int argc, char **argv)
{
@@ -212,7 +227,8 @@ main(int argc, char **argv)
#endif
sregs.freq = freq;
- INIT_DISASSEMBLE_INFO(dinfo, stdout, (fprintf_ftype) fprintf);
+ INIT_DISASSEMBLE_INFO(dinfo, stdout, (fprintf_ftype) fprintf,
+ (fprintf_styled_ftype) fprintf_styled);
#ifdef HOST_LITTLE_ENDIAN
dinfo.endian = BFD_ENDIAN_LITTLE;
#else
diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
index 33f16c7..3a27667 100644
--- a/sim/erc32/sis.h
+++ b/sim/erc32/sis.h
@@ -18,6 +18,7 @@
#include "sim/sim.h"
#include <sim-config.h>
#include <stdint.h>
+#include "dis-asm.h"
#if HOST_BYTE_ORDER == BIG_ENDIAN
#define HOST_BIG_ENDIAN
@@ -203,6 +204,8 @@ extern void init_regs (struct pstate *sregs);
/* interf.c */
extern int run_sim (struct pstate *sregs,
uint64_t icount, int dis);
+extern int fprintf_styled (void *stream, enum disassembler_style style,
+ const char *fmt, ...) ATTRIBUTE_PRINTF (3, 4);
/* float.c */
extern int get_accex (void);