Files
clang-p2996/lldb/test/Shell/Commands/command-statistics-dump.test
David Peixotto 1d1b20a19e [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`.
2025-03-10 10:54:11 -07:00

41 lines
1.7 KiB
Plaintext

# This test validates that statistics generation does not force loading
# symbol tables. In order to avoid other sources of symbol loading we
# create the target without loading dependents and do not actually
# run it. Running the target is a problem because there are various
# instrumentation plugins (e.g. ASAN) that are always enabled and force
# symbol loading. If you see this test start to fail we may have added
# a new source of symbol loading unexpectedly.
# Build a simple test executable.
# RUN: %clang_host -g %S/Inputs/main.c -o %t-main.exe
# When we enable symbol preload and dump stats there should be a non-zero
# time for parsing symbol tables for the main module.
# RUN: %lldb -O "settings set plugin.jit-loader.gdb.enable off" \
# RUN: -O "settings set target.preload-symbols true" \
# RUN: -o 'target create --no-dependents "%t-main.exe"' \
# RUN: -o "statistics dump" \
# RUN: -o "q" \
# RUN: | FileCheck %s -check-prefixes=CHECK,PRELOAD_TRUE
# Find the module stats for the main executable and make sure
# we are looking at the symbol parse time for that module.
# CHECK: "modules": [
# CHECK: {
# CHECK: "path": {{.*}}-main.exe
# CHECK-NOT: }
# PRELOAD_TRUE: "symbolTableParseTime":
# PRELOAD_TRUE-SAME: {{[1-9]+}}
# When we disable symbol preload and dump stats the symbol table
# for main should not be parsed and have a time of 0.
# RUN: %lldb -O "settings set plugin.jit-loader.gdb.enable off" \
# RUN: -O "settings set target.preload-symbols false" \
# RUN: -o 'target create --no-dependents "%t-main.exe"' \
# RUN: -o "statistics dump" \
# RUN: -o "q" \
# RUN: | FileCheck %s -check-prefixes=CHECK,PRELOAD_FALSE
# PRELOAD_FALSE: "symbolTableParseTime": 0,