From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oNdIJv3eCmKragAAWB0awg (envelope-from ) for ; Mon, 14 Feb 2022 18:00:13 -0500 Received: by simark.ca (Postfix, from userid 112) id 992381F3C5; Mon, 14 Feb 2022 18:00:13 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 343A21EA69 for ; Mon, 14 Feb 2022 18:00:13 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8AB43858420 for ; Mon, 14 Feb 2022 23:00:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8AB43858420 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1644879612; bh=eVXGfqvxvJXDJNjL+Xk29x+SFhU99+e/Shl5c1FifxQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=K0VEUhO63aScgHH3L//Xr+IfCh0IADYeCIty7nEEAf3+hy+4k9Ri5qhRQ1OFk9sqm UST6zgzGEqxcJXtIxmbLiU7MJzDDwFP60Ty+1EvYRU3CPdeSEY9RJMHxn+jlTms3B1 21BpRlTUr2fbDuiubTNRfi4iZN3Klsjmis6SXxVk= 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 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-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: , From: Hans-Peter Nilsson via Gdb-patches Reply-To: Hans-Peter Nilsson Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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