[v2,11/30] Add two new symbol domains

Message ID 20240118-submit-domain-hacks-2-v2-11-aecab29fa104@tromey.com
State New
Headers
Series Restructure symbol domains |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Tom Tromey Jan. 18, 2024, 8:32 p.m. UTC
  This adds two new symbol domain constants, TYPE_DOMAIN and
FUNCTION_DOMAIN.

Historically, gdb was a C debugger, and the symbol tables continue to
reflect this.  In particular, symbol domains match the C language,
with VAR_DOMAIN including variables, functions, and types.

However, other languages have other approaches to namespacing.  And,
in any case, it is often useful for other parts of gdb to be able to
distinguish between some domains at lookup time, without resorting to
examining a symbol's location -- in some situations, this sort of
filtering happens too late.

Nothing uses these new domains yet, but the idea behind the patch is
to separate symbols into more domains and then let the
language-specific parts of gdb implement their semantics in terms of
these categories.
---
 gdb/sym-domains.def | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Patch

diff --git a/gdb/sym-domains.def b/gdb/sym-domains.def
index 251c66fa04b..cea25a5f5b3 100644
--- a/gdb/sym-domains.def
+++ b/gdb/sym-domains.def
@@ -45,3 +45,12 @@  DOMAIN (LABEL)
 /* Fortran common blocks.  Their naming must be separate from VAR_DOMAIN.
    They also always use LOC_COMMON_BLOCK.  */
 DOMAIN (COMMON_BLOCK)
+
+/* TYPE_DOMAIN is for types and typedefs.  Note that tags are not
+   found here, see STRUCT_DOMAIN above.  */
+
+DOMAIN (TYPE)
+
+/* FUNCTION_DOMAIN is for functions and methods.  */
+
+DOMAIN (FUNCTION)