From patchwork Tue Nov 21 03:54:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 80412 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D0283858438 for ; Tue, 21 Nov 2023 03:55:46 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id B00E33858401 for ; Tue, 21 Nov 2023 03:53:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B00E33858401 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 B00E33858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700538810; cv=none; b=nUBBgbA3OjllVc9AgjgQVLqbW4ufkfaDotXslHTt7Upw7v34kyDTu55lI4hkRZaGFDHnt7euO9UrAmwNtbnCN6WMTBDcG3kIMOv5y48cku2QDk5fvh4UoA7maQBfhliVhXLpb73RNuTdhXxHhw8TBRwertnuoukzbbdTJKWV4IY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700538810; c=relaxed/simple; bh=SZOJfVqlIpyegN6Avj2I6CbYkWeLiizwOJ6AJcMXk7k=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=RU9gCK2QhHz0qEe7CaQzGIhXcogOSYpNRVPog6fZh35tlau+t5BY5FMexu9f7ZtHbwJ/qBhQh0BkhbTVzDrpCIXOrOH5cm6xX9svRd2rrIetxRrzK6GXfUANPS/NstMPPZVP9Brmq5cZE7QZx6d87KC9t77yk1C42jrDKVNgAXs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6002a.ext.cloudfilter.net ([10.0.30.222]) by cmsmtp with ESMTPS id 5BpgrnKJqWcCI5HpDrZVME; Tue, 21 Nov 2023 03:53:23 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 5HpCr57v3M0U25HpDrctNO; Tue, 21 Nov 2023 03:53:23 +0000 X-Authority-Analysis: v=2.4 cv=BuKOfKb5 c=1 sm=1 tr=0 ts=655c29b3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=jKitsVYuo9LPnbjpB04A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=MlLyFg5+IGFrSECFOhm0T0TC0bFoOspmzFkz37goxwo=; b=kUeAG5mL72QpnnzKjY6sMppct/ Si5NCdNHgKLN/OyaOofDPSwlen6sTGt4wbwFb3TcJzk0RAngSgFvTW77N/QqkG3+WSKLDK+jZ25uh 3q7Q7snzbwSVXDDaqAVDWhyJc; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:47856 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r5HpC-0040be-25 for gdb-patches@sourceware.org; Mon, 20 Nov 2023 20:53:22 -0700 From: Tom Tromey Date: Mon, 20 Nov 2023 20:54:00 -0700 Subject: [PATCH 29/29] Document new Python and Guile constants MIME-Version: 1.0 Message-Id: <20231120-submit-domain-hacks-2-v1-29-29650d01b198@tromey.com> References: <20231120-submit-domain-hacks-2-v1-0-29650d01b198@tromey.com> In-Reply-To: <20231120-submit-domain-hacks-2-v1-0-29650d01b198@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 97.122.77.73 X-Source-L: No X-Exim-ID: 1r5HpC-0040be-25 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:47856 X-Source-Auth: tom+tromey.com X-Email-Count: 30 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfO6cN58o7WuKZXUT5MCny5xyjbdcdUNWxvJ3ArSH2BTBsUOjqFjE2qsopc1aR8ujCSrNxFwiF4PfvdKiMS3Hgcp4uGwzOMKfRIpi5zqo7dtvwN94TXpW BBoK+P7RYH+I7qKCIZm9aaDsL3U37ZWJNIWJmbnv8ASiONjx2qIm0xqtGqhJEn90qgMBDwMn9hMNMMnjhrWnXXUALBVXo0Dm8WI= X-Spam-Status: No, score=-3023.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This documents the new Python and Guile constants introduced earlier in this series. Reviewed-By: Eli Zaretskii --- gdb/NEWS | 12 ++++++++++++ gdb/doc/guile.texi | 13 +++++++++++++ gdb/doc/python.texi | 30 +++++++++++++++++++++++++++--- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 1073e38dfc6..93fee9a8044 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -57,6 +57,18 @@ show remote thread-options-packet sub-classed to create handlers for objfiles with missing debug information. + ** New constants gdb.SYMBOL_TYPE_DOMAIN, gdb.SYMBOL_FUNCTION_DOMAIN, + and gdb.SEARCH_*_DOMAIN corresponding to all the existing symbol + domains. Symbol lookup can now search in multiple domains at + once, and can also narrowly search for just a type or function. + +* Guile API + + ** New constants SYMBOL_TYPE_DOMAIN, SYMBOL_FUNCTION_DOMAIN, and + SEARCH_*_DOMAIN corresponding to all the existing symbol domains. + Symbol lookup can now search in multiple domains at once, and can + also narrowly search for just a type or function. + * New remote packets New stop reason: clone diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi index aae0c6a5cc9..4ac3f372b0a 100644 --- a/gdb/doc/guile.texi +++ b/gdb/doc/guile.texi @@ -2802,6 +2802,14 @@ in the symbol information or in @value{GDBN}'s handling of symbols. This domain contains variables, function names, typedef names and enum type values. +@item SYMBOL_FUNCTION_DOMAIN +This domain contains functions. + +@item SYMBOL_TYPE_DOMAIN +This domain contains types. In a C-like language, types using a tag +will not appear here; in other languages, all types are in this +domain. + @item SYMBOL_STRUCT_DOMAIN This domain holds struct, union and enum type names. @@ -2822,6 +2830,11 @@ This domain contains all types. The available address class categories in @code{} are represented as constants in the @code{gdb} module: +When searching for a symbol, the desired domain constant can be passed +verbatim to the lookup function. For more complex searches, there is +a corresponding set of constants using a @samp{SEARCH_} prefix. These +may be or'd together to form a search constant. + @vtable @code @item SYMBOL_LOC_UNDEF If this is returned by address class, it indicates an error either in diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index b65991bbad0..0e8d0f4c22c 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -6088,12 +6088,22 @@ in the symbol information or in @value{GDBN}'s handling of symbols. @vindex SYMBOL_VAR_DOMAIN @item gdb.SYMBOL_VAR_DOMAIN -This domain contains variables, function names, typedef names and enum -type values. +This domain contains variables. + +@vindex SYMBOL_FUNCTION_DOMAIN +@item gdb.SYMBOL_FUNCTION_DOMAIN +This domain contains functions. + +@vindex SYMBOL_TYPE_DOMAIN +@item gdb.SYMBOL_TYPE_DOMAIN +This domain contains types. In a C-like language, types using a tag +will not appear here; in other languages, all types are in this +domain. @vindex SYMBOL_STRUCT_DOMAIN @item gdb.SYMBOL_STRUCT_DOMAIN -This domain holds struct, union and enum type names. +This domain holds struct, union and enum tag names. This domain is +only used for C-like languages. @vindex SYMBOL_LABEL_DOMAIN @item gdb.SYMBOL_LABEL_DOMAIN @@ -6108,6 +6118,20 @@ This domain contains names of Fortran module types. This domain contains names of Fortran common blocks. @end vtable +When searching for a symbol, the desired domain constant can be passed +verbatim to the lookup function. For example: +@smallexample +symbol = gdb.lookup_symbol ("name", domain=gdb.SYMBOL_VAR_DOMAIN) +@end smallexample + +For more complex searches, there is a corresponding set of constants +using a @samp{SEARCH_} prefix. These may be or'd together to form a +search constant, e.g.: +@smallexample +symbol = gdb.lookup_symbol ("name", + domain=gdb.SEARCH_VAR_DOMAIN | gdb.SEARCH_TYPE_DOMAIN) +@end smallexample + The available address class categories in @code{gdb.Symbol} are represented as constants in the @code{gdb} module: