Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "Plugins/Process/Utility/LinuxSignals.h"
#include "Utility/ARM64_DWARF_Registers.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Symbol/UnwindPlan.h"
Expand All @@ -28,6 +29,9 @@
#include "lldb/Utility/State.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Utility/XcodeSDK.h"

// Define these constants from Linux mman.h for use when targeting remote linux
// systems even when host has different values.
Expand Down Expand Up @@ -601,3 +605,21 @@ lldb::StopInfoSP PlatformLinux::GetStopInfoFromSiginfo(Thread &thread) {
thread, signo_sp->GetValueAsUnsigned(-1), siginfo_description.c_str(),
sicode_sp->GetValueAsUnsigned(0));
}

llvm::Expected<XcodeSDK>
PlatformLinux::GetSDKPathFromDebugInfo(CompileUnit &unit) {
ModuleSP module_sp = unit.CalculateSymbolContextModule();
if (!module_sp)
return llvm::createStringError("compile unit has no module");

SymbolFile *sym_file = module_sp->GetSymbolFile();
if (!sym_file)
return llvm::createStringError(
llvm::formatv("No symbol file available for module '{0}'",
module_sp->GetFileSpec().GetFilename()));

// For Linux, we don't have Xcode SDKs, but we can try to extract
// system library paths from debug info. This is particularly useful
// for Swift runtime libraries.
return sym_file->ParseXcodeSDK(unit);
}
2 changes: 2 additions & 0 deletions lldb/source/Plugins/Platform/Linux/PlatformLinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class PlatformLinux : public PlatformPOSIX {

lldb::StopInfoSP GetStopInfoFromSiginfo(Thread &thread) override;

llvm::Expected<XcodeSDK> GetSDKPathFromDebugInfo(CompileUnit &unit) override;

std::vector<ArchSpec> m_supported_architectures;

private:
Expand Down