From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id vhu5NAT2VmGcewAAWB0awg (envelope-from ) for ; Fri, 01 Oct 2021 07:50:28 -0400 Received: by simark.ca (Postfix, from userid 112) id C63F01EDF0; Fri, 1 Oct 2021 07:50:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI 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 E295F1E813 for ; Fri, 1 Oct 2021 07:50:27 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F00AC385842B for ; Fri, 1 Oct 2021 11:50:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F00AC385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633089026; bh=KIQ4DNqN24qH9CyF++HW5T1hdOCOUxVj9ea2uNtM37Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Qzp2WN08yHSaIibCVTyFPxYguHZ90fjppqpViLPn89GggCv6Djad01qG6P9Lu7pd8 mcLBTfP5ngZyMg8dGtZb/uvo2lQkos04qbo9QgxVERW68mcuAuhyWTQ/dUozBaGlP0 aPYjxmQ2cHTamniWzJClhXyBRUVhXv2xEuhETlpA= Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by sourceware.org (Postfix) with ESMTPS id 00C243858C2C for ; Fri, 1 Oct 2021 11:50:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 00C243858C2C Received: by mail-qt1-x82b.google.com with SMTP id j13so8622610qtq.6 for ; Fri, 01 Oct 2021 04:50:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=KIQ4DNqN24qH9CyF++HW5T1hdOCOUxVj9ea2uNtM37Y=; b=HyPPoiAJpUmUs80gx4HoVfkUDtMDXGVaFyS5jBhPTelURTjymOcP6MKEM5ToQhNQeh v+w6caiLJOmHJDV8w0c1X63qIwaaMrBr3jPu/Dj4w0NF8cG+AzrAkh1pCh43zKdgrDOz Jsfd1dTpR08cvpadjSQavUQx1HeaiJ9SKQdZN98nu1zRB4FROsL3ZzKvlsS64xRlXxz3 WzFwwUcx2yYiqF2W2QsypG4nZuRzsPHVYv8feotjFCFagDgvNtQDxWBBgLpaKcKbAqTZ hDMwZPRYBAUZwmz2xr13CHtQalmhkeewj71VBZp+brf7t7V1fap2qD62kx0yVEq+C2C1 Y5hA== X-Gm-Message-State: AOAM530zQ9EfKtLpoif+pwxACJ3eU+LC0KgTJKZFaylI/B3GwYW5n20P IAHqtCmfBGaerRrQYglHrwrgRg9imlQvyQ== X-Google-Smtp-Source: ABdhPJzem9nE5JbvVWGjtD4PpfmnjasUtCSazaXjheXD2ZVZ9xXG2KoKFJafuVTcw7Lw6eLxXitcdA== X-Received: by 2002:ac8:1e06:: with SMTP id n6mr12360387qtl.280.1633089007266; Fri, 01 Oct 2021 04:50:07 -0700 (PDT) Received: from localhost.localdomain ([2804:7f0:4841:3c03:11ed:b1d3:f37e:d87b]) by smtp.gmail.com with ESMTPSA id t4sm956104qkj.60.2021.10.01.04.50.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 04:50:06 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH] Fix build failure for 32-bit targets Date: Fri, 1 Oct 2021 08:50:02 -0300 Message-Id: <20211001115002.1681134-1-luis.machado@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Luis Machado via Gdb-patches Reply-To: Luis Machado Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" When building master GDB, I ran into the following: binutils-gdb/gdb/bt-utils.c: In function ‘int libbacktrace_print(void*, uintptr_t, const char*, int, const char*)’: binutils-gdb/gdb/bt-utils.c:93:44: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uintptr_t {aka unsigned int}’ [-Werror=format=] snprintf (buf, sizeof (buf), "0x%lx ", pc); Fix this by using phex and %s as opposed to 0x%lx. --- gdb/bt-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c index 79e6e090d42..51791ccb9f6 100644 --- a/gdb/bt-utils.c +++ b/gdb/bt-utils.c @@ -90,7 +90,7 @@ libbacktrace_print (void *data, uintptr_t pc, const char *filename, files. We are also careful to ensure we don't overflow this buffer. */ char buf[20]; - snprintf (buf, sizeof (buf), "0x%lx ", pc); + snprintf (buf, sizeof (buf), "%s ", phex (pc, sizeof (pc)); buf[sizeof (buf) - 1] = '\0'; sig_write (buf); sig_write (function == nullptr ? "???" : function); -- 2.25.1