From: Hans-Peter Nilsson Date: Mon, 14 Feb 2022 22:50:18 +0000 (+0100) Subject: sim cris: Correct PRIu32 to PRIx32 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9d67b0a0978e9651db74aa667be793420e7e4817;p=binutils-gdb.git sim cris: Correct PRIu32 to PRIx32 In 5ee0bc23a68f "sim: clean up bfd_vma printing" there was an additional introduction of PRIx32 and PRIu32 but just in sim/cris/sim-if.c. One type of bug was fixed in commit d16ce6e4d581 "sim: cris: fix memory setup typos" but one remained; the PRIu32 usage is wrong, as hex output is desired; note the 0x prefix. Without this fix, you'll see output like: memory map 0:0x4000..0x5fff (8192 bytes) overlaps 0:0x0..0x16383 (91012 bytes) program stopped with signal 6 (Aborted). for some C programs, like some of the ones in the sim/cris/c testsuite from where the example is taken (freopen2.c). The bug behavior was with memory allocation. With an attempt to allocate memory using the brk syscall such that the room up to the next 8192-byte "page boundary" wasn't sufficient, the simulator memory allocation machinery horked on a consistency error when trying to allocate a memory block to raise the "end of the data segment": there was already memory allocated at that address. Unfortunately, none of the programs in sim/cris/asm exposed this bug at the time, but an assembler test-case is committed after this fix. sim/cris: * sim-if.c (sim_open): Correct PRIu32 to PRIx32. --- diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 602db9aebf4..63deb467bc0 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -887,7 +887,7 @@ 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%" PRIx32 ",0x%" PRIu32, + sim_do_commandf (sd, "memory region 0x%" PRIx32 ",0x%" PRIx32, startmem, endmem - startmem); /* Allocate simulator I/O managed memory if none specified by user. */