From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UZxgOkr7DGkyDycAWB0awg (envelope-from ) for ; Thu, 06 Nov 2025 14:47:22 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PiFCYMnN; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EBF681E0BC; Thu, 06 Nov 2025 14:47:22 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 76CF21E04C for ; Thu, 06 Nov 2025 14:47:22 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5759F3853834 for ; Thu, 6 Nov 2025 19:47:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5759F3853834 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PiFCYMnN Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 33114385E030 for ; Thu, 6 Nov 2025 19:45:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 33114385E030 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 33114385E030 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762458328; cv=none; b=P19I5JcEopq1Wn2WzqJXuE9mGTywtIw/swO6eySnQ4dShGNxtNlyqgd4mwwPIvJXIQVAZgr/VXXIco5q5ovMZ3SpLr4VukyPKZIS7r6lDHWZXx4Bwa7z8MRjE4juBdoheBoBXc1+nELseUdPS20JRFIwF6iojJ8k9uMGMj5n0D0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1762458328; c=relaxed/simple; bh=cfzArbM4pPeFMrycG/DAkMPeYCPOpWMIeYfhvAbjLaw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BrkOEi2GKHBlbLM0azSiRfQ+iWU7g9xU99wgrmv4AR9TrNAH4NPu5jBZlF5Z2w1P26Pn1LnVkM0kk4CcH2WzPbEljhzHsZwY168HPPfmU2PvrbwmsDD9DbOR5JUs9KyLAXzaUhIzm4Eeo+91Whg3XmT7EsgDBQvdRoLevuByZRo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33114385E030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762458327; 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=yNg4lZyIqh2isIh8q2LDZlxiFrcxJ5j8gi4+wXsyHmo=; b=PiFCYMnNZldU2redPz4UkJthy/OZ2KwCH7zTcyrAQSQe6DwVs2bh20BoZ5fB1dQbmoQH7a MqVTRENvFOD0UHkdnJsubiPNobrF/PVLTgwNLR6+BTFOFa6vB2lLSb8bjtcxJQjRCwIDPV EFrxN7ykUO7BResA9PUbAKXnsx2FgzQ= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-512-FSHmFIxMPI2GrZiIq5eISg-1; Thu, 06 Nov 2025 14:45:26 -0500 X-MC-Unique: FSHmFIxMPI2GrZiIq5eISg-1 X-Mimecast-MFC-AGG-ID: FSHmFIxMPI2GrZiIq5eISg_1762458326 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF3491801233 for ; Thu, 6 Nov 2025 19:45:25 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.96.134.145]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A61981800361; Thu, 6 Nov 2025 19:45:24 +0000 (UTC) From: Guinevere Larsen To: gdb-patches@sourceware.org Cc: Guinevere Larsen Subject: [PATCH 1/2] gdb: introduce command "info architecture" Date: Thu, 6 Nov 2025 16:45:13 -0300 Message-ID: <20251106194514.1857177-2-guinevere@redhat.com> In-Reply-To: <20251106194514.1857177-1-guinevere@redhat.com> References: <20251106194514.1857177-1-guinevere@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: em9hHwSUhpHnQgNMn6s3kQ8TTtuAMVswu3pJEhk-6tQ_1762458326 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 There is no convenient way to tell a user how to check which architectures are supported by their build of GDB. This hasn't really been a problem, but now that GDB isn't ported to Apple's new CPU architectures, a user could run into a situation where they're trying to debug an unsupported CPU. This commit adds a way to list supported architectures, and filter them using a regular expression. No test is added because I couldn't think of a good way to verify functionality when we can't control the configure line. --- gdb/NEWS | 4 ++++ gdb/arch-utils.c | 28 ++++++++++++++++++++++++++++ gdb/doc/gdb.texinfo | 5 +++++ 3 files changed, 37 insertions(+) diff --git a/gdb/NEWS b/gdb/NEWS index 64e35f1a438..8d87e2473f7 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -45,6 +45,10 @@ maintenance test-remote-args ARGS Test splitting and joining of inferior arguments ARGS as they would be split and joined when being passed to a remote target. +info architectures [REGEXP] + List CPU microarchitectures supported by this build of GDB. If + REGEXP is provided, filter to microarchitectures that match it. + * Changed commands maintenance info program-spaces diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 8e3f79089d4..4367e26c02b 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -682,6 +682,28 @@ static enum bfd_endian default_byte_order = BFD_ENDIAN_UNKNOWN; "set arch" command. */ static std::vector arches; +/* Implementation of "info architectures" command. */ + +static void +info_architectures_command (const char *args, int from_tty) +{ + bool filtered = false; + if (args != nullptr && args[0] != '\0') + { + char *re_err = re_comp (args); + if (re_err != nullptr) + error (_("Invalid regexp: %s"), re_err); + filtered = true; + } + for (const char *s : arches) + { + if (s == nullptr) + break; + if (!filtered || re_exec (s)) + gdb_printf ("%s\n", s); + } +} + void initialize_current_architecture (void) { @@ -767,6 +789,12 @@ initialize_current_architecture (void) &setlist, &showlist); add_alias_cmd ("processor", architecture_cmds.set, class_support, 1, &setlist); + add_info ("architectures", info_architectures_command, + _("List supported CPU microarchitectures.\n\ +\n\ +Usage: info architectures [REGEXP]\n\ +If REGEXP is supplied, list supported microarchitectures that match the\n\ +regular expresion. Otherwise list all supported microarchitectures.")); } } diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 854f22b612e..a4576ca3703 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -23428,6 +23428,11 @@ Show the current target architecture. @kindex show processor These are alias commands for, respectively, @code{set architecture} and @code{show architecture}. + +@item info architectures +@item info architectures @var{regexp} +List architectures supported by GDB. If @var{regexp} is provided, filter +results through the regular expression, otherwise list all architectures. @end table @menu -- 2.51.0