From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 157AA3891C34 for ; Wed, 12 Oct 2022 12:39:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 157AA3891C34 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 6BE81300089; Wed, 12 Oct 2022 12:39:15 +0000 (UTC) From: Tsukasa OI To: Tsukasa OI , Andrew Burgess , Tom de Vries Cc: gdb-patches@sourceware.org Subject: [PATCH 1/1] sim/ppc: Fix core_find_mapping diagnostics Date: Wed, 12 Oct 2022 12:38:59 +0000 Message-Id: <5894ec3b0f77b7fe60b8fe7376780f0874267e15.1665578330.git.research_trasio@irq.a4lg.com> In-Reply-To: References: <87wn95bctu.fsf@redhat.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Wed, 12 Oct 2022 12:39:18 -0000 Because "%p" is the pointer conversion specifier to print a pointer in an implementation-defined manner, the result with format string containing "0x%p" can be strange. For instance, core_map_find_mapping prints error containing "0x0x...." (processor is not NULL) or "0x(null)" (processor is NULL) on glibc. This commit replaces "0x%p" with "%p" to prevent unpredictable behavior. --- sim/ppc/corefile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/ppc/corefile.c b/sim/ppc/corefile.c index b2faef58c5b..ee4e2cf733e 100644 --- a/sim/ppc/corefile.c +++ b/sim/ppc/corefile.c @@ -292,7 +292,7 @@ core_map_find_mapping(core_map *map, mapping = mapping->next; } if (abort) - error("core_find_mapping() - access to unmaped address, attach a default map to handle this - addr=0x%x nr_bytes=0x%x processor=0x%p cia=0x%x\n", + error("core_find_mapping() - access to unmaped address, attach a default map to handle this - addr=0x%x nr_bytes=0x%x processor=%p cia=0x%x\n", addr, nr_bytes, (void *) processor, cia); return NULL; } -- 2.34.1