[lldb] Avoid force loading symbol files in statistics collection (#129593)

This commit modifies the `DebuggerStats::ReportStatistics`
implementation to avoid loading symbol files for unloaded symbols. We
collect stats on debugger shutdown and without this change it can cause
the debugger to hang for a long while on shutdown if they symbols were
not previously loaded (e.g. `settings set target.preload-symbols
false`).

The implementation is done by adding an optional parameter to
`Module::GetSymtab` to control if the corresponding symbol file will be
loaded in the same way that can control it for `Module::GetSymbolFile`.
This commit is contained in:
David Peixotto
2025-03-10 10:54:11 -07:00
committed by GitHub
parent 74868cf0d1
commit 1d1b20a19e
5 changed files with 93 additions and 6 deletions

View File

@@ -1022,8 +1022,8 @@ SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) {
return m_symfile_up ? m_symfile_up->GetSymbolFile() : nullptr;
}
Symtab *Module::GetSymtab() {
if (SymbolFile *symbols = GetSymbolFile())
Symtab *Module::GetSymtab(bool can_create) {
if (SymbolFile *symbols = GetSymbolFile(can_create))
return symbols->GetSymtab();
return nullptr;
}