diff options
author | Tom Tromey <tom@tromey.com> | 2023-10-21 16:38:44 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-01-08 18:40:22 -0700 |
commit | 667ed4b14ddaa9af196481f1757c0e517e80b6ed (patch) | |
tree | 8717a3e4b2380ce83e1f8532a3ce0b1811a10560 /gdb/unittests | |
parent | 309d28d1e49d610f925b286c119be6e2ed2ca81b (diff) | |
download | gdb-667ed4b14ddaa9af196481f1757c0e517e80b6ed.zip gdb-667ed4b14ddaa9af196481f1757c0e517e80b6ed.tar.gz gdb-667ed4b14ddaa9af196481f1757c0e517e80b6ed.tar.bz2 |
Avoid language-based lookups in startup path
The previous patches are nearly enough to enable background DWARF
reading. However, this hack in language_defn::get_symbol_name_matcher
causes an early computation of current_language:
/* If currently in Ada mode, and the lookup name is wrapped in
'<...>', hijack all symbol name comparisons using the Ada
matcher, which handles the verbatim matching. */
if (current_language->la_language == language_ada
&& lookup_name.ada ().verbatim_p ())
return current_language->get_symbol_name_matcher_inner (lookup_name);
I considered various options here -- reversing the order of the
checks, or promoting the verbatim mode to not be a purely Ada feature
-- but in the end found that the few calls to this during startup
could be handled more directly.
In the JIT code, and in create_exception_master_breakpoint_hook, gdb
is really looking for a certain kind of symbol (text or data) using a
linkage name. Changing the lookup here is clearer and probably more
efficient as well.
In create_std_terminate_master_breakpoint, the lookup can't really be
done by linkage name (it would require relying on a certain mangling
scheme, and also may trip over versioned symbols) -- but we know that
this spot is C++-specific, and so the language ought to be temporarily
set to C++ here.
After this patch, the "file" case is much faster:
(gdb) file /tmp/gdb
2023-10-23 13:16:54.456 - command started
Reading symbols from /tmp/gdb...
2023-10-23 13:16:54.520 - command finished
Command execution time: 0.225906 (cpu), 0.064313 (wall)
Diffstat (limited to 'gdb/unittests')
0 files changed, 0 insertions, 0 deletions