diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-05-03 23:27:16 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-05-04 08:13:45 -0400 |
commit | 5ee0bc23a68fe2a6a7717b31fda1db878b2c9764 (patch) | |
tree | 89d9ac8cad39ef7afdf6dfa1d93a5f06b87a440f /sim/cris/sim-if.c | |
parent | 225bda24db9671e2087fda892f94141625836a40 (diff) | |
download | gdb-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/cris/sim-if.c')
-rw-r--r-- | sim/cris/sim-if.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 9914912..edd7885 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -257,14 +257,16 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) buf = xmalloc (phdr[i].p_filesz); if (verbose) - sim_io_printf (sd, "Loading segment at 0x%lx, size 0x%lx\n", + sim_io_printf (sd, + "Loading segment at 0x%" BFD_VMA_FMT "x, size 0x%lx\n", lma, phdr[i].p_filesz); if (bfd_seek (abfd, phdr[i].p_offset, SEEK_SET) != 0 || (bfd_bread (buf, phdr[i].p_filesz, abfd) != phdr[i].p_filesz)) { sim_io_eprintf (sd, - "%s: could not read segment at 0x%lx, size 0x%lx\n", + "%s: could not read segment at 0x%" BFD_VMA_FMT "x, " + "size 0x%lx\n", STATE_MY_NAME (sd), lma, phdr[i].p_filesz); free (buf); return FALSE; @@ -273,7 +275,8 @@ cris_load_elf_file (SIM_DESC sd, struct bfd *abfd, sim_write_fn do_write) if (do_write (sd, lma, buf, phdr[i].p_filesz) != phdr[i].p_filesz) { sim_io_eprintf (sd, - "%s: could not load segment at 0x%lx, size 0x%lx\n", + "%s: could not load segment at 0x%" BFD_VMA_FMT "x, " + "size 0x%lx\n", STATE_MY_NAME (sd), lma, phdr[i].p_filesz); free (buf); return FALSE; @@ -495,7 +498,6 @@ static bfd_boolean cris_handle_interpreter (SIM_DESC sd, struct bfd *abfd) { int i, n_hdrs; - bfd_vma phaddr; bfd_byte buf[4]; char *interp = NULL; struct bfd *ibfd; @@ -571,7 +573,7 @@ cris_handle_interpreter (SIM_DESC sd, struct bfd *abfd) memory area, so we go via a temporary area. Luckily, the interpreter is supposed to be small, less than 0x40000 bytes. */ - sim_do_commandf (sd, "memory region 0x%lx,0x%lx", + sim_do_commandf (sd, "memory region 0x%" BFD_VMA_FMT "x,0x%lx", interp_load_addr, interpsiz); /* Now that memory for the interpreter is defined, load it. */ @@ -885,8 +887,8 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, /* Allocate core managed memory if none specified by user. */ if (sim_core_read_buffer (sd, NULL, read_map, &c, startmem, 1) == 0) - sim_do_commandf (sd, "memory region 0x%lx,0x%lx", startmem, - endmem - startmem); + sim_do_commandf (sd, "memory region 0x%" PRIx32 "x,0x%" PRIu32 "x", + startmem, endmem - startmem); /* Allocate simulator I/O managed memory if none specified by user. */ if (cris_have_900000xxif) |