From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by sourceware.org (Postfix) with ESMTPS id 0B9523858C83 for ; Mon, 14 Feb 2022 22:59:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B9523858C83 From: Hans-Peter Nilsson To: Subject: [PATCH 01/12] sim cris: Correct PRIu32 to PRIx32 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT Message-ID: <20220214225952.DF9AD20439@pchp3.se.axis.com> Date: Mon, 14 Feb 2022 23:59:52 +0100 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Feb 2022 22:59:55 -0000 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. --- sim/cris/sim-if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 602db9aebf4b..63deb467bc07 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. */ -- 2.30.2