aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2024-01-08Remove two quick_symbol_functions methodsTom Tromey1-1/+0
quick_symbol_functions::read_partial_symbols is no longer implemented, so both it and quick_symbol_functions::can_lazily_read_symbols can be removed. This allows for other functions to be removed as well. Note that SYMFILE_NO_READ is now pretty much dead. I haven't removed it here -- but could if that's desirable. I tend to think that this functionality would be better implemented in the core; but whenever I dive into the non-DWARF readers it is pretty depressing.
2023-12-06Remove quick_symbol_functions::expand_matching_symbolsTom Tromey1-104/+0
The only caller of quick_symbol_functions::expand_matching_symbols was removed, so now this method and all implementations of it can be removed.
2023-11-21gdb: Use std::string_view instead of gdb::string_viewLancelot Six1-1/+1
Given that GDB now requires a C++17, replace all uses of gdb::string_view with std::string_view. This change has mostly been done automatically: - gdb::string_view -> std::string_view - #include "gdbsupport/gdb_string_view.h" -> #include <string_view> One things which got brought up during review is that gdb::stging_view does support being built from "nullptr" while std::sting_view does not. Two places are manually adjusted to account for this difference: gdb/tui/tui-io.c:tui_getc_1 and gdbsupport/format.h:format_piece::format_piece. The above automatic change transformed "gdb::to_string (const gdb::string_view &)" into "gdb::to_string (const std::string_view &)". The various direct users of this function are now explicitly including "gdbsupport/gdb_string_view.h". A later patch will remove the users of gdb::to_string. The implementation and tests of gdb::string_view are unchanged, they will be removed in a following patch. Change-Id: Ibb806a7e9c79eb16a55c87c6e41ad396fecf0207 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-11-21gdb: Replace gdb::optional with std::optionalLancelot Six1-1/+1
Since GDB now requires C++17, we don't need the internally maintained gdb::optional implementation. This patch does the following replacing: - gdb::optional -> std::optional - gdb::in_place -> std::in_place - #include "gdbsupport/gdb_optional.h" -> #include <optional> This change has mostly been done automatically. One exception is gdbsupport/thread-pool.* which did not use the gdb:: prefix as it already lives in the gdb namespace. Change-Id: I19a92fa03e89637bab136c72e34fd351524f65e9 Approved-By: Tom Tromey <tom@tromey.com> Approved-By: Pedro Alves <pedro@palves.net>
2023-08-18Merge psympriv.h into psymtab.hTom Tromey1-7/+7
psympriv.h was intended for use by code that created partial symbols. Now that no generic code needs psymtab.h any more, psympriv.h can be merged into psymtab.h.
2023-08-14[gdb] Fix maint print symbols/psymbols help textTom de Vries1-2/+2
Consider the help text of "maint print symbols": ... (gdb) help maint print symbols Print dump of current symbol definitions. Usage: mt print symbols [-pc ADDRESS] [--] [OUTFILE] mt print symbols [-objfile OBJFILE] [-source SOURCE] [--] [OUTFILE] Entries in the full symbol table are dumped to file OUTFILE, or the terminal if OUTFILE is unspecified. If ADDRESS is provided, dump only the file for that address. If SOURCE is provided, dump only that file's symbols. If OBJFILE is provided, dump only that file's minimal symbols. ... and "maint print psymbols": ... (gdb) help maint print psymbols Print dump of current partial symbol definitions. Usage: mt print psymbols [-objfile OBJFILE] [-pc ADDRESS] [--] [OUTFILE] mt print psymbols [-objfile OBJFILE] [-source SOURCE] [--] [OUTFILE] Entries in the partial symbol table are dumped to file OUTFILE, or the terminal if OUTFILE is unspecified. If ADDRESS is provided, dump only the file for that address. If SOURCE is provided, dump only that file's symbols. If OBJFILE is provided, dump only that file's minimal symbols. ... The OBJFILE lines mistakingly mention minimal symbols. Fix this by reformulating as "dump only that object file's symbols". Also make the ADDRESS lines more clear by using the formulation: "dump only the symbols for the file with code at that address". Tested on x86_64-linux. Co-Authored-By: Eli Zaretskii <eliz@gnu.org> PR gdb/30742 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30742
2023-03-28Rename "raw" to "unrelocated"Tom Tromey1-2/+2
Per an earlier discussion, this patch renames the existing "raw" APIs to use the word "unrelocated" instead.
2023-03-28Use unrelocated_addr in psymbolsTom Tromey1-2/+3
This changes psymbols themselves to use unrelocated_addr. This transform is largely mechanical. I don't think it finds any bugs.
2023-03-28Use unrelocated_addr in partial symbol tablesTom Tromey1-2/+2
This changes partial symbol tables to use unrelocated_addr for the text_high and text_low members. This revealed some latent bugs in ctfread.c, which are fixed here.
2023-03-08Remove OBJF_REORDEREDTom Tromey1-2/+1
OBJF_REORDERED is set for nearly every object format. And, despite the ominous warnings here and there, it does not seem very expensive. This patch removes the flag entirely. Reviewed-By: Andrew Burgess <aburgess@redhat.com>
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-12-19Remove quick_symbol_functions::relocatedTom Tromey1-69/+0
quick_symbol_functions::relocated is only needed for psymtabs, and there it is only needed for Rust. However, because we've switched the DWARF reader away from psymtabs, this means there's no longer a need for this method at all.
2022-10-19internal_error: remove need to pass __FILE__/__LINE__Pedro Alves1-2/+1
Currently, every internal_error call must be passed __FILE__/__LINE__ explicitly, like: internal_error (__FILE__, __LINE__, "foo %d", var); The need to pass in explicit __FILE__/__LINE__ is there probably because the function predates widespread and portable variadic macros availability. We can use variadic macros nowadays, and in fact, we already use them in several places, including the related gdb_assert_not_reached. So this patch renames the internal_error function to something else, and then reimplements internal_error as a variadic macro that expands __FILE__/__LINE__ itself. The result is that we now should call internal_error like so: internal_error ("foo %d", var); Likewise for internal_warning. The patch adjusts all calls sites. 99% of the adjustments were done with a perl/sed script. The non-mechanical changes are in gdbsupport/errors.h, gdbsupport/gdb_assert.h, and gdb/gdbarch.py. Approved-By: Simon Marchi <simon.marchi@efficios.com> Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
2022-07-29gdb: introduce symtab_create_debug_printfSimon Marchi1-7/+7
Introduce symtab_create_debug_printf and symtab_create_debug_printf_v, to print the debug messages enabled by "set debug symtab-create". Change-Id: I442500903f72d4635c2dd9eaef770111f317dc04
2022-06-12Remove psymtab_addrmapTom Tromey1-107/+1
While working on addrmaps, I noticed that psymtab_addrmap is no longer needed now. It was introduced in ancient times as an optimization for DWARF, but no other symbol reader was ever updated to use it. Now that DWARF does not use psymtabs, it can be deleted.
2022-06-12Remove addrmap wrapper functionsTom Tromey1-2/+1
This removes the various addrmap wrapper functions in favor of simple method calls on the objects themselves.
2022-05-26gdb: Change psymbol_functions::require_partial_symbols to partial_symbolsLancelot SIX1-20/+17
The previous patch ensured that partial symbols are read before calling most of the quick_function's methods. The psymbol_functions class has the require_partial_symbols method which serves this exact purpose, and does not need to do it anymore. This patch renames this method to partial_symbols and makes it an accessor which asserts that partial symbols have been read at this point. Regression tested on x86_64-linux.
2022-04-27gdb: remove BLOCKVECTOR_BLOCK and BLOCKVECTOR_NBLOCKS macrosSimon Marchi1-2/+2
Replace with calls to blockvector::blocks, and the appropriate method call on the returned array_view. Change-Id: I04d1f39603e4d4c21c96822421431d9a029d8ddd
2022-04-27gdb: remove BLOCK_{START,END} macrosSimon Marchi1-4/+4
Replace with equivalent methods. Change-Id: I10a6c8a2a86462d9d4a6a6409a3f07a6bea66310
2022-04-11gdb: remove symbol value macrosSimon Marchi1-6/+6
Remove all macros related to getting and setting some symbol value: #define SYMBOL_VALUE(symbol) (symbol)->value.ivalue #define SYMBOL_VALUE_ADDRESS(symbol) \ #define SET_SYMBOL_VALUE_ADDRESS(symbol, new_value) \ #define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes #define SYMBOL_VALUE_COMMON_BLOCK(symbol) (symbol)->value.common_block #define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block #define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain #define MSYMBOL_VALUE(symbol) (symbol)->value.ivalue #define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0) #define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \ #define BMSYMBOL_VALUE_ADDRESS(symbol) \ #define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \ #define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes #define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block Replace them with equivalent methods on the appropriate objects. Change-Id: Iafdab3b8eefc6dc2fd895aa955bf64fafc59ed50
2022-04-04gdb: remove assertion in psymbol_functions::expand_symtabs_matchingSimon Marchi1-6/+3
psymtab_to_symtab is documented as possibly returning nullptr, if the primary symtab of the partial symtab has no symbols. However, psymbol_functions::expand_symtabs_matching asserts that the result of psymtab_to_symtab as non-nullptr. I caught this assert by trying the CTF symbol reader on a library I built with -gctf: $ ./gdb --data-directory=data-directory /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ... Reading symbols from /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0... (gdb) maintenance expand-symtabs /home/simark/src/binutils-gdb/gdb/psymtab.c:1142: internal-error: expand_symtabs_matching: Assertion `symtab != nullptr' failed. The "symtab" in question is: $ readelf --ctf=.ctf /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ... CTF archive member: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c: Header: Magic number: 0xdff2 Version: 4 (CTF_VERSION_3) Flags: 0xe (CTF_F_NEWFUNCINFO, CTF_F_IDXSORTED, CTF_F_DYNSTR) Parent name: .ctf Compilation unit name: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c Type section: 0x0 -- 0x13 (0x14 bytes) String section: 0x14 -- 0x5f (0x4c bytes) Labels: Data objects: Function objects: Variables: Types: 0x80000001: (kind 5) bt_bool (*) (const bt_value *) (aligned at 0x8) Strings: 0x0: 0x1: .ctf 0x6: /home/simark/src/babeltrace/src/lib/graph/component-descriptor-set.c It contains a single type, and it is skipped by ctf_add_type_cb, because an identical type was already seen earlier in this objfile. As a result, no compunit_symtab is created. Change psymbol_functions::expand_symtabs_matching to expect that psymtab_to_symtab can return nullptr. Another possibility would be to make the CTF symbol reader always create a compunit_symtab, even if there are no symbols in it (like the DWARF parser does), but so far I don't see any advantage in doing so. Change-Id: Ic43c38202c838a5eb87630ed1fd61d33528164f4
2022-03-29Remove unnecessary calls to wrap_here and gdb_flushTom Tromey1-1/+0
Various spots in gdb currently know about the wrap buffer, and so are careful to call wrap_here to be certain that all output has been flushed. Now that the pager is just an ordinary stream, this isn't needed, and a simple call to gdb_flush is enough. Similarly, there are places where gdb prints to gdb_stderr, but first flushes gdb_stdout. stderr_file already flushes gdb_stdout, so these aren't needed.
2022-03-29Unify gdb printf functionsTom Tromey1-104/+104
Now that filtered and unfiltered output can be treated identically, we can unify the printf family of functions. This is done under the name "gdb_printf". Most of this patch was written by script.
2022-03-29Unify gdb puts functionsTom Tromey1-45/+45
Now that filtered and unfiltered output can be treated identically, we can unify the puts family of functions. This is done under the name "gdb_puts". Most of this patch was written by script.
2022-02-18Add constructor to bound_minimal_symbolTom Tromey1-1/+1
This adds a constructor to bound_minimal_symbol, to avoid a build failure with clang that Simon pointed out. I also took the opportunity to remove some redundant initializations, and to change one use of push_back to emplace_back, as suggested by Simon.
2022-02-06gdb: remove COMPUNIT_BLOCKVECTOR macro, add getter/setterSimon Marchi1-1/+1
Add a getter and a setter for a compunit_symtab's blockvector. Remove the corresponding macro and adjust all callers. Change-Id: I99484c6619dcbbea7c5d89c72aa660316ca62f64
2022-02-06gdb: rename compunit_primary_filetab to compunit_symtab::primary_filetabSimon Marchi1-1/+1
Make compunit_primary_filetab a method of compunit_symtab. Change-Id: Iee3c4f7e36d579bf763c5bba146e5e10d6766768
2022-01-26Always call the wrap_here methodTom Tromey1-5/+5
This changes all existing calls to wrap_here to call the method on the appropriate ui_file instead. The choice of ui_file is determined by context.
2022-01-26Convert wrap_here to use integer parameterTom Tromey1-5/+5
I think it only really makes sense to call wrap_here with an argument consisting solely of spaces. Given this, it seemed better to me that the argument be an int, rather than a string. This patch is the result. Much of it was written by a script.
2022-01-25Reduce explicit use of gdb_stdoutTom Tromey1-18/+12
In an earlier version of the pager rewrite series, it was important to audit unfiltered output calls to see which were truly necessary. This is no longer necessary, but it still seems like a decent cleanup to change calls to avoid explicitly passing gdb_stdout. That is, rather than using something like fprintf_unfiltered with gdb_stdout, the code ought to use plain printf_unfiltered instead. This patch makes this change. I went ahead and converted all the _filtered calls I could find, as well, for the same clarity.
2022-01-18Move gdb_regex to gdbsupportTom Tromey1-1/+1
This moves the gdb_regex convenience class to gdbsupport.
2022-01-18Move gdb_argv to gdbsupportTom Tromey1-0/+1
This moves the gdb_argv class to a new header in gdbsupport.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-12-24Remove gdb_print_host_addressTom Tromey1-30/+16
gdb_print_host_address is just a simple wrapper around fprintf_filtered. However, it is readily replaced in all callers by a combination of %s and call to host_address_to_string. This also simplifies the code, so I think it's worthwhile to remove this function. Regression tested on x86-64 Fedora 64.
2021-11-29[gdb/symtab] Fix segfault in search_one_symtabTom de Vries1-0/+2
PR28539 describes a segfault in lambda function search_one_symtab due to psymbol_functions::expand_symtabs_matching calling expansion_notify with a nullptr symtab: ... struct compunit_symtab *symtab = psymtab_to_symtab (objfile, ps); if (expansion_notify != NULL) if (!expansion_notify (symtab)) return false; ... This happens as follows. The partial symtab ps is a dwarf2_include_psymtab for some header file: ... (gdb) p ps.filename $5 = 0x64fcf80 "/usr/include/c++/11/bits/stl_construct.h" ... The includer of ps is a shared symtab for a partial unit, with as user: ... (gdb) p ps.includer().user.filename $11 = 0x64fc9f0 \ "/usr/src/debug/llvm13-13.0.0-1.2.x86_64/tools/clang/lib/AST/Decl.cpp" ... The call to psymtab_to_symtab expands the Decl.cpp symtab (and consequently the shared symtab), but returns nullptr because: ... struct dwarf2_include_psymtab : public partial_symtab { ... compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override { return nullptr; } ... Fix this by returning the Decl.cpp symtab instead, which fixes the segfault in the PR. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28539
2021-08-10Generalize addrmap dumpingTom Tromey1-51/+5
While debugging another patch series, I wanted to dump an addrmap. I came up with this patch, which generalizes the addrmap-dumping code from psymtab.c and moves it to addrmap.c. psymtab.c is changed to use the new code.
2021-07-17Introduce find_source_or_rewriteTom Tromey1-19/+2
The final bug fix in this series would duplicate the logic in psymtab_to_fullname, so this patch extracts the body of this function into a new function.
2021-07-16Document quick_symbol_functions::expand_symtabs_matching invariantTom Tromey1-1/+4
While working on my series to replace the DWARF psymbol reader, I noticed that the expand_symtabs_matching has an undocumented invariant. I think that, if this invariant is not followed, then GDB will crash. So, this patch documents this in the relevant spots and introduces some asserts to make it clear. Regression tested on x86-64 Fedora 32.
2021-06-25gdb: add new function quick_symbol_functions::has_unexpanded_symbolsAndrew Burgess1-0/+18
Adds a new function to the quick_symbol_functions API to let us know if there are any unexpanded symbols. This functionality is required by a later commit. After this commit the functionality is unused, and untested. The new function objfile::has_unexpanded_symtabs is added to the symfile-debug.c file which is a little strange, but this is (currently) where many of the other objfile::* functions (that call onto the quick_symbol_functions) are defined, so I'm reluctant to break this pattern. There should be no user visible changes after this commit. gdb/ChangeLog: * dwarf2/read.c (struct dwarf2_base_index_functions) <has_unexpanded_symtabs>: Declare. (dwarf2_base_index_functions::has_unexpanded_symtabs): Define new function. * objfiles.h (struct objfile) <has_unexpanded_symtabs>: Declare. * psympriv.h (struct psymbol_functions) <has_unexpanded_symtabs>: Declare. * psymtab.c (psymbol_functions::has_unexpanded_symtabs): Define new function. * quick-symbol.h (struct quick_symbol_functions) <has_unexpanded_symtabs>: Declare. * symfile-debug.c (objfile::has_unexpanded_symtabs): Define new function.
2021-06-25Use gdb::function_view in addrmap_foreachTom Tromey1-37/+28
While working on the DWARF psymtab replacement, I needed addrmap_foreach to accept a gdb::function_view. This seemed like a worthwhile change on its own, so I've written it separately for submission. Regression tested on x86-64 Fedora 32. gdb/ChangeLog 2021-06-25 Tom Tromey <tom@tromey.com> * dwarf2/index-write.c (struct addrmap_index_data): Add initializers. <operator()>: Declare. (addrmap_index_data::operator()): Rename from add_address_entry_worker. Remove 'datap' parameter. (write_address_map): Update. * psymtab.c (struct dump_psymtab_addrmap_data): Remove (dump_psymtab_addrmap_1): Remove 'data' parameter, add other parameters. (dump_psymtab_addrmap): Update. * addrmap.c (struct addrmap_funcs) <foreach>: Remove 'data' parameter. (addrmap_foreach, addrmap_fixed_foreach): Likewise. (struct mutable_foreach_data): Remove. (addrmap_mutable_foreach_worker): Update. (addrmap_mutable_foreach): Remove 'data' parameter. * addrmap.h (addrmap_foreach_fn): Use gdb::function_view. (addrmap_foreach): Remove 'data' parameter.
2021-04-27Fix timeout with maint print objfilesLuis Machado1-2/+1
I'm seeing timeouts from gdb.rust/traits.exp when we attempt to print things with "maint print objfiles". This happens for two reasons: 1 - GDB does not explicitly split each entry into its own line, but rather relies on the terminal's width to insert line breaks. 2 - When running the GDB testsuite, such width may be unlimited, which will prevent GDB from inserting any line breaks. As a result, the output may be too lengthy and will come in big lines. Tweak the support library to match the patterns line-by-line, which gives us more time to match things. Also fix GDB's output to print one entry per line, regardless of the terminal width. A similar approach was used in another testcase using the same command (commit eaeaf44cfdc9a4096a0dd52fa0606f29d4bfd48e). With the new line breaks, we don't need a particular pattern, so clean up that test as well. gdb/ChangeLog: 2021-04-27 Luis Machado <luis.machado@linaro.org> * psymtab.c (psymbol_functions::dump): Output newline. * symmisc.c (dump_objfile): Likewise. gdb/testsuite/ChangeLog: 2021-04-27 Luis Machado <luis.machado@linaro.org> * gdb.base/maint.exp: Drop a pattern that is not needed. * lib/gdb.exp (readnow): Match line-by-line.
2021-04-17Simplify quick_symbol_functions::map_matching_symbolsTom Tromey1-18/+5
quick_symbol_functions::map_matching_symbols is only used by the Ada code. Currently, it both expands certain psymtabs and then walks over the full symtabs -- including any already-expanded ones -- calling a callback. It appears to work lazily as well, in that if the callback returns false, iteration stops. However, only the psymtab implementation does this; the DWARF index implementations are not lazy. It turns out, though, that the only callback that is ever passed here never returns false. This patch simplifies this method by removing the callback. The method is also renamed. In the new scheme, the caller is responsible for walking the full symtabs, which removes some redundancy as well. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * psymtab.c (psymbol_functions::expand_matching_symbols): Rename from map_matching_symbols. Change parameters. * psympriv.h (struct psymbol_functions) <expand_matching_symbols>: Rename from map_matching_symbols. Change parameters. * dwarf2/read.c (struct dwarf2_gdb_index) <expand_matching_symbols>: Rename from map_matching_symbols. Change parameters. (struct dwarf2_debug_names_index) <expand_matching_symbols>: Rename from map_matching_symbols. Change parameters. (dwarf2_gdb_index::expand_matching_symbols): Rename from dw2_map_matching_symbols. Change parameters. (dwarf2_gdb_index::expand_matching_symbols): Remove old implementation. (dwarf2_debug_names_index::expand_matching_symbols): Rename from map_matching_symbols. Change parameters. * objfiles.h (struct objfile) <expand_matching_symbols>: Rename from map_matching_symbols. Change parameters. * symfile-debug.c (objfile::expand_matching_symbols): Rename from map_matching_symbols. Change parameters. * ada-lang.c (map_matching_symbols): New function. (add_nonlocal_symbols): Update.
2021-04-17Remove quick_symbol_functions::expand_symtabs_with_fullnameTom Tromey1-22/+0
This removes quick_symbol_functions::expand_symtabs_with_fullname, replacing it with a call to expand_symtabs_matching. As with the previous patches, the implementation is consolidated in the objfile method. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * quick-symbol.h (struct quick_symbol_functions) <expand_symtabs_with_fullname>: Remove. * psymtab.c (psymbol_functions::expand_symtabs_with_fullname): Remove. * psympriv.h (struct psymbol_functions) <expand_symtabs_with_fullname>: Remove. * dwarf2/read.c (struct dwarf2_base_index_functions) <expand_symtabs_with_fullname>: Remove. (dwarf2_base_index_functions::expand_symtabs_with_fullname): Remove. * objfiles.h (struct objfile) <expand_symtabs_with_fullname>: Update comment. * symfile-debug.c (objfile::expand_symtabs_with_fullname): Rewrite.
2021-04-17Remove quick_symbol_functions::expand_symtabs_for_functionTom Tromey1-23/+0
This removes quick_symbol_functions::expand_symtabs_for_function, replacing it with a call to expand_symtabs_matching. As with the previous patches, the implementation is consolidated in the objfile method. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * symfile-debug.c (objfile::expand_symtabs_for_function): Rewrite. * quick-symbol.h (struct quick_symbol_functions) <expand_symtabs_for_function>: Remove. * psymtab.c (psymbol_functions::expand_symtabs_for_function): Remove. * psympriv.h (struct psymbol_functions) <expand_symtabs_for_function>: Remove. * objfiles.h (struct objfile) <expand_symtabs_for_function>: Update comment. * dwarf2/read.c (struct dwarf2_gdb_index) <expand_symtabs_for_function>: Remove. (struct dwarf2_debug_names_index) <expand_symtabs_for_function>: Remove. (find_slot_in_mapped_hash): Remove. (dw2_symtab_iter_init_common): Merge with dw2_symtab_iter_init. (dw2_symtab_iter_init): Remove one overload. (dwarf2_gdb_index::expand_symtabs_for_function) (dwarf2_debug_names_index::expand_symtabs_for_function): Remove.
2021-04-17Remove quick_symbol_functions::map_symtabs_matching_filenameTom Tromey1-90/+0
This replaces quick_symbol_functions::map_symtabs_matching_filename with a call to expand_symtabs_matching. As with the previous patch, rather than update all callers, the implementation is consolidated in objfile::map_symtabs_matching_filename. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * symfile-debug.c (objfile::map_symtabs_matching_filename): Rewrite. * quick-symbol.h (struct quick_symbol_functions) <map_symtabs_matching_filename>: Remove. * psymtab.c (partial_map_expand_apply) (psymbol_functions::map_symtabs_matching_filename): Remove. * psympriv.h (struct psymbol_functions) <map_symtabs_matching_filename>: Remove. * objfiles.h (struct objfile) <map_symtabs_matching_filename>: Update comment. * dwarf2/read.c (struct dwarf2_base_index_functions) <map_symtabs_matching_filename>: Remove. (dw2_map_expand_apply) (dwarf2_base_index_functions::map_symtabs_matching_filename): Remove.
2021-04-17Remove quick_symbol_functions::lookup_symbolTom Tromey1-51/+0
This removes quick_symbol_functions, replacing it with calls to expand_symtabs_matching. Because the replacement is somewhat verbose, objfile::lookup_symbol is not removed. This consolidates some duplicated code into this one spot. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * symfile-debug.c (objfile::lookup_symbol): Rewrite. * quick-symbol.h (struct quick_symbol_functions) <lookup_symbol>: Remove. * psymtab.c (psymbol_functions::lookup_symbol): Remove. * psympriv.h (struct psymbol_functions) <lookup_symbol>: Remove. * objfiles.h (struct objfile) <lookup_symbol>: Add comment. * dwarf2/read.c (struct dwarf2_gdb_index) <lookup_symbol>: Remove. (struct dwarf2_debug_names_index) <lookup_symbol>: Remove. (dwarf2_gdb_index::lookup_symbol) (dwarf2_debug_names_index::lookup_symbol): Remove.
2021-04-17Add 'domain' parameter to expand_symtabs_matchingTom Tromey1-14/+20
Currently, expand_symtabs_matching only accepts a search_domain parameter. However, lookup_symbol uses a domain_enum instead, and the two, confusingly, do quite different things -- one cannot emulate the other. So, this patch adds a domain_enum parameter to expand_symtabs_matching, with UNDEF_DOMAIN used as a wildcard. This is another step toward replacing lookup_symbol with expand_symtabs_matching. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * symtab.c (global_symbol_searcher::expand_symtabs): Update. * symmisc.c (maintenance_expand_symtabs): Update. * symfile.c (expand_symtabs_matching): Update. * symfile-debug.c (objfile::expand_symtabs_matching): Add 'domain' parameter. * quick-symbol.h (struct quick_symbol_functions) <expand_symtabs_matching>: Add 'domain' parameter. * psymtab.c (recursively_search_psymtabs) (psymbol_functions::expand_symtabs_matching): Add 'domain' parameter. * psympriv.h (struct psymbol_functions) <expand_symtabs_matching>: Add 'domain' parameter. * objfiles.h (struct objfile) <expand_symtabs_matching>: Add 'domain' parameter. * linespec.c (iterate_over_all_matching_symtabs): Update. * dwarf2/read.c (struct dwarf2_gdb_index) <expand_symtabs_matching>: Add 'domain' parameter. (struct dwarf2_debug_names_index) <expand_symtabs_matching>: Add 'domain' parameter. (dw2_expand_symtabs_matching) (dwarf2_gdb_index::expand_symtabs_matching) (dw2_debug_names_iterator) (dwarf2_debug_names_index::expand_symtabs_matching): Add 'domain' parameter.
2021-04-17Add search_flags to expand_symtabs_matchingTom Tromey1-4/+19
This adds a block search flags parameter to expand_symtabs_matching. All callers are updated to search both the static and global blocks, as that was the implied behavior before this patch. This is a step toward replacing lookup_symbol with expand_symtabs_matching. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * symtab.c (global_symbol_searcher::expand_symtabs) (default_collect_symbol_completion_matches_break_on): Update. * symmisc.c (maintenance_expand_symtabs): Update. * symfile.h (expand_symtabs_matching): Add search_flags parameter. * symfile.c (expand_symtabs_matching): Add search_flags parameter. * symfile-debug.c (objfile::expand_symtabs_matching): Add search_flags parameter. * quick-symbol.h (struct quick_symbol_functions) <expand_symtabs_matching>: Add search_flags parameter. * python/py-symbol.c (gdbpy_lookup_static_symbols): Update. * psymtab.c (recursively_search_psymtabs) (psymbol_functions::expand_symtabs_matching): Add search_flags parameter. * psympriv.h (struct psymbol_functions) <expand_symtabs_matching>: Add search_flags parameter. * objfiles.h (struct objfile) <expand_symtabs_matching>: Add search_flags parameter. * linespec.c (iterate_over_all_matching_symtabs): Update. * dwarf2/read.c (struct dwarf2_gdb_index) <expand_symtabs_matching>: Add search_flags parameter. (struct dwarf2_debug_names_index) <expand_symtabs_matching>: Add search_flags parameter. (dw2_map_matching_symbols): Update. (dw2_expand_marked_cus, dw2_expand_symtabs_matching) (dwarf2_gdb_index::expand_symtabs_matching): Add search_flags parameter. (dw2_debug_names_iterator): Change block_index to search flags. <m_block_index>: Likewise. (dw2_debug_names_iterator::next) (dwarf2_debug_names_index::lookup_symbol) (dwarf2_debug_names_index::expand_symtabs_for_function) (dwarf2_debug_names_index::map_matching_symbols) (dwarf2_debug_names_index::map_matching_symbols): Update. (dwarf2_debug_names_index::expand_symtabs_matching): Add search_flags parameter. * ada-lang.c (ada_add_global_exceptions) (collect_symbol_completion_matches): Update.
2021-04-17Let expand_symtabs_matching short-circuitTom Tromey1-2/+5
This changes expand_symtabs_exp_notify_ftype to return bool, and updates all the uses. Now, if the notification function returns false, the call is short-circuited and stops examining symtabs. This is a step toward replacing map_symtabs_matching_filename with expand_symtabs_matching. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * symtab.c (default_collect_symbol_completion_matches_break_on): Update. * symfile.h (expand_symtabs_matching): Return bool. * symfile.c (expand_symtabs_matching): Return bool. * symfile-debug.c (objfile::expand_symtabs_matching): Return bool. * quick-symbol.h (expand_symtabs_exp_notify_ftype): Return bool. (struct quick_symbol_functions) <expand_symtabs_matching>: Return bool. * psymtab.c (psymbol_functions::expand_symtabs_matching): Return bool. * psympriv.h (struct psymbol_functions) <expand_symtabs_matching>: Return bool. * objfiles.h (struct objfile) <expand_symtabs_matching>: Return bool. * dwarf2/read.c (struct dwarf2_gdb_index) <expand_symtabs_matching>: Return bool. (struct dwarf2_debug_names_index) <expand_symtabs_matching>: Return bool. (dw2_expand_symtabs_matching_symbol): Return bool. (dw2_expand_symtabs_matching_one, dw2_expand_marked_cus) (dw2_expand_symtabs_matching) (dwarf2_gdb_index::expand_symtabs_matching) (dwarf2_debug_names_index::expand_symtabs_matching) (dwarf2_debug_names_index::expand_symtabs_matching): Return bool.