This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add a SymbolFileProvider to record and replay calls to dsymForUUID
ClosedPublic

Authored by JDevlieghere on Aug 21 2020, 6:09 PM.

Details

Summary

When replaying a reproducer captured from a core file, we always use dsymForUUID for the kernel binary. When enabled, we also use it to find kexts. Since these files are already contained in the reproducer, there's no reason to call out to an external tool. If the tool returns a different result, e.g. because the dSYM got garbage collected, it will break reproducer replay. The SymbolFileProvider solves the issue by mapping UUIDs to module and symbol paths in the reproducer.

Diff Detail

Event Timeline

JDevlieghere created this revision.Aug 21 2020, 6:09 PM
JDevlieghere requested review of this revision.Aug 21 2020, 6:09 PM

I wasn't sure how to test this but Jason told me I can set LLDB_APPLE_DSYMFORUUID_EXECUTABLE.

  • Add test.
  • Implement dump method.

Unfortunately, the yaml2obj roundtrip does not preserve the UUID, so the test uses the binary.

jasonmolenda accepted this revision.Aug 24 2020, 1:43 PM

Looks good!

This revision is now accepted and ready to land.Aug 24 2020, 1:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2020, 3:09 PM

Pretty sure this broke some tests http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/23476/

Note: Google Test filter = SymbolsTest.LocateExecutableSymbolFileForUnknownExecutableAndMissingSymbolFile
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from SymbolsTest
[ RUN      ] SymbolsTest.LocateExecutableSymbolFileForUnknownExecutableAndMissingSymbolFile
Assertion failed: (hasVal), function getValue, file /Users/buildslave/jenkins/workspace/lldb-cmake@2/llvm-project/llvm/include/llvm/ADT/Optional.h, line 73.
0  SymbolTests              0x000000010943f8a5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  SymbolTests              0x000000010943e836 llvm::sys::RunSignalHandlers() + 198
2  SymbolTests              0x000000010943fe86 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff6e8b35fd _sigtramp + 29
4  libsystem_platform.dylib 0xaaaaaaaaaaaaaaaa _sigtramp + 12297688647425029322
5  libsystem_c.dylib        0x00007fff6e785808 abort + 120
6  libsystem_c.dylib        0x00007fff6e784ac6 err + 0
7  SymbolTests              0x000000010a8f0bf5 lldb_private::repro::Reproducer::Instance() + 133
8  SymbolTests              0x00000001094a7261 LocateMacOSXFilesUsingDebugSymbols(lldb_private::ModuleSpec const&, lldb_private::ModuleSpec&) + 433
9  SymbolTests              0x00000001094894dd lldb_private::Symbols::LocateExecutableSymbolFile(lldb_private::ModuleSpec const&, lldb_private::FileSpecList const&) + 5741
10 SymbolTests              0x000000010932f232 SymbolsTest_LocateExecutableSymbolFileForUnknownExecutableAndMissingSymbolFile_Test::TestBody() + 274
11 SymbolTests              0x000000010944869f testing::Test::Run() + 527
12 SymbolTests              0x0000000109449516 testing::TestInfo::Run() + 566
13 SymbolTests              0x0000000109449d47 testing::TestCase::Run() + 247
14 SymbolTests              0x0000000109452877 testing::internal::UnitTestImpl::RunAllTests() + 1287
15 SymbolTests              0x00000001094522fb testing::UnitTest::Run() + 171
16 SymbolTests              0x0000000109441209 main + 121
17 libdyld.dylib            0x00007fff6e6b6cc9 start + 1
18 libdyld.dylib            0x0000000000000002 start + 18446603338663629626

Seems like this were just some missing calls to initialize/terminate. I added them in an ugly hotfix commit.