[lldb] Test parsing the symtab with indirect symbols from the shared cache

This patch adds a test for b0dc2fae60. That commit fixed a bug where
we could increment the indirect symbol offset every time we parsed the
symbol table.
This commit is contained in:
Jonas Devlieghere 2022-03-23 21:00:57 -07:00
parent 86c1d075bb
commit 4ad19b80ea
No known key found for this signature in database
GPG Key ID: 49CC0BD90FDEED4D
1 changed files with 18 additions and 0 deletions

View File

@ -76,4 +76,22 @@ TEST_F(ObjectFileMachOTest, ModuleFromSharedCacheInfo) {
// ... and one from the __DATA segment
check_symbol("OBJC_CLASS_$_NSObject");
}
TEST_F(ObjectFileMachOTest, IndirectSymbolsInTheSharedCache) {
SharedCacheImageInfo image_info = HostInfo::GetSharedCacheImageInfo(
"/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit");
ModuleSpec spec(FileSpec(), UUID(), image_info.data_sp);
lldb::ModuleSP module = std::make_shared<Module>(spec);
ObjectFile *OF = module->GetObjectFile();
ASSERT_TRUE(llvm::isa<ObjectFileMachO>(OF));
EXPECT_TRUE(
OF->GetArchitecture().IsCompatibleMatch(HostInfo::GetArchitecture()));
// Check that we can parse the symbol table several times over without
// crashing.
Symtab symtab(OF);
for (size_t i = 0; i < 10; i++)
OF->ParseSymtab(symtab);
}
#endif