From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Eli Zaretskii <eliz@gnu.org>
Subject: [PATCH v2 30/30] Document new Python and Guile constants
Date: Thu, 18 Jan 2024 13:32:28 -0700 [thread overview]
Message-ID: <20240118-submit-domain-hacks-2-v2-30-aecab29fa104@tromey.com> (raw)
In-Reply-To: <20240118-submit-domain-hacks-2-v2-0-aecab29fa104@tromey.com>
This documents the new Python and Guile constants introduced earlier
in this series.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
---
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 bab300e36b8..2638b3e0d9c 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -108,6 +108,11 @@ show remote thread-options-packet
object, these will be stored in the object's new
InferiorThread.__dict__ attribute.
+ ** 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.
+
* Debugger Adapter Protocol changes
** GDB now emits the "process" event.
@@ -121,6 +126,13 @@ show remote thread-options-packet
** The "set debug dap-log-file" command is now documented. This
command was available in GDB 14 but not documented.
+* 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 271b672fdc6..483a96fb592 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{<gdb:symbol>} 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 71431878dd3..906775c5711 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -6214,12 +6214,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
@@ -6234,6 +6244,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:
--
2.43.0
next prev parent reply other threads:[~2024-01-18 20:38 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 20:31 [PATCH v2 00/30] Restructure symbol domains Tom Tromey
2024-01-18 20:31 ` [PATCH v2 01/30] Fix bug in cooked index scanner Tom Tromey
2024-01-18 20:32 ` [PATCH v2 02/30] Small cleanup in DWARF reader Tom Tromey
2024-01-18 20:32 ` [PATCH v2 03/30] Fix latent bug in DW_TAG_entry_point handling Tom Tromey
2024-01-18 20:32 ` [PATCH v2 04/30] Make nsalias.exp more reliable Tom Tromey
2024-01-18 20:32 ` [PATCH v2 05/30] Fix latent bug in mdebugread.c Tom Tromey
2024-01-18 20:32 ` [PATCH v2 06/30] Give names to unspecified types Tom Tromey
2024-01-18 20:32 ` [PATCH v2 07/30] Remove NR_DOMAINS Tom Tromey
2024-01-18 20:32 ` [PATCH v2 08/30] Simplify symbol_to_info_string Tom Tromey
2024-01-18 20:32 ` [PATCH v2 09/30] Split up a big 'if' in symtab.c Tom Tromey
2024-01-18 20:32 ` [PATCH v2 10/30] Use a .def file for domain_enum Tom Tromey
2024-01-29 17:57 ` Lancelot SIX
2024-01-29 18:20 ` Tom Tromey
2024-01-18 20:32 ` [PATCH v2 11/30] Add two new symbol domains Tom Tromey
2024-01-18 20:32 ` [PATCH v2 12/30] Add domain_search_flags Tom Tromey
2024-01-18 20:32 ` [PATCH v2 13/30] Replace search_domain with domain_search_flags Tom Tromey
2024-01-18 20:32 ` [PATCH v2 14/30] Remove a check of VAR_DOMAIN Tom Tromey
2024-01-18 20:32 ` [PATCH v2 15/30] Introduce "scripting" domains Tom Tromey
2024-01-18 20:32 ` [PATCH v2 16/30] Use domain_search_flags in lookup_global_symbol_language Tom Tromey
2024-01-18 20:32 ` [PATCH v2 17/30] Use domain_search_flags in lookup_symbol et al Tom Tromey
2024-01-18 20:32 ` [PATCH v2 18/30] Remove some obsolete Python constants Tom Tromey
2024-01-18 20:32 ` [PATCH v2 19/30] Remove old symbol_matches_domain Tom Tromey
2024-01-18 20:32 ` [PATCH v2 20/30] Use the new symbol domains Tom Tromey
2024-01-18 20:32 ` [PATCH v2 21/30] Simplify some symbol searches in Ada code Tom Tromey
2024-01-18 20:32 ` [PATCH v2 22/30] Simplify some symbol searches in linespec.c Tom Tromey
2024-01-18 20:32 ` [PATCH v2 23/30] Only search for "main" as a function Tom Tromey
2024-01-18 20:32 ` [PATCH v2 24/30] Only look for functions in expand_symtabs_for_function Tom Tromey
2024-01-18 20:32 ` [PATCH v2 25/30] Use a function-domain search in inside_main_func Tom Tromey
2024-01-18 20:32 ` [PATCH v2 26/30] Only search types in cp_lookup_rtti_type Tom Tromey
2024-01-18 20:32 ` [PATCH v2 27/30] Only search types in lookup_typename Tom Tromey
2024-01-18 20:32 ` [PATCH v2 28/30] Only search for functions in rust_structop::evaluate_funcall Tom Tromey
2024-01-18 20:32 ` [PATCH v2 29/30] Refine search in cp_search_static_and_baseclasses Tom Tromey
2024-01-18 20:32 ` Tom Tromey [this message]
2024-01-28 23:42 ` [PATCH v2 00/30] Restructure symbol domains Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240118-submit-domain-hacks-2-v2-30-aecab29fa104@tromey.com \
--to=tom@tromey.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).