aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-05-03 23:27:16 -0400
committerMike Frysinger <vapier@gentoo.org>2021-05-04 08:13:45 -0400
commit5ee0bc23a68fe2a6a7717b31fda1db878b2c9764 (patch)
tree89d9ac8cad39ef7afdf6dfa1d93a5f06b87a440f /sim/common
parent225bda24db9671e2087fda892f94141625836a40 (diff)
downloadgdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.zip
gdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.tar.gz
gdb-5ee0bc23a68fe2a6a7717b31fda1db878b2c9764.tar.bz2
sim: clean up bfd_vma printing
A lot of this code predates the bfd_vma format define, so we have a random mix of casts to known types so we can printf the value. Use the BFD_VMA_FMT that now exists to simplify and reliability output across different build configs.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog7
-rw-r--r--sim/common/cgen-trace.c4
-rw-r--r--sim/common/sim-load.c24
3 files changed, 15 insertions, 20 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 17b711c..7834499 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-04 Mike Frysinger <vapier@gentoo.org>
+
+ * cgen-trace.c (sim_disasm_perror_memory): Use BFD_VMA_FMT and drop
+ cast.
+ * sim-load.c (xprintf_bfd_vma): Delete.
+ (sim_load_file): Delete xprintf_bfd_vma calls. Use BFD_VMA_FMT.
+
2021-05-03 Simon Marchi <simon.marchi@polymtl.ca>
* hw-events.h (hw_event_queue_schedule_tracef): Use format attribute.
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 0f18c50..649c37a 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -340,8 +340,8 @@ sim_disasm_perror_memory (int status, bfd_vma memaddr,
/* Actually, address between memaddr and memaddr + len was
out of bounds. */
info->fprintf_func (info->stream,
- "Address 0x%x is out of bounds.",
- (int) memaddr);
+ "Address 0x%" BFD_VMA_FMT "x is out of bounds.",
+ memaddr);
}
/* Disassemble using the CGEN opcode table.
diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c
index e0aab1e..04681c5 100644
--- a/sim/common/sim-load.c
+++ b/sim/common/sim-load.c
@@ -38,7 +38,6 @@ static void eprintf (host_callback *, const char *, ...);
static void xprintf (host_callback *, const char *, ...);
static void report_transfer_performance
(host_callback *, unsigned long, time_t, time_t);
-static void xprintf_bfd_vma (host_callback *, bfd_vma);
/* Load program PROG into the simulator using the function DO_LOAD.
If PROG_BFD is non-NULL, the file has already been opened.
@@ -122,12 +121,12 @@ sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback,
lma = bfd_section_vma (s);
if (verbose_p)
{
- xprintf (callback, "Loading section %s, size 0x%lx %s ",
+ xprintf (callback,
+ "Loading section %s, size 0x%lx %s "
+ "%" BFD_VMA_FMT "x\n",
bfd_section_name (s),
(unsigned long) size,
- (lma_p ? "lma" : "vma"));
- xprintf_bfd_vma (callback, lma);
- xprintf (callback, "\n");
+ (lma_p ? "lma" : "vma"), lma);
}
data_count += size;
bfd_get_section_contents (result_bfd, s, buffer, 0, size);
@@ -149,9 +148,8 @@ sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback,
if (verbose_p)
{
end_time = time (NULL);
- xprintf (callback, "Start address ");
- xprintf_bfd_vma (callback, bfd_get_start_address (result_bfd));
- xprintf (callback, "\n");
+ xprintf (callback, "Start address %" BFD_VMA_FMT "x\n",
+ bfd_get_start_address (result_bfd));
report_transfer_performance (callback, data_count, start_time, end_time);
}
@@ -198,13 +196,3 @@ report_transfer_performance (host_callback *callback, unsigned long data_count,
xprintf (callback, "%ld bits in <1 sec", (data_count * 8));
xprintf (callback, ".\n");
}
-
-/* Print a bfd_vma.
- This is intended to handle the vagaries of 32 vs 64 bits, etc. */
-
-static void
-xprintf_bfd_vma (host_callback *callback, bfd_vma vma)
-{
- /* FIXME: for now */
- xprintf (callback, "0x%lx", (unsigned long) vma);
-}