[Lldb-commits] [lldb] dde487e - [lldb] Plumb process host architecture through platform selection
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 14 12:17:07 PDT 2022
Author: Jonas Devlieghere
Date: 2022-03-14T12:17:01-07:00
New Revision: dde487e54782feb873461e7f8781a098df4f69b0
URL: https://github.com/llvm/llvm-project/commit/dde487e54782feb873461e7f8781a098df4f69b0
DIFF: https://github.com/llvm/llvm-project/commit/dde487e54782feb873461e7f8781a098df4f69b0.diff
LOG: [lldb] Plumb process host architecture through platform selection
To allow us to select a different platform based on where the process is
running, plumb the process host architecture through platform selection.
This patch is in preparation for D121444 which needs this functionality
to tell apart iOS binaries running on Apple Silicon vs on a remote iOS
device.
Differential revision: https://reviews.llvm.org/D121484
Added:
Modified:
lldb/include/lldb/Target/Platform.h
lldb/source/Interpreter/OptionGroupPlatform.cpp
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
lldb/source/Plugins/Platform/Windows/PlatformWindows.h
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
lldb/source/Target/Platform.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/RemoteAwarePlatform.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/TargetList.cpp
lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
lldb/unittests/Target/RemoteAwarePlatformTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index b3855f0bb5071..9136989fea0bb 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -95,7 +95,9 @@ class Platform : public PluginInterface {
static lldb::PlatformSP GetHostPlatform();
static lldb::PlatformSP
- GetPlatformForArchitecture(const ArchSpec &arch, ArchSpec *platform_arch_ptr);
+ GetPlatformForArchitecture(const ArchSpec &arch,
+ const ArchSpec &process_host_arch = {},
+ ArchSpec *platform_arch_ptr = nullptr);
static const char *GetHostPlatformName();
@@ -107,6 +109,7 @@ class Platform : public PluginInterface {
static lldb::PlatformSP Create(ConstString name, Status &error);
static lldb::PlatformSP Create(const ArchSpec &arch,
+ const ArchSpec &process_host_arch,
ArchSpec *platform_arch_ptr, Status &error);
/// Augments the triple either with information from platform or the host
@@ -310,7 +313,8 @@ class Platform : public PluginInterface {
/// Get the platform's supported architectures in the order in which they
/// should be searched.
- virtual std::vector<ArchSpec> GetSupportedArchitectures() = 0;
+ virtual std::vector<ArchSpec>
+ GetSupportedArchitectures(const ArchSpec &process_host_arch) = 0;
virtual size_t GetSoftwareBreakpointTrapOpcode(Target &target,
BreakpointSite *bp_site);
@@ -332,6 +336,7 @@ class Platform : public PluginInterface {
/// Lets a platform answer if it is compatible with a given architecture and
/// the target triple contained within.
virtual bool IsCompatibleArchitecture(const ArchSpec &arch,
+ const ArchSpec &process_host_arch,
bool exact_arch_match,
ArchSpec *compatible_arch_ptr);
diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp
index c30293a6db36f..9550edc2613e6 100644
--- a/lldb/source/Interpreter/OptionGroupPlatform.cpp
+++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp
@@ -23,8 +23,8 @@ PlatformSP OptionGroupPlatform::CreatePlatformWithOptions(
if (!m_platform_name.empty()) {
platform_sp = Platform::Create(ConstString(m_platform_name.c_str()), error);
if (platform_sp) {
- if (platform_arch.IsValid() &&
- !platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) {
+ if (platform_arch.IsValid() && !platform_sp->IsCompatibleArchitecture(
+ arch, {}, false, &platform_arch)) {
error.SetErrorStringWithFormatv("platform '{0}' doesn't support '{1}'",
platform_sp->GetPluginName(),
arch.GetTriple().getTriple());
@@ -33,7 +33,7 @@ PlatformSP OptionGroupPlatform::CreatePlatformWithOptions(
}
}
} else if (arch.IsValid()) {
- platform_sp = Platform::Create(arch, &platform_arch, error);
+ platform_sp = Platform::Create(arch, {}, &platform_arch, error);
}
if (platform_sp) {
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
index f5f4bcc7b6574..17c86a435aa8d 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -129,9 +129,10 @@ PlatformFreeBSD::PlatformFreeBSD(bool is_host)
}
}
-std::vector<ArchSpec> PlatformFreeBSD::GetSupportedArchitectures() {
+std::vector<ArchSpec>
+PlatformFreeBSD::GetSupportedArchitectures(const ArchSpec &process_host_arch) {
if (m_remote_platform_sp)
- return m_remote_platform_sp->GetSupportedArchitectures();
+ return m_remote_platform_sp->GetSupportedArchitectures(process_host_arch);
return m_supported_architectures;
}
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
index 7f9dfd87a59a0..4aeedb62931df 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -43,7 +43,8 @@ class PlatformFreeBSD : public PlatformPOSIX {
void GetStatus(Stream &strm) override;
- std::vector<ArchSpec> GetSupportedArchitectures() override;
+ std::vector<ArchSpec>
+ GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
bool CanDebugProcess() override;
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index a46f580d13502..9fdfe4c0dc140 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -128,9 +128,10 @@ PlatformLinux::PlatformLinux(bool is_host)
}
}
-std::vector<ArchSpec> PlatformLinux::GetSupportedArchitectures() {
+std::vector<ArchSpec>
+PlatformLinux::GetSupportedArchitectures(const ArchSpec &process_host_arch) {
if (m_remote_platform_sp)
- return m_remote_platform_sp->GetSupportedArchitectures();
+ return m_remote_platform_sp->GetSupportedArchitectures(process_host_arch);
return m_supported_architectures;
}
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
index 87d0926e3a8ed..26b53dbebd26b 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -43,7 +43,8 @@ class PlatformLinux : public PlatformPOSIX {
void GetStatus(Stream &strm) override;
- std::vector<ArchSpec> GetSupportedArchitectures() override;
+ std::vector<ArchSpec>
+ GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
index aa5b2d05d9913..4659ad6d6e13b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -266,7 +266,8 @@ CoreSimulatorSupport::Device PlatformAppleSimulator::GetSimulatorDevice() {
}
#endif
-std::vector<ArchSpec> PlatformAppleSimulator::GetSupportedArchitectures() {
+std::vector<ArchSpec> PlatformAppleSimulator::GetSupportedArchitectures(
+ const ArchSpec &process_host_arch) {
std::vector<ArchSpec> result(m_supported_triples.size());
llvm::transform(m_supported_triples, result.begin(),
[](llvm::StringRef triple) { return ArchSpec(triple); });
@@ -382,7 +383,7 @@ Status PlatformAppleSimulator::ResolveExecutable(
StreamString arch_names;
llvm::ListSeparator LS;
ArchSpec platform_arch;
- for (const ArchSpec &arch : GetSupportedArchitectures()) {
+ for (const ArchSpec &arch : GetSupportedArchitectures({})) {
resolved_module_spec.GetArchitecture() = arch;
// Only match x86 with x86 and x86_64 with x86_64...
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
index e87636d9999cc..39ef789ffc1d7 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
@@ -65,7 +65,8 @@ class PlatformAppleSimulator : public PlatformDarwin {
lldb_private::Target &target,
lldb_private::Status &error) override;
- std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
+ std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
+ const lldb_private::ArchSpec &process_host_arch) override;
lldb_private::Status ResolveExecutable(
const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 497ac39dcd81c..180ac3ea7f1b2 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -909,7 +909,8 @@ Status PlatformDarwinKernel::ExamineKextForMatchingUUID(
return {};
}
-std::vector<ArchSpec> PlatformDarwinKernel::GetSupportedArchitectures() {
+std::vector<ArchSpec> PlatformDarwinKernel::GetSupportedArchitectures(
+ const ArchSpec &process_host_arch) {
std::vector<ArchSpec> result;
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
ARMGetSupportedArchitectures(result);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
index 738594bda1403..1a9c7e574dbbc 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
@@ -56,7 +56,8 @@ class PlatformDarwinKernel : public PlatformDarwin {
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
bool *did_create_ptr) override;
- std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
+ std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
+ const lldb_private::ArchSpec &process_host_arch) override;
bool SupportsModules() override { return false; }
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 17bfb52e6a041..572f3cb0deccf 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -133,7 +133,8 @@ ConstString PlatformMacOSX::GetSDKDirectory(lldb_private::Target &target) {
return {};
}
-std::vector<ArchSpec> PlatformMacOSX::GetSupportedArchitectures() {
+std::vector<ArchSpec>
+PlatformMacOSX::GetSupportedArchitectures(const ArchSpec &process_host_arch) {
std::vector<ArchSpec> result;
#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
// macOS for ARM64 support both native and translated x86_64 processes
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
index 113214befa92d..36b57f755dc97 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
@@ -47,7 +47,8 @@ class PlatformMacOSX : public PlatformDarwin {
return PlatformDarwin::GetFile(source, destination);
}
- std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
+ std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
+ const lldb_private::ArchSpec &process_host_arch) override;
lldb_private::ConstString
GetSDKDirectory(lldb_private::Target &target) override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
index edfb9e6e20d32..5515d76a1c99d 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
@@ -138,7 +138,8 @@ llvm::StringRef PlatformRemoteAppleBridge::GetDescriptionStatic() {
return "Remote BridgeOS platform plug-in.";
}
-std::vector<ArchSpec> PlatformRemoteAppleBridge::GetSupportedArchitectures() {
+std::vector<ArchSpec> PlatformRemoteAppleBridge::GetSupportedArchitectures(
+ const ArchSpec &process_host_arch) {
return {ArchSpec("arm64-apple-bridgeos")};
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
index 0d11df01d6332..b3a2b9b62ad4e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
@@ -40,7 +40,8 @@ class PlatformRemoteAppleBridge : public PlatformRemoteDarwinDevice {
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
- std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
+ std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
+ const lldb_private::ArchSpec &process_host_arch) override;
protected:
llvm::StringRef GetDeviceSupportDirectoryName() override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index 04a234d3c5257..5b729690eda13 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -133,7 +133,8 @@ llvm::StringRef PlatformRemoteAppleTV::GetDescriptionStatic() {
return "Remote Apple TV platform plug-in.";
}
-std::vector<ArchSpec> PlatformRemoteAppleTV::GetSupportedArchitectures() {
+std::vector<ArchSpec> PlatformRemoteAppleTV::GetSupportedArchitectures(
+ const ArchSpec &process_host_arch) {
ArchSpec system_arch(GetSystemArchitecture());
const ArchSpec::Core system_core = system_arch.GetCore();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
index f6dbc7cac7932..b102bb79cc91e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
@@ -40,7 +40,8 @@ class PlatformRemoteAppleTV : public PlatformRemoteDarwinDevice {
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
- std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
+ std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
+ const lldb_private::ArchSpec &process_host_arch) override;
protected:
llvm::StringRef GetDeviceSupportDirectoryName() override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
index abf9861ac2482..7dc8b9b4c9de3 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
@@ -144,7 +144,8 @@ llvm::StringRef PlatformRemoteAppleWatch::GetDescriptionStatic() {
PlatformRemoteAppleWatch::PlatformRemoteAppleWatch()
: PlatformRemoteDarwinDevice() {}
-std::vector<ArchSpec> PlatformRemoteAppleWatch::GetSupportedArchitectures() {
+std::vector<ArchSpec>
+PlatformRemoteAppleWatch::GetSupportedArchitectures(const ArchSpec &host_info) {
ArchSpec system_arch(GetSystemArchitecture());
const ArchSpec::Core system_core = system_arch.GetCore();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
index 07d1cff081ddc..75b7dc458ba7b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
@@ -43,7 +43,8 @@ class PlatformRemoteAppleWatch : public PlatformRemoteDarwinDevice {
// lldb_private::Platform functions
- std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
+ std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
+ const lldb_private::ArchSpec &process_host_arch) override;
protected:
llvm::StringRef GetDeviceSupportDirectoryName() override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
index 6fc0dd330e0b0..be03cdbd5666d 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
@@ -92,7 +92,8 @@ Status PlatformRemoteDarwinDevice::ResolveExecutable(
// the correct order) and see if we can find a match that way
StreamString arch_names;
llvm::ListSeparator LS;
- for (const ArchSpec &arch : GetSupportedArchitectures()) {
+ ArchSpec process_host_arch;
+ for (const ArchSpec &arch : GetSupportedArchitectures(process_host_arch)) {
resolved_module_spec.GetArchitecture() = arch;
error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
nullptr, nullptr, nullptr);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
index 7a265c98f3d9c..99643791ad328 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
@@ -125,7 +125,8 @@ PlatformSP PlatformRemoteMacOSX::CreateInstance(bool force,
return PlatformSP();
}
-std::vector<ArchSpec> PlatformRemoteMacOSX::GetSupportedArchitectures() {
+std::vector<ArchSpec>
+PlatformRemoteMacOSX::GetSupportedArchitectures(const ArchSpec &host_info) {
// macOS for ARM64 support both native and translated x86_64 processes
std::vector<ArchSpec> result;
ARMGetSupportedArchitectures(result, llvm::Triple::MacOSX);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
index 8d08a51b31b8e..67162b34c271b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
@@ -42,7 +42,8 @@ class PlatformRemoteMacOSX : public virtual PlatformRemoteDarwinDevice {
const lldb_private::UUID *uuid_ptr,
lldb_private::FileSpec &local_file) override;
- std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
+ std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
+ const lldb_private::ArchSpec &process_host_arch) override;
protected:
llvm::StringRef GetDeviceSupportDirectoryName() override;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index 81665cc21b817..d6f573bbe2754 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -134,7 +134,8 @@ llvm::StringRef PlatformRemoteiOS::GetDescriptionStatic() {
PlatformRemoteiOS::PlatformRemoteiOS()
: PlatformRemoteDarwinDevice() {}
-std::vector<ArchSpec> PlatformRemoteiOS::GetSupportedArchitectures() {
+std::vector<ArchSpec> PlatformRemoteiOS::GetSupportedArchitectures(
+ const ArchSpec &process_host_arch) {
std::vector<ArchSpec> result;
ARMGetSupportedArchitectures(result, llvm::Triple::IOS);
return result;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
index 0fe5a274a3d4a..99409d80b3a0f 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
@@ -39,7 +39,8 @@ class PlatformRemoteiOS : public PlatformRemoteDarwinDevice {
// lldb_private::PluginInterface functions
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
- std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
+ std::vector<lldb_private::ArchSpec> GetSupportedArchitectures(
+ const lldb_private::ArchSpec &process_host_arch) override;
protected:
bool CheckLocalSharedCache() const override;
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
index ee643dd946658..d79fe664cb1c6 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
@@ -115,9 +115,10 @@ PlatformNetBSD::PlatformNetBSD(bool is_host)
}
}
-std::vector<ArchSpec> PlatformNetBSD::GetSupportedArchitectures() {
+std::vector<ArchSpec>
+PlatformNetBSD::GetSupportedArchitectures(const ArchSpec &process_host_arch) {
if (m_remote_platform_sp)
- return m_remote_platform_sp->GetSupportedArchitectures();
+ return m_remote_platform_sp->GetSupportedArchitectures(process_host_arch);
return m_supported_architectures;
}
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
index 433cf66531262..2613311790a34 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
@@ -43,7 +43,8 @@ class PlatformNetBSD : public PlatformPOSIX {
void GetStatus(Stream &strm) override;
- std::vector<ArchSpec> GetSupportedArchitectures() override;
+ std::vector<ArchSpec>
+ GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
uint32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override;
diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
index 2bf8469a3de2d..3946092276fd4 100644
--- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
+++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
@@ -118,9 +118,10 @@ PlatformOpenBSD::PlatformOpenBSD(bool is_host)
}
}
-std::vector<ArchSpec> PlatformOpenBSD::GetSupportedArchitectures() {
+std::vector<ArchSpec>
+PlatformOpenBSD::GetSupportedArchitectures(const ArchSpec &process_host_arch) {
if (m_remote_platform_sp)
- return m_remote_platform_sp->GetSupportedArchitectures();
+ return m_remote_platform_sp->GetSupportedArchitectures(process_host_arch);
return m_supported_architectures;
}
diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
index fd03988590cad..fcdc03576711a 100644
--- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
+++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
@@ -42,7 +42,8 @@ class PlatformOpenBSD : public PlatformPOSIX {
void GetStatus(Stream &strm) override;
- std::vector<ArchSpec> GetSupportedArchitectures() override;
+ std::vector<ArchSpec>
+ GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
bool CanDebugProcess() override;
diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 48d135a058379..7ee92ef76c9c7 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -106,7 +106,8 @@ PlatformSP PlatformQemuUser::CreateInstance(bool force, const ArchSpec *arch) {
return nullptr;
}
-std::vector<ArchSpec> PlatformQemuUser::GetSupportedArchitectures() {
+std::vector<ArchSpec>
+PlatformQemuUser::GetSupportedArchitectures(const ArchSpec &process_host_arch) {
llvm::Triple triple = HostInfo::GetArchitecture().GetTriple();
triple.setEnvironment(llvm::Triple::UnknownEnvironment);
triple.setArchName(GetGlobalProperties().GetArchitecture());
diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
index c5439e126db11..509b2558c8f90 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
@@ -29,7 +29,8 @@ class PlatformQemuUser : public Platform {
return HostInfo::GetUserIDResolver();
}
- std::vector<ArchSpec> GetSupportedArchitectures() override;
+ std::vector<ArchSpec>
+ GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info,
Debugger &debugger, Target &target,
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
index 34f90843249a5..771133f341e90 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
@@ -63,7 +63,8 @@ class PlatformWindows : public RemoteAwarePlatform {
lldb_private::Target *target,
lldb_private::Status &error) override;
- std::vector<ArchSpec> GetSupportedArchitectures() override {
+ std::vector<ArchSpec>
+ GetSupportedArchitectures(const ArchSpec &process_host_arch) override {
return m_supported_architectures;
}
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index 263516f520d53..3caf531edaa89 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -65,7 +65,8 @@ class PlatformRemoteGDBServer : public Platform, private UserIDResolver {
// target, else use existing one
Status &error) override;
- std::vector<ArchSpec> GetSupportedArchitectures() override {
+ std::vector<ArchSpec>
+ GetSupportedArchitectures(const ArchSpec &process_host_arch) override {
return m_supported_architectures;
}
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 4440a44bd40f0..2c3bdf3a6bbb1 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -314,8 +314,9 @@ PlatformSP Platform::Create(ConstString name, Status &error) {
return platform_sp;
}
-PlatformSP Platform::Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr,
- Status &error) {
+PlatformSP Platform::Create(const ArchSpec &arch,
+ const ArchSpec &process_host_arch,
+ ArchSpec *platform_arch_ptr, Status &error) {
lldb::PlatformSP platform_sp;
if (arch.IsValid()) {
// Scope for locker
@@ -323,15 +324,15 @@ PlatformSP Platform::Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr,
// First try exact arch matches across all platforms already created
std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
for (const auto &platform_sp : GetPlatformList()) {
- if (platform_sp->IsCompatibleArchitecture(arch, true,
+ if (platform_sp->IsCompatibleArchitecture(arch, process_host_arch, true,
platform_arch_ptr))
return platform_sp;
}
// Next try compatible arch matches across all platforms already created
for (const auto &platform_sp : GetPlatformList()) {
- if (platform_sp->IsCompatibleArchitecture(arch, false,
- platform_arch_ptr))
+ if (platform_sp->IsCompatibleArchitecture(arch, process_host_arch,
+ false, platform_arch_ptr))
return platform_sp;
}
}
@@ -345,7 +346,7 @@ PlatformSP Platform::Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr,
if (create_callback) {
platform_sp = create_callback(false, &arch);
if (platform_sp &&
- platform_sp->IsCompatibleArchitecture(arch, true,
+ platform_sp->IsCompatibleArchitecture(arch, process_host_arch, true,
platform_arch_ptr)) {
std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
GetPlatformList().push_back(platform_sp);
@@ -360,8 +361,8 @@ PlatformSP Platform::Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr,
if (create_callback) {
platform_sp = create_callback(false, &arch);
if (platform_sp &&
- platform_sp->IsCompatibleArchitecture(arch, false,
- platform_arch_ptr)) {
+ platform_sp->IsCompatibleArchitecture(arch, process_host_arch,
+ false, platform_arch_ptr)) {
std::lock_guard<std::recursive_mutex> guard(GetPlatformListMutex());
GetPlatformList().push_back(platform_sp);
return platform_sp;
@@ -845,7 +846,9 @@ Platform::ResolveExecutable(const ModuleSpec &module_spec,
// architectures that we should be using (in the correct order) and see
// if we can find a match that way
ModuleSpec arch_module_spec(module_spec);
- for (const ArchSpec &arch : GetSupportedArchitectures()) {
+ ArchSpec process_host_arch;
+ for (const ArchSpec &arch :
+ GetSupportedArchitectures(process_host_arch)) {
arch_module_spec.GetArchitecture() = arch;
error = ModuleList::GetSharedModule(arch_module_spec, exe_module_sp,
module_search_paths_ptr, nullptr,
@@ -892,7 +895,8 @@ Platform::ResolveRemoteExecutable(const ModuleSpec &module_spec,
// correct order) and see if we can find a match that way
StreamString arch_names;
llvm::ListSeparator LS;
- for (const ArchSpec &arch : GetSupportedArchitectures()) {
+ ArchSpec process_host_arch;
+ for (const ArchSpec &arch : GetSupportedArchitectures(process_host_arch)) {
resolved_module_spec.GetArchitecture() = arch;
error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
module_search_paths_ptr, nullptr,
@@ -990,7 +994,7 @@ ArchSpec Platform::GetAugmentedArchSpec(llvm::StringRef triple) {
ArchSpec compatible_arch;
ArchSpec raw_arch(triple);
- if (!IsCompatibleArchitecture(raw_arch, false, &compatible_arch))
+ if (!IsCompatibleArchitecture(raw_arch, {}, false, &compatible_arch))
return raw_arch;
if (!compatible_arch.IsValid())
@@ -1202,11 +1206,13 @@ lldb::ProcessSP Platform::DebugProcess(ProcessLaunchInfo &launch_info,
lldb::PlatformSP
Platform::GetPlatformForArchitecture(const ArchSpec &arch,
+ const ArchSpec &process_host_arch,
ArchSpec *platform_arch_ptr) {
lldb::PlatformSP platform_sp;
Status error;
if (arch.IsValid())
- platform_sp = Platform::Create(arch, platform_arch_ptr, error);
+ platform_sp =
+ Platform::Create(arch, process_host_arch, platform_arch_ptr, error);
return platform_sp;
}
@@ -1226,6 +1232,7 @@ Platform::CreateArchList(llvm::ArrayRef<llvm::Triple::ArchType> archs,
/// Lets a platform answer if it is compatible with a given
/// architecture and the target triple contained within.
bool Platform::IsCompatibleArchitecture(const ArchSpec &arch,
+ const ArchSpec &process_host_arch,
bool exact_arch_match,
ArchSpec *compatible_arch_ptr) {
// If the architecture is invalid, we must answer true...
@@ -1233,7 +1240,8 @@ bool Platform::IsCompatibleArchitecture(const ArchSpec &arch,
ArchSpec platform_arch;
auto match = exact_arch_match ? &ArchSpec::IsExactMatch
: &ArchSpec::IsCompatibleMatch;
- for (const ArchSpec &platform_arch : GetSupportedArchitectures()) {
+ for (const ArchSpec &platform_arch :
+ GetSupportedArchitectures(process_host_arch)) {
if ((arch.*match)(platform_arch)) {
if (compatible_arch_ptr)
*compatible_arch_ptr = platform_arch;
@@ -1571,8 +1579,10 @@ Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec,
bool *did_create_ptr) {
// Get module information from a target.
ModuleSpec resolved_module_spec;
+ ArchSpec process_host_arch;
bool got_module_spec = false;
if (process) {
+ process_host_arch = process->GetSystemArchitecture();
// Try to get module information from the process
if (process->GetModuleSpec(module_spec.GetFileSpec(),
module_spec.GetArchitecture(),
@@ -1590,7 +1600,7 @@ Status Platform::GetRemoteSharedModule(const ModuleSpec &module_spec,
// architectures that we should be using (in the correct order) and see if
// we can find a match that way
ModuleSpec arch_module_spec(module_spec);
- for (const ArchSpec &arch : GetSupportedArchitectures()) {
+ for (const ArchSpec &arch : GetSupportedArchitectures(process_host_arch)) {
arch_module_spec.GetArchitecture() = arch;
error = ModuleList::GetSharedModule(arch_module_spec, module_sp, nullptr,
nullptr, nullptr);
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 3cfda7129e624..4718f83394b6c 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2885,13 +2885,15 @@ void Process::CompleteAttach() {
// switch architectures.
PlatformSP platform_sp(GetTarget().GetPlatform());
assert(platform_sp);
+ ArchSpec process_host_arch = GetSystemArchitecture();
if (platform_sp) {
const ArchSpec &target_arch = GetTarget().GetArchitecture();
if (target_arch.IsValid() &&
- !platform_sp->IsCompatibleArchitecture(target_arch, false, nullptr)) {
+ !platform_sp->IsCompatibleArchitecture(target_arch, process_host_arch,
+ false, nullptr)) {
ArchSpec platform_arch;
- platform_sp =
- platform_sp->GetPlatformForArchitecture(target_arch, &platform_arch);
+ platform_sp = platform_sp->GetPlatformForArchitecture(
+ target_arch, process_host_arch, &platform_arch);
if (platform_sp) {
GetTarget().SetPlatform(platform_sp);
GetTarget().SetArchitecture(platform_arch);
diff --git a/lldb/source/Target/RemoteAwarePlatform.cpp b/lldb/source/Target/RemoteAwarePlatform.cpp
index b92d4d5fcaa70..f342a76deedd3 100644
--- a/lldb/source/Target/RemoteAwarePlatform.cpp
+++ b/lldb/source/Target/RemoteAwarePlatform.cpp
@@ -132,7 +132,9 @@ Status RemoteAwarePlatform::ResolveExecutable(
// if we can find a match that way
StreamString arch_names;
llvm::ListSeparator LS;
- for (const ArchSpec &arch : GetSupportedArchitectures()) {
+ ArchSpec process_host_arch;
+ for (const ArchSpec &arch :
+ GetSupportedArchitectures(process_host_arch)) {
resolved_module_spec.GetArchitecture() = arch;
error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
module_search_paths_ptr, nullptr, nullptr);
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 31e6cdbe39b81..a164be7fb4929 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1470,10 +1470,10 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform) {
if (other.IsValid()) {
auto platform_sp = GetPlatform();
if (!platform_sp ||
- !platform_sp->IsCompatibleArchitecture(other, false, nullptr)) {
+ !platform_sp->IsCompatibleArchitecture(other, {}, false, nullptr)) {
ArchSpec platform_arch;
auto arch_platform_sp =
- Platform::GetPlatformForArchitecture(other, &platform_arch);
+ Platform::GetPlatformForArchitecture(other, {}, &platform_arch);
if (arch_platform_sp) {
SetPlatform(arch_platform_sp);
if (platform_arch.IsValid())
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 7badb0cdcead5..7481231197016 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -180,7 +180,7 @@ Status TargetList::CreateTargetInternal(
// the selected platform otherwise.
if (platform_sp) {
if (platform_sp->IsCompatibleArchitecture(
- module_spec.GetArchitecture(), false, nullptr)) {
+ module_spec.GetArchitecture(), {}, false, nullptr)) {
platforms.push_back(platform_sp);
continue;
}
@@ -192,7 +192,7 @@ Status TargetList::CreateTargetInternal(
(!platform_sp ||
host_platform_sp->GetName() != platform_sp->GetName())) {
if (host_platform_sp->IsCompatibleArchitecture(
- module_spec.GetArchitecture(), false, nullptr)) {
+ module_spec.GetArchitecture(), {}, false, nullptr)) {
platforms.push_back(host_platform_sp);
continue;
}
@@ -202,7 +202,7 @@ Status TargetList::CreateTargetInternal(
// executable file.
PlatformSP fallback_platform_sp(
Platform::GetPlatformForArchitecture(
- module_spec.GetArchitecture(), nullptr));
+ module_spec.GetArchitecture()));
if (fallback_platform_sp) {
platforms.push_back(fallback_platform_sp);
}
@@ -257,8 +257,9 @@ Status TargetList::CreateTargetInternal(
// If we have a valid architecture, make sure the current platform is
// compatible with that architecture.
if (!prefer_platform_arch && arch.IsValid()) {
- if (!platform_sp->IsCompatibleArchitecture(arch, false, nullptr)) {
- platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
+ if (!platform_sp->IsCompatibleArchitecture(arch, {}, false, nullptr)) {
+ platform_sp =
+ Platform::GetPlatformForArchitecture(arch, {}, &platform_arch);
if (platform_sp)
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
}
@@ -266,8 +267,9 @@ Status TargetList::CreateTargetInternal(
// If "arch" isn't valid, yet "platform_arch" is, it means we have an
// executable file with a single architecture which should be used.
ArchSpec fixed_platform_arch;
- if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, nullptr)) {
- platform_sp = Platform::GetPlatformForArchitecture(platform_arch,
+ if (!platform_sp->IsCompatibleArchitecture(platform_arch, {}, false,
+ nullptr)) {
+ platform_sp = Platform::GetPlatformForArchitecture(platform_arch, {},
&fixed_platform_arch);
if (platform_sp)
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
@@ -298,8 +300,9 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
if (arch.IsValid()) {
if (!platform_sp ||
- !platform_sp->IsCompatibleArchitecture(arch, false, nullptr))
- platform_sp = Platform::GetPlatformForArchitecture(specified_arch, &arch);
+ !platform_sp->IsCompatibleArchitecture(arch, {}, false, nullptr))
+ platform_sp =
+ Platform::GetPlatformForArchitecture(specified_arch, {}, &arch);
}
if (!platform_sp)
diff --git a/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp b/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
index 87c30debfd793..410c104299cbe 100644
--- a/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
+++ b/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
@@ -30,7 +30,7 @@ static void testSimPlatformArchHasSimEnvironment(llvm::StringRef name) {
ASSERT_TRUE(platform_sp);
int num_arches = 0;
- for (auto arch : platform_sp->GetSupportedArchitectures()) {
+ for (auto arch : platform_sp->GetSupportedArchitectures({})) {
EXPECT_EQ(arch.GetTriple().getEnvironment(), llvm::Triple::Simulator);
num_arches++;
}
@@ -60,7 +60,7 @@ TEST_F(PlatformAppleSimulatorTest, TestHostPlatformToSim) {
arch.GetTriple().setEnvironment(llvm::Triple::Simulator);
Status error;
- auto platform_sp = Platform::Create(arch, nullptr, error);
+ auto platform_sp = Platform::Create(arch, {}, nullptr, error);
EXPECT_TRUE(platform_sp);
}
}
diff --git a/lldb/unittests/Target/RemoteAwarePlatformTest.cpp b/lldb/unittests/Target/RemoteAwarePlatformTest.cpp
index 1cd6330ae5f16..4d84f596f2e50 100644
--- a/lldb/unittests/Target/RemoteAwarePlatformTest.cpp
+++ b/lldb/unittests/Target/RemoteAwarePlatformTest.cpp
@@ -26,7 +26,8 @@ class RemoteAwarePlatformTester : public RemoteAwarePlatform {
MOCK_METHOD0(GetDescription, llvm::StringRef());
MOCK_METHOD0(GetPluginName, llvm::StringRef());
- MOCK_METHOD0(GetSupportedArchitectures, std::vector<ArchSpec>());
+ MOCK_METHOD1(GetSupportedArchitectures,
+ std::vector<ArchSpec>(const ArchSpec &process_host_arch));
MOCK_METHOD4(Attach,
ProcessSP(ProcessAttachInfo &, Debugger &, Target *, Status &));
MOCK_METHOD0(CalculateTrapHandlerSymbolNames, void());
@@ -53,7 +54,8 @@ class TargetPlatformTester : public Platform {
MOCK_METHOD0(GetDescription, llvm::StringRef());
MOCK_METHOD0(GetPluginName, llvm::StringRef());
- MOCK_METHOD0(GetSupportedArchitectures, std::vector<ArchSpec>());
+ MOCK_METHOD1(GetSupportedArchitectures,
+ std::vector<ArchSpec>(const ArchSpec &process_host_arch));
MOCK_METHOD4(Attach,
ProcessSP(ProcessAttachInfo &, Debugger &, Target *, Status &));
MOCK_METHOD0(CalculateTrapHandlerSymbolNames, void());
@@ -73,7 +75,8 @@ TEST_F(RemoteAwarePlatformTest, TestResolveExecutabelOnClientByPlatform) {
ModuleSP expected_executable(new Module(executable_spec));
RemoteAwarePlatformTester platform(false);
- EXPECT_CALL(platform, GetSupportedArchitectures())
+ static const ArchSpec process_host_arch;
+ EXPECT_CALL(platform, GetSupportedArchitectures(process_host_arch))
.WillRepeatedly(Return(std::vector<ArchSpec>()));
EXPECT_CALL(platform, ResolveRemoteExecutable(_, _))
.WillRepeatedly(Return(std::make_pair(Status(), expected_executable)));
More information about the lldb-commits
mailing list