[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 09:45:21 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:
> Or do you mean that you are having trouble writing the test because the two are linked. In which case you could add a separate test function if that helps separate out the two.
It's this one. I'm basically trying to set up a test which mimics the situation of [this line of code](https://github.com/llvm/llvm-project/blob/711301066c2e5a6842866baea50ea9346b837459/lldb/source/Core/Module.cpp#L1000): i.e. There is a SymbolFile, and its symbol table have not been created (this can happen; I will add a stacktrace to the PR description), and verify that calling `SymbolFile::GetSymtab(/*can_create=*/false)` will not create the symbol table.
https://github.com/llvm/llvm-project/pull/136236
More information about the lldb-commits
mailing list