public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 00/30] Restructure symbol domains
@ 2024-01-18 20:31 Tom Tromey
  2024-01-18 20:31 ` [PATCH v2 01/30] Fix bug in cooked index scanner Tom Tromey
                   ` (30 more replies)
  0 siblings, 31 replies; 34+ messages in thread
From: Tom Tromey @ 2024-01-18 20:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Eli Zaretskii

v2 note: I was planning to check this in, but re-testing showed some
regressions.  I've fixed them here, basically DW_TAG_entry_point
caused some problems necessitating a fix in one patch, and a new patch
to fix a latent bug.  I plan to check this in relatively soon.

gdb's symbol domains have long needed some restructuring.

The current symbol domains are C-centric, with the "struct" domain
being separate from types (which is not the case in non-C languages)
and function and types being lumped in with variables.  This latter
decision makes it impossible to search the symbol table for a
function, resulting in bugs like PR 30158, where "main" was found as a
namespace, causing a crash.

This series adds new symbol domains for types and functions, and
changes the various symbol-lookup functions to allow multiple domains
to be searched at once.

Then, the symbol readers are changed to use the new domains.

Finally, selected bits of code are changed to be more precise in which
domains they search.

symbol_matches_domain currently has a C++-specific hack.  This hack
handles the C++ language rule where a tag is also entered as a
typedef.  While working on this series, I discovered that the
non-DWARF symbol readers will actually emit a second typedef symbol.
DWARF could do this as well, at some memory expense; and while I
consider this to be cleaner in an abstract way, for the time being
I've left the hack in place.

I regression tested this on x86-64 Fedora 38.  I also regression
tested using the debug-names and gdb-index target boards.

---
Changes in v2:
- Added patch to fix DW_TAG_entry_point
- Link to v1: https://inbox.sourceware.org/gdb-patches/20231120-submit-domain-hacks-2-v1-0-29650d01b198@tromey.com

