Skip to content

Commit 841e53e

Browse files
committed
[lldb] Disable LLDBMemoryReader::resolvePointerAsSymbol on Linux
Address::CalculateSymbolContextSymbol() finds the wrong symbol on Linux when debugging swift application because symbols have an actual size (as opposed to macOS, where they have size 0). This is either an LLDB or a swift compiler bug. For now, disable this optimization on Linux.
1 parent b156756 commit 841e53e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/LLDBMemoryReader.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ LLDBMemoryReader::resolvePointerAsSymbol(swift::remote::RemoteAddress address) {
180180
if (!target.GetSwiftUseReflectionSymbols())
181181
return {};
182182

183+
auto &triple = m_process.GetTarget().GetArchitecture().GetTriple();
184+
// On Linux, there seems to be a bug where we can't reliably look for symbols by address,
185+
// since these symbols have an actual size and can overlap.
186+
// This could be an LLDB bug or a compiler bug.
187+
// rdar://166344740
188+
if (triple.isOSLinux())
189+
return {};
190+
183191
std::optional<Address> maybeAddr = remoteAddressToLLDBAddress(address);
184192
// This is not an assert, but should never happen.
185193
if (!maybeAddr)

0 commit comments

Comments
 (0)