Skip to content
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -1208,35 +1208,44 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp,

bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) {
Log *log = GetLog(LLDBLog::DynamicLoader);
bool use_new_spi_interface = false;
bool use_new_spi_interface = true;

llvm::VersionTuple version = process->GetHostOSVersion();
if (!version.empty()) {
const llvm::Triple::OSType os_type =
process->GetTarget().GetArchitecture().GetTriple().getOS();

// macOS 10.12 and newer
if (os_type == llvm::Triple::MacOSX &&
version >= llvm::VersionTuple(10, 12))
use_new_spi_interface = true;
// Older than macOS 10.12
if (os_type == llvm::Triple::MacOSX && version < llvm::VersionTuple(10, 12))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems ripe for a helper or lambda that takes a triple and an unsigned version :-)

use_new_spi_interface = false;

// iOS 10 and newer
if (os_type == llvm::Triple::IOS && version >= llvm::VersionTuple(10))
use_new_spi_interface = true;
// Older than iOS 10
if (os_type == llvm::Triple::IOS && version < llvm::VersionTuple(10))
use_new_spi_interface = false;

// tvOS 10 and newer
if (os_type == llvm::Triple::TvOS && version >= llvm::VersionTuple(10))
use_new_spi_interface = true;
// Older than tvOS 10
if (os_type == llvm::Triple::TvOS && version < llvm::VersionTuple(10))
use_new_spi_interface = false;

// watchOS 3 and newer
if (os_type == llvm::Triple::WatchOS && version >= llvm::VersionTuple(3))
use_new_spi_interface = true;
// Older than watchOS 3
if (os_type == llvm::Triple::WatchOS && version < llvm::VersionTuple(3))
use_new_spi_interface = false;

// NEED_BRIDGEOS_TRIPLE // Any BridgeOS
// NEED_BRIDGEOS_TRIPLE if (os_type == llvm::Triple::BridgeOS)
// NEED_BRIDGEOS_TRIPLE use_new_spi_interface = true;
// llvm::Triple::BridgeOS and llvm::Triple::XROS always use the new
// libdyld SPI interface.
} else {
// We could not get an OS version string, we are likely not
// connected to debugserver and the packets to call the libdyld SPI
// will not exist.
use_new_spi_interface = false;
}

// Corefiles cannot use the dyld SPI to get the inferior's
// binaries, we must find it through metadata or a scan
// of the corefile memory.
if (!process->IsLiveDebugSession())
use_new_spi_interface = false;

if (log) {
if (use_new_spi_interface)
LLDB_LOGF(
Expand Down