[Lldb-commits] [lldb] [lldb] Avoid force loading symbols in statistics collection (PR #136236)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 18 14:10:23 PDT 2025
================
@@ -749,10 +749,20 @@ TEST_F(SymtabTest, TestSymtabCreatedOnDemand) {
ASSERT_THAT_EXPECTED(ExpectedFile, llvm::Succeeded());
auto module_sp = std::make_shared<Module>(ExpectedFile->moduleSpec());
- // The symbol table should not be loaded by default.
+ // The symbol file should not be created by default.
Symtab *module_symtab = module_sp->GetSymtab(/*can_create=*/false);
ASSERT_EQ(module_symtab, nullptr);
+ // Even if the symbol file is created, the symbol table should not be created by default.
+
+ // TODO:
+ // I need to create a symbol file here, but without causing it to parse the symbol table.
+ // See next line as a failed attempt.
+
+ // module_sp->GetSymbolFile(/*can_create=*/true); // Cannot do this because it will parse the symbol table.
----------------
royitaqi wrote:
> So is the problem that you don't know how to create a SymbolFile that doesn't have its SymbolTable loaded?
Correct.
> Can you debug this example to see how that SymbolFile was created?
The same thing doesn't reproduce on Linux. I suppose this is due to how dynamic loaders of Linux and macOS work differently (e.g. on macOS I immediately see a.out + system libraries after target create; while on Linux I only see a.out).
My hope is that the finding can be translated into a unit test which need to work on Linux.
https://github.com/llvm/llvm-project/pull/136236
More information about the lldb-commits
mailing list