---
Tom Tromey (30):
      Fix bug in cooked index scanner
      Small cleanup in DWARF reader
      Fix latent bug in DW_TAG_entry_point handling
      Make nsalias.exp more reliable
      Fix latent bug in mdebugread.c
      Give names to unspecified types
      Remove NR_DOMAINS
      Simplify symbol_to_info_string
      Split up a big 'if' in symtab.c
      Use a .def file for domain_enum
      Add two new symbol domains
      Add domain_search_flags
      Replace search_domain with domain_search_flags
      Remove a check of VAR_DOMAIN
      Introduce "scripting" domains
      Use domain_search_flags in lookup_global_symbol_language
      Use domain_search_flags in lookup_symbol et al
      Remove some obsolete Python constants
      Remove old symbol_matches_domain
      Use the new symbol domains
      Simplify some symbol searches in Ada code
      Simplify some symbol searches in linespec.c
      Only search for "main" as a function
      Only look for functions in expand_symtabs_for_function
      Use a function-domain search in inside_main_func
      Only search types in cp_lookup_rtti_type
      Only search types in lookup_typename
      Only search for functions in rust_structop::evaluate_funcall
      Refine search in cp_search_static_and_baseclasses
      Document new Python and Guile constants

 gdb/NEWS                                 |  12 +
 gdb/ada-exp.y                            |  13 +-
 gdb/ada-lang.c                           |  79 +++--
 gdb/ada-lang.h                           |   6 +-
 gdb/ada-tasks.c                          |  17 +-
 gdb/alpha-mdebug-tdep.c                  |   2 +-
 gdb/ax-gdb.c                             |   5 +-
 gdb/block.c                              |  24 +-
 gdb/block.h                              |  15 +-
 gdb/c-exp.y                              |  19 +-
 gdb/c-lang.c                             |   2 +-
 gdb/c-valprint.c                         |   2 +-
 gdb/coffread.c                           |   5 +-
 gdb/compile/compile-c-symbols.c          |  17 +-
 gdb/compile/compile-cplus-symbols.c      |  15 +-
 gdb/compile/compile-cplus-types.c        |   8 +-
 gdb/compile/compile-object-load.c        |   6 +-
 gdb/cp-namespace.c                       |  66 +++--
 gdb/cp-support.c                         |  10 +-
 gdb/cp-support.h                         |   8 +-
 gdb/ctfread.c                            |   2 +-
 gdb/d-exp.y                              |  12 +-
 gdb/d-lang.c                             |   2 +-
 gdb/d-lang.h                             |   9 +-
 gdb/d-namespace.c                        |  24 +-
 gdb/doc/guile.texi                       |  13 +
 gdb/doc/python.texi                      |  30 +-
 gdb/dwarf2/ada-imported.c                |   2 +-
 gdb/dwarf2/cooked-index.c                |  12 +
 gdb/dwarf2/cooked-index.h                |  46 +--
 gdb/dwarf2/index-write.c                 |   7 +-
 gdb/dwarf2/loc.c                         |   2 +-
 gdb/dwarf2/read-debug-names.c            | 128 ++-------
 gdb/dwarf2/read-gdb-index.c              |  37 ++-
 gdb/dwarf2/read.c                        | 103 +++++--
 gdb/dwarf2/read.h                        |   2 +-
 gdb/dwarf2/tag.h                         |  79 +++++
 gdb/eval.c                               |   5 +-
 gdb/f-exp.y                              |   8 +-
 gdb/f-lang.c                             |   2 +-
 gdb/f-lang.h                             |   2 +-
 gdb/f-valprint.c                         |   2 +-
 gdb/fbsd-tdep.c                          |   5 +-
 gdb/frame.c                              |   9 +-
 gdb/ft32-tdep.c                          |   3 +-
 gdb/gdbtypes.c                           |  35 ++-
 gdb/gnu-v3-abi.c                         |   2 +-
 gdb/go-exp.y                             |   9 +-
 gdb/guile/scm-frame.c                    |   2 +-
 gdb/guile/scm-symbol.c                   |  25 +-
 gdb/infrun.c                             |   2 +-
 gdb/jit.c                                |   2 +-
 gdb/language.c                           |   5 +-
 gdb/language.h                           |   4 +-
 gdb/linespec.c                           |  67 +++--
 gdb/m2-exp.y                             |  10 +-
 gdb/mdebugread.c                         |   6 +-
 gdb/mi/mi-cmd-stack.c                    |   5 +-
 gdb/mi/mi-symbol-cmds.c                  |  35 +--
 gdb/moxie-tdep.c                         |   3 +-
 gdb/objc-lang.c                          |   4 +-
 gdb/objfiles.h                           |   7 +-
 gdb/p-exp.y                              |  19 +-
 gdb/p-valprint.c                         |   2 +-
 gdb/parse.c                              |   3 +-
 gdb/printcmd.c                           |   2 +-
 gdb/psymtab.c                            |  41 +--
 gdb/psymtab.h                            |   5 +-
 gdb/python/py-frame.c                    |   3 +-
 gdb/python/py-objfile.c                  |   6 +-
 gdb/python/py-symbol.c                   |  53 ++--
 gdb/python/python.c                      |   2 +-
 gdb/quick-symbol.h                       |  10 +-
 gdb/rust-lang.c                          |   7 +-
 gdb/rust-lang.h                          |   2 +-
 gdb/rust-parse.c                         |   8 +-
 gdb/source.c                             |   5 +-
 gdb/stabsread.c                          |   8 +-
 gdb/stack.c                              |   4 +-
 gdb/sym-domains.def                      |  58 ++++
 gdb/symfile-debug.c                      |  26 +-
 gdb/symfile.c                            |   9 +-
 gdb/symfile.h                            |   2 +-
 gdb/symmisc.c                            |   3 +-
 gdb/symtab.c                             | 480 +++++++++++++++++--------------
 gdb/symtab.h                             | 177 ++++++------
 gdb/testsuite/gdb.ada/info_auto_lang.exp |   4 +-
 gdb/testsuite/gdb.ada/ptype-o.exp        |   2 +-
 gdb/testsuite/gdb.cp/nsalias.exp         |   2 +-
 gdb/testsuite/gdb.fortran/info-types.exp |   2 +-
 gdb/valops.c                             |  14 +-
 gdb/value.c                              |   6 +-
 gdb/xcoffread.c                          |   9 +-
 gdb/xstormy16-tdep.c                     |   3 +-
 94 files changed, 1129 insertions(+), 948 deletions(-)
---
base-commit: 0d656dfe5b406289faef7f35fb87fb0a00dd64f3
change-id: 20231120-submit-domain-hacks-2-1c1e66b4d560

Best regards,
-- 
Tom Tromey <tom@tromey.com>


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2024-01-29 18:20 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v2 30/30] Document new Python and Guile constants Tom Tromey
2024-01-28 23:42 ` [PATCH v2 00/30] Restructure symbol domains Tom Tromey

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).