From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0116D3858D33 for ; Mon, 28 Aug 2023 14:27:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0116D3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693232827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jsKxZGwXJHffrriwgGszcDrXIdnY3w9fj7wqM7PF+jo=; b=Pxo6Gi0WHtEKVX/O+2vci9BYT+rDwVnSic8NufxYeB+GlWPXXHLv0bfjDLzIdiy7yVG1IS 6QyLEz18zTP1HRTw4SajGyhJdddf3Qdzz5oYI57o1nqirrsfGJ/RDEvzUaMUJhPUS5AvkD gd2nN8Ecu6v2O1y2GGZBz1iSSz2Eojw= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-184-fiHRNbrNN8-7EChdJIPywQ-1; Mon, 28 Aug 2023 10:27:02 -0400 X-MC-Unique: fiHRNbrNN8-7EChdJIPywQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EEA233813F28; Mon, 28 Aug 2023 14:27:01 +0000 (UTC) Received: from [10.22.32.236] (unknown [10.22.32.236]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87DEE2166B26; Mon, 28 Aug 2023 14:27:01 +0000 (UTC) Message-ID: <5b5995f9-2175-45c9-a7a1-23ce73d44444@redhat.com> Date: Mon, 28 Aug 2023 07:27:00 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Fix gdb/coffread.c build on 32bit architectures To: Tom Tromey , Mark Wielaard Cc: gdb-patches@sourceware.org References: <3b0896a6-04d4-4c7c-ac32-9ae78acdb66c@redhat.com/> <20230825211653.2097671-1-mark@klomp.org> <87a5ubuunf.fsf@tromey.com> <4c50f8c5-b0cd-4a63-85e8-62d5011b5b0c@redhat.com> From: Keith Seitz In-Reply-To: <4c50f8c5-b0cd-4a63-85e8-62d5011b5b0c@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On 8/28/23 07:20, Keith Seitz via Gdb-patches wrote: > > May I assume that converting to hex_string for printing these offsets is obvious > or pre-approved? Or to be more explicit (pardon me -- ECAFFEINE): Use hex_string to output hexidecimal values Late last week, I committed a patch that used %ld to output the value of some offsets in coffread.c. This caused a build failure on 32-bit hardware, and Mark Wielaard offered up a quick fix by using PRIxPTR. As mentioned by Tom Tromey, the correct way to handle this is by using a utility function such as hex_string. This patch converts the two %ld formats into %s w/hex_string instead. --- gdb/coffread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/coffread.c b/gdb/coffread.c index c609c963453..3caa7eb3175 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1325,8 +1325,8 @@ getsymname (struct internal_syment *symbol_entry) if (symbol_entry->_n._n_n._n_zeroes == 0) { if (symbol_entry->_n._n_n._n_offset > stringtab_length) - error (_("COFF Error: string table offset (%" PRIxPTR ") outside string table (length %ld)"), - symbol_entry->_n._n_n._n_offset, stringtab_length); + error (_("COFF Error: string table offset (%s) outside string table (length %s)"), + hex_string (symbol_entry->_n._n_n._n_offset), hex_string (stringtab_length)); result = stringtab + symbol_entry->_n._n_n._n_offset; } else -- 2.41.0