aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
AgeCommit message (Collapse)AuthorFilesLines
2024-11-11Wrap help strings at 80 columnsTom Tromey1-1/+2
This patch ensures that all ordinary help strings are wrapped at 80 columns. For the most part this consists of changing code like this (note the embedded \n and the trailing backslash without a newline): -Manage the space-separated list of debuginfod server URLs that GDB will query \ -when missing debuginfo, executables or source files.\nThe default value is \ -copied from the DEBUGINFOD_URLS environment variable."), ... to end each line with \n\, like: +Manage the space-separated list of debuginfod server URLs that GDB will\n\ +query when missing debuginfo, executables or source files.\n\ +The default value is copied from the DEBUGINFOD_URLS environment variable."), Approved-By: Eli Zaretskii <eliz@gnu.org>
2024-09-24[gdb/symtab] Don't expand non-Ada CUs for info exceptionsTom de Vries1-1/+3
I noticed when running test-case gdb.ada/info_exc.exp with glibc debug info installed, that the "info exceptions" command that lists all Ada exceptions also expands non-Ada CUs, which includes CUs in /lib64/ld-linux-x86-64.so.2 and /lib64/libc.so.6. Fix this by: - adding a new lang_matcher parameter to the expand_symtabs_matching function, and - using that new parameter in the expand_symtabs_matching call in ada_add_global_exceptions. The new parameter is a hint, meaning implementations are free to ignore it and expand CUs with any language. This is the case for partial symtabs, I'm not sure whether it makes sense to implement support for this there. Conversely, when processing a CU with language C and name "<artificial>" (as produced by GCC LTO), the CU may not really have a single language and we should ignore the lang_matcher. See also commit d2f67711730 ("Fix 'catch exception' with -flto"). Now that we have lang_matcher available, also use it to limit name splitting styles and symbol matchers to those applicable to the matched languages. Without this patch we have (with a gdb build with -O0): ... $ time gdb -q -batch -x outputs/gdb.ada/info_exc/gdb.in.1 > /dev/null real 0m1.866s user 0m2.089s sys 0m0.120s ... and with this patch we have: ... $ time gdb -q -batch -x outputs/gdb.ada/info_exc/gdb.in.1 > /dev/null real 0m0.469s user 0m0.777s sys 0m0.051s ... Or, to put it in terms of number of CUs, we have 1853 CUs: ... $ gdb -q -batch -readnow outputs/gdb.ada/info_exc/foo \ -ex start \ -ex "maint info symtabs" \ | grep -c " name " 1853 ... Without this patch, we have: ... $ gdb -q -batch outputs/gdb.ada/info_exc/foo \ -ex start \ -ex "info exceptions" \ -ex "maint info symtabs" \ | grep -c " name " 1393 ... so ~75% of the CUs is expanded, and with this patch we have: ... $ gdb <same-as-above> 20 ... so ~1% of the CUs is expanded. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR symtab/32182 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32182
2024-09-13Update more types for section index changeTom Tromey1-1/+1
Commit f89276a2f3e ("change type of `general_symbol_info::m_section` to int") did what it says in the title -- changed the type of the section index from short to int. However, it seems incomplete, in that there are uses of the section index that use the type 'short'. This patch fixes the ones I found, first by searching for "short.*sect" and then by looking at all the callers of section_index (and then functions called with the resulting value) just to try to be more sure. Approved-by: Kevin Buettner <kevinb@redhat.com> Approved-By: Simon Marchi <simon.marchi@efficios.com>
2024-08-12gdb: drop struct keyword when using bound_minimal_symbolSimon Marchi1-9/+8
This is a simple find / replace from "struct bound_minimal_symbol" to "bound_minimal_symbol", to make things shorter and more consisten througout. In some cases, move variable declarations where first used. Change-Id: Ica4af11c4ac528aa842bfa49a7afe8fe77a66849 Reviewed-by: Keith Seitz <keiths@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-06-04Make bcache more type-safeTom Tromey1-4/+2
The bcache uses memcpy to make copies of the data passed to it. In C++, this is only safe for trivially-copyable types. This patch changes bcache to require this property, and slightly changes the API to make it easier to use when copying a single object. It also makes the new 'insert' template methods return the correct type.
2024-06-04Some constification in psymtabTom Tromey1-31/+28
This patch changes some spots in psymtab.[ch] to use 'const'. This is just preparation for a subsequent patch. Note that psymbols are conceptually const, and since they were changed to be objfile-indepdendent, they are truly never modified -- which is what makes this patch reasonably short.
2024-04-25gdb: remove gdbcmd.hSimon Marchi1-1/+1
Most files including gdbcmd.h currently rely on it to access things actually declared in cli/cli-cmds.h (setlist, showlist, etc). To make things easy, replace all includes of gdbcmd.h with includes of cli/cli-cmds.h. This might lead to some unused includes of cli/cli-cmds.h, but it's harmless, and much faster than going through the 170 or so files by hand. Change-Id: I11f884d4d616c12c05f395c98bbc2892950fb00f Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: move a bunch of quit-related things to event-top.{c,h}Simon Marchi1-0/+1
Move some declarations related to the "quit" machinery from defs.h to event-top.h. Most of the definitions associated to these declarations are in event-top.c. The exceptions are `quit()` and `maybe_quit()`, that are defined in utils.c. For consistency, move these two definitions to event-top.c. Include "event-top.h" in many files that use these things. Change-Id: I6594f6df9047a9a480e7b9934275d186afb14378 Approved-By: Tom Tromey <tom@tromey.com>
2024-03-26gdb, gdbserver, gdbsupport: remove includes of early headersSimon Marchi1-1/+0
Now that defs.h, server.h and common-defs.h are included via the `-include` option, it is no longer necessary for source files to include them. Remove all the inclusions of these files I could find. Update the generation scripts where relevant. Change-Id: Ia026cff269c1b7ae7386dd3619bc9bb6a5332837 Approved-By: Pedro Alves <pedro@palves.net>
2024-02-27Two minor addrmap cleanupsTom Tromey1-1/+0
While working on a different patch, I found a couple of simple addrmap cleanups. In one case, a forward declaration is no longer needed, as the header now includes addrmap.h. In the other, an include of addrmap.h is no longer needed. Tested by rebuilding.
2024-02-15Move lookup_name_info creation into basic_lookup_transparent_typeTom Tromey1-4/+6
I noticed that basic_lookup_transparent_type calls two different functions that both proceed to create a lookup_name_info. It's more efficient to create this object in the outermost layer possible. Making this change required a few related changes, resulting in this patch. There are still more changes of this sort that could be made. Regression tested on x86-64 Fedora 38.
2024-01-28Use domain_search_flags in lookup_symbol et alTom Tromey1-2/+2
This changes lookup_symbol and associated APIs to accept domain_search_flags rather than a domain_enum. Note that this introduces some new constants to Python and Guile. I chose to break out the documentation patch for this, because the internals here do not change until a later patch, and it seemed simpler to patch the docs just once, rather than twice.
2024-01-28Use domain_search_flags in lookup_global_symbol_languageTom Tromey1-27/+10
This changes quick_symbol_functions::lookup_global_symbol_language to accept domain_search_flags rather than just a domain_enum, and fixes up the fallout. To avoid introducing any regressions, any code passing VAR_DOMAIN now uses SEARCH_VFT. That is, no visible changes should result from this patch. However, it sets the stage to refine some searches later on.
2024-01-28Replace search_domain with domain_search_flagsTom Tromey1-7/+7
This patch changes gdb to replace search_domain with domain_search_flags everywhere. search_domain is removed.
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