forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user