diff options
author | Tom de Vries <tdevries@suse.de> | 2024-09-24 10:24:22 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-09-24 10:24:22 +0200 |
commit | 00105aa1c4d9933fe3cfe9bc1be0daefe9f8ca36 (patch) | |
tree | dd077abbf5a07581e38eb098133690987dc4ae4b /gdb/symfile-debug.c | |
parent | 7d5702b8fdee17a5b4597b2b03c93e97d5b4c136 (diff) | |
download | gdb-00105aa1c4d9933fe3cfe9bc1be0daefe9f8ca36.zip gdb-00105aa1c4d9933fe3cfe9bc1be0daefe9f8ca36.tar.gz gdb-00105aa1c4d9933fe3cfe9bc1be0daefe9f8ca36.tar.bz2 |
[gdb/symtab] Don't expand non-Ada CUs for info exceptions
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
Diffstat (limited to 'gdb/symfile-debug.c')
-rw-r--r-- | gdb/symfile-debug.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 0eccda2..6bf8dc3 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -376,7 +376,8 @@ objfile::expand_symtabs_matching gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher, gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify, block_search_flags search_flags, - domain_search_flags domain) + domain_search_flags domain, + gdb::function_view<expand_symtabs_lang_matcher_ftype> lang_matcher) { /* This invariant is documented in quick-functions.h. */ gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr); @@ -393,7 +394,8 @@ objfile::expand_symtabs_matching for (const auto &iter : qf) if (!iter->expand_symtabs_matching (this, file_matcher, lookup_name, symbol_matcher, expansion_notify, - search_flags, domain)) + search_flags, domain, + lang_matcher)) return false; return true; } |