mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
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)
This commit is contained in:
parent
309d28d1e4
commit
667ed4b14d
@ -3733,6 +3733,8 @@ create_std_terminate_master_breakpoint (void)
|
||||
const char *const func_name = "std::terminate()";
|
||||
|
||||
scoped_restore_current_program_space restore_pspace;
|
||||
scoped_restore_current_language save_language;
|
||||
set_language (language_cplus);
|
||||
|
||||
for (struct program_space *pspace : program_spaces)
|
||||
{
|
||||
@ -3845,7 +3847,7 @@ create_exception_master_breakpoint_hook (objfile *objfile)
|
||||
{
|
||||
struct bound_minimal_symbol debug_hook;
|
||||
|
||||
debug_hook = lookup_minimal_symbol (func_name, NULL, objfile);
|
||||
debug_hook = lookup_minimal_symbol_text (func_name, objfile);
|
||||
if (debug_hook.minsym == NULL)
|
||||
{
|
||||
bp_objfile_data->exception_msym.minsym = &msym_not_found;
|
||||
|
@ -880,7 +880,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
|
||||
/* Lookup the registration symbol. If it is missing, then we
|
||||
assume we are not attached to a JIT. */
|
||||
bound_minimal_symbol reg_symbol
|
||||
= lookup_minimal_symbol (jit_break_name, nullptr, the_objfile);
|
||||
= lookup_minimal_symbol_text (jit_break_name, the_objfile);
|
||||
if (reg_symbol.minsym == NULL
|
||||
|| reg_symbol.value_address () == 0)
|
||||
{
|
||||
@ -890,7 +890,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
|
||||
}
|
||||
|
||||
bound_minimal_symbol desc_symbol
|
||||
= lookup_minimal_symbol (jit_descriptor_name, NULL, the_objfile);
|
||||
= lookup_minimal_symbol_linkage (jit_descriptor_name, the_objfile);
|
||||
if (desc_symbol.minsym == NULL
|
||||
|| desc_symbol.value_address () == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user