From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id xZAKELhsrGn5+BoAWB0awg (envelope-from ) for ; Sat, 07 Mar 2026 13:21:44 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=WQ0i+IWn; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2C3C61E089; Sat, 07 Mar 2026 13:21:44 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 55F5B1E089 for ; Sat, 07 Mar 2026 13:21:43 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id C2FE04BA2E15 for ; Sat, 7 Mar 2026 18:21:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2FE04BA2E15 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=WQ0i+IWn Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 034D64BA2E16 for ; Sat, 7 Mar 2026 18:20:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 034D64BA2E16 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 034D64BA2E16 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772907652; cv=none; b=CH5pAy+RH2R29sHlMsImWVuhVS2GUvmqSOTJMP9FCuaod1uFsNpAhz5W+IQSXq3vXn8jbWTwRJsQin6xO19AM8TIFUOSMUJk5poqzvBU3ewJU80alikVxvHvi0ZPQcbfnL+ONrwvcNqUxencS9/kFWoBk7rsHs5GWd0t8LpDE44= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772907652; c=relaxed/simple; bh=Gb3lOzmrzfDtzF2YvvsKIQk2WuTmEgyqjlLz+rHBiuo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=vfpcCo1u4fZOeVtlHhhTR/BX7wVDqkNmafXV93yd/U1lfZEZSooPjh0OwdI2IKSwJWYVC+oeMWTHVOj1Did16jPmL+81X+//f3LIUc1t4D5PwCZ9gfYoGEBZS0e6IjetvmPjb8nGchn/149IxD5znK2j3RsUKOyus/wHnDk0OhY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 034D64BA2E16 Received: from eig-obgw-6001b.ext.cloudfilter.net ([10.0.30.143]) by cmsmtp with ESMTPS id yvk4volsNJ9SZywGgv66Gx; Sat, 07 Mar 2026 18:20:50 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id ywGfvurc5cu11ywGfvBRJI; Sat, 07 Mar 2026 18:20:50 +0000 X-Authority-Analysis: v=2.4 cv=bKYWIO+Z c=1 sm=1 tr=0 ts=69ac6c82 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=ItBw4LHWJt0A:10 a=60jCfaoAD6qU8ZX5wTwA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=U1mv6KdImUY/3El0mpl52BNcfhfEZ9pCCKNpC8jnJMA=; b=WQ0i+IWnDo4La2ZosS1tjYS0mg McuoowhUgYEPgA7eYc6D+T1Cjjmc+3o6DKKumNvJPxf1yKYgZUCnT3M6ftzOa5FqVtfP5fH03mnnY p7a3O45fuuh314rRet/TYYxBC; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:53288 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vywGf-000000042Dr-2BUV; Sat, 07 Mar 2026 11:20:49 -0700 From: Tom Tromey Date: Sat, 07 Mar 2026 11:20:48 -0700 Subject: [PATCH 3/4] Drop use of bfd_boolean from findcmd.c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260307-no-bfd-boolean-v1-3-186424bf8238@tromey.com> References: <20260307-no-bfd-boolean-v1-0-186424bf8238@tromey.com> In-Reply-To: <20260307-no-bfd-boolean-v1-0-186424bf8238@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.225.82 X-Source-L: No X-Exim-ID: 1vywGf-000000042Dr-2BUV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net ([192.168.122.1]) [75.166.225.82]:53288 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHcnMCWJgUudzdMgBioGAYW9k1e92ZdHfNwkIXC4IwewWnHqN6qAzkY66PXk43n2Avngi4VcX6WURTnvQU9qulqzpK2WD74bhN3cMJdcixIReA4/g7iG 8yWiJ9YczoRyvCY9XR61179CW6ZZDWavuA7Y0ODGoCv8cdukFNoZNJ2hYfSJCGwccYl6/0s2flstu9LgEALh9gxa99wZM8QuCsI= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This changes findcmd.c to remove the use of bfd_boolean. Instead, the byte order is used directly. put_bits is also rewritten in terms of store_unsigned_integer. --- gdb/findcmd.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/gdb/findcmd.c b/gdb/findcmd.c index c4ee0ec97e4..b52c44d48d0 100644 --- a/gdb/findcmd.c +++ b/gdb/findcmd.c @@ -24,27 +24,20 @@ #include "cli/cli-utils.h" #include #include "gdbsupport/byte-vector.h" +#include "extract-store-integer.h" -/* Copied from bfd_put_bits. */ +/* Append DATA to BUF, writing only the specified number of bits, + using the given endian-ness. */ static void -put_bits (uint64_t data, gdb::byte_vector &buf, int bits, bfd_boolean big_p) +put_bits (uint64_t data, gdb::byte_vector &buf, int bits, + bfd_endian byte_order) { - int i; - int bytes; - gdb_assert (bits % 8 == 0); - - bytes = bits / 8; + int bytes = bits / 8; size_t last = buf.size (); buf.resize (last + bytes); - for (i = 0; i < bytes; i++) - { - int index = big_p ? bytes - i - 1 : i; - - buf[last + index] = data & 0xff; - data >>= 8; - } + store_unsigned_integer (&buf[last], bytes, byte_order, data); } /* Subroutine of find_command to simplify it. @@ -53,7 +46,7 @@ put_bits (uint64_t data, gdb::byte_vector &buf, int bits, bfd_boolean big_p) static gdb::byte_vector parse_find_args (const char *args, ULONGEST *max_countp, CORE_ADDR *start_addrp, ULONGEST *search_space_lenp, - bfd_boolean big_p) + bfd_endian byte_order) { /* Default to using the specified type. */ char size = '\0'; @@ -171,13 +164,13 @@ parse_find_args (const char *args, ULONGEST *max_countp, pattern_buf.push_back (x); break; case 'h': - put_bits (x, pattern_buf, 16, big_p); + put_bits (x, pattern_buf, 16, byte_order); break; case 'w': - put_bits (x, pattern_buf, 32, big_p); + put_bits (x, pattern_buf, 32, byte_order); break; case 'g': - put_bits (x, pattern_buf, 64, big_p); + put_bits (x, pattern_buf, 64, byte_order); break; } } @@ -210,7 +203,7 @@ static void find_command (const char *args, int from_tty) { struct gdbarch *gdbarch = get_current_arch (); - bfd_boolean big_p = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG; + bfd_endian byte_order = gdbarch_byte_order (gdbarch); /* Command line parameters. These are initialized to avoid uninitialized warnings from -Wall. */ ULONGEST max_count = 0; @@ -223,7 +216,7 @@ find_command (const char *args, int from_tty) gdb::byte_vector pattern_buf = parse_find_args (args, &max_count, &start_addr, &search_space_len, - big_p); + byte_order); /* Perform the search. */ -- 2.49.0