[Lldb-commits] [lldb] d667840 - Revert "[lldb] Add Debugger & ScriptedMetadata reference to Platform::CreateInstance"
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Fri Jan 13 09:13:20 PST 2023
Author: Med Ismail Bennani
Date: 2023-01-13T09:13:03-08:00
New Revision: d667840465b0ea0dbd39dcbd56788e73698dc853
URL: https://github.com/llvm/llvm-project/commit/d667840465b0ea0dbd39dcbd56788e73698dc853
DIFF: https://github.com/llvm/llvm-project/commit/d667840465b0ea0dbd39dcbd56788e73698dc853.diff
LOG: Revert "[lldb] Add Debugger & ScriptedMetadata reference to Platform::CreateInstance"
This reverts commit 2d53527e9c64c70c24e1abba74fa0a8c8b3392b1.
Added:
Modified:
lldb/bindings/interface/SBPlatform.i
lldb/include/lldb/API/SBDebugger.h
lldb/include/lldb/API/SBPlatform.h
lldb/include/lldb/API/SBStructuredData.h
lldb/include/lldb/Interpreter/OptionGroupPlatform.h
lldb/include/lldb/Target/Platform.h
lldb/include/lldb/lldb-private-interfaces.h
lldb/source/API/SBDebugger.cpp
lldb/source/API/SBPlatform.cpp
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Commands/CommandObjectPlatform.h
lldb/source/Core/Debugger.cpp
lldb/source/Interpreter/OptionGroupPlatform.cpp
lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroid.h
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/PlatformDarwin.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.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/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/POSIX/PlatformPOSIX.cpp
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/source/Plugins/Platform/Windows/PlatformWindows.h
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
lldb/source/Target/Platform.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/TargetList.cpp
lldb/unittests/Core/DiagnosticEventTest.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp
lldb/unittests/Interpreter/TestCommandPaths.cpp
lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
lldb/unittests/Platform/PlatformSiginfoTest.cpp
lldb/unittests/Platform/PlatformTest.cpp
lldb/unittests/Process/ProcessEventDataTest.cpp
lldb/unittests/Target/ExecutionContextTest.cpp
lldb/unittests/Target/StackFrameRecognizerTest.cpp
lldb/unittests/Thread/ThreadTest.cpp
Removed:
################################################################################
diff --git a/lldb/bindings/interface/SBPlatform.i b/lldb/bindings/interface/SBPlatform.i
index a57deca00e1d8..6413784e69e7c 100644
--- a/lldb/bindings/interface/SBPlatform.i
+++ b/lldb/bindings/interface/SBPlatform.i
@@ -126,18 +126,6 @@ public:
SBPlatform (const char *);
- %feature("docstring", "
- Create a platform instance using a specific platform plugin name, debugger,
- script name and user-provided dictionary.
-
- :param platform_name: name of the platform plugin to use to create the platform
- :param debugger: debugger instance owning the platform
- :param script_name: name of the script class and module to use to create the platform
- :param dict: user-provided dictionary that can be used when instanciating a platform
- ")
- SBPlatform (const char *, const SBDebugger&,
- const char *, const SBStructuredData&);
-
~SBPlatform();
static SBPlatform GetHostPlatform();
diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h
index 49e8dda965341..950e8e29ef79c 100644
--- a/lldb/include/lldb/API/SBDebugger.h
+++ b/lldb/include/lldb/API/SBDebugger.h
@@ -420,7 +420,6 @@ class LLDB_API SBDebugger {
const SBFileSpec &trace_description_file);
private:
- friend class SBPlatform;
friend class SBCommandInterpreter;
friend class SBInputReader;
friend class SBListener;
diff --git a/lldb/include/lldb/API/SBPlatform.h b/lldb/include/lldb/API/SBPlatform.h
index 9d9b392a25d6c..dcc8a14ff0c1f 100644
--- a/lldb/include/lldb/API/SBPlatform.h
+++ b/lldb/include/lldb/API/SBPlatform.h
@@ -96,9 +96,6 @@ class LLDB_API SBPlatform {
SBPlatform(const char *platform_name);
- SBPlatform(const char *platform_name, const SBDebugger &debugger,
- const char *script_name, const SBStructuredData &dict);
-
SBPlatform(const SBPlatform &rhs);
SBPlatform &operator=(const SBPlatform &rhs);
diff --git a/lldb/include/lldb/API/SBStructuredData.h b/lldb/include/lldb/API/SBStructuredData.h
index 3f1974ad051b8..533dcc8fc07c3 100644
--- a/lldb/include/lldb/API/SBStructuredData.h
+++ b/lldb/include/lldb/API/SBStructuredData.h
@@ -93,7 +93,6 @@ class SBStructuredData {
friend class SBLaunchInfo;
friend class SBDebugger;
friend class SBTarget;
- friend class SBPlatform;
friend class SBProcess;
friend class SBThread;
friend class SBThreadPlan;
diff --git a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
index 28cd6c89a39c3..fed2791a61309 100644
--- a/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
+++ b/lldb/include/lldb/Interpreter/OptionGroupPlatform.h
@@ -9,22 +9,19 @@
#ifndef LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
#define LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
-#include "lldb/Interpreter/OptionGroupPythonClassWithDict.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Utility/ConstString.h"
#include "llvm/Support/VersionTuple.h"
namespace lldb_private {
-class CommandObjectPlatformSelect;
// PlatformOptionGroup
//
// Make platform options available to any commands that need the settings.
class OptionGroupPlatform : public OptionGroup {
public:
OptionGroupPlatform(bool include_platform_option)
- : m_include_platform_option(include_platform_option),
- m_class_options("scripted platform", true, 'C', 'K', 'V', 0) {}
+ : m_include_platform_option(include_platform_option) {}
~OptionGroupPlatform() override = default;
@@ -63,14 +60,11 @@ class OptionGroupPlatform : public OptionGroup {
bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
protected:
- friend class CommandObjectPlatformSelect;
-
std::string m_platform_name;
ConstString m_sdk_sysroot;
ConstString m_sdk_build;
llvm::VersionTuple m_os_version;
bool m_include_platform_option;
- OptionGroupPythonClassWithDict m_class_options;
};
} // namespace lldb_private
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index a4425f2b6590d..08e47cc132473 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -21,7 +21,6 @@
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Host/File.h"
#include "lldb/Interpreter/Options.h"
-#include "lldb/Interpreter/ScriptedMetadata.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
@@ -100,8 +99,7 @@ class Platform : public PluginInterface {
static void SetHostPlatform(const lldb::PlatformSP &platform_sp);
- static lldb::PlatformSP Create(llvm::StringRef name, const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP Create(llvm::StringRef name);
/// Augments the triple either with information from platform or the host
/// system (if platform is null).
@@ -976,7 +974,7 @@ class Platform : public PluginInterface {
class PlatformList {
public:
- PlatformList(Debugger &debugger) : m_debugger(debugger) {}
+ PlatformList() = default;
~PlatformList() = default;
@@ -1031,16 +1029,13 @@ class PlatformList {
}
}
- lldb::PlatformSP GetOrCreate(llvm::StringRef name,
- const ScriptedMetadata *metadata);
+ lldb::PlatformSP GetOrCreate(llvm::StringRef name);
lldb::PlatformSP GetOrCreate(const ArchSpec &arch,
const ArchSpec &process_host_arch,
- ArchSpec *platform_arch_ptr, Status &error,
- const ScriptedMetadata *metadata);
+ ArchSpec *platform_arch_ptr, Status &error);
lldb::PlatformSP GetOrCreate(const ArchSpec &arch,
const ArchSpec &process_host_arch,
- ArchSpec *platform_arch_ptr,
- const ScriptedMetadata *metadata);
+ ArchSpec *platform_arch_ptr);
/// Get the platform for the given list of architectures.
///
@@ -1056,11 +1051,9 @@ class PlatformList {
/// given architecture.
lldb::PlatformSP GetOrCreate(llvm::ArrayRef<ArchSpec> archs,
const ArchSpec &process_host_arch,
- std::vector<lldb::PlatformSP> &candidates,
- const ScriptedMetadata *metadata);
+ std::vector<lldb::PlatformSP> &candidates);
- lldb::PlatformSP Create(llvm::StringRef name,
- const ScriptedMetadata *metadata);
+ lldb::PlatformSP Create(llvm::StringRef name);
/// Detect a binary in memory that will determine which Platform and
/// DynamicLoader should be used in this target/process, and update
@@ -1097,7 +1090,6 @@ class PlatformList {
private:
PlatformList(const PlatformList &) = delete;
const PlatformList &operator=(const PlatformList &) = delete;
- Debugger &m_debugger;
};
class OptionGroupPlatformRSync : public lldb_private::OptionGroup {
diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
index 79fadc21889c2..1eb37c0c9f685 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -26,7 +26,6 @@ class Value;
} // namespace llvm
namespace lldb_private {
-class ScriptedMetadata;
typedef lldb::ABISP (*ABICreateInstance)(lldb::ProcessSP process_sp,
const ArchSpec &arch);
typedef std::unique_ptr<Architecture> (*ArchitectureCreateInstance)(
@@ -78,9 +77,8 @@ typedef lldb::StructuredDataPluginSP (*StructuredDataPluginCreateInstance)(
typedef Status (*StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info,
Target *target);
typedef SystemRuntime *(*SystemRuntimeCreateInstance)(Process *process);
-typedef lldb::PlatformSP (*PlatformCreateInstance)(
- bool force, const ArchSpec *arch, const Debugger *debugger,
- const ScriptedMetadata *metadata);
+typedef lldb::PlatformSP (*PlatformCreateInstance)(bool force,
+ const ArchSpec *arch);
typedef lldb::ProcessSP (*ProcessCreateInstance)(
lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
const FileSpec *crash_file_path, bool can_connect);
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 743e928ff6615..851c80a21d8ec 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -1498,8 +1498,7 @@ SBError SBDebugger::SetCurrentPlatform(const char *platform_name_cstr) {
if (m_opaque_sp) {
if (platform_name_cstr && platform_name_cstr[0]) {
PlatformList &platforms = m_opaque_sp->GetPlatformList();
- if (PlatformSP platform_sp = platforms.GetOrCreate(
- platform_name_cstr, /*metadata = */ nullptr))
+ if (PlatformSP platform_sp = platforms.GetOrCreate(platform_name_cstr))
platforms.SetSelectedPlatform(platform_sp);
else
sb_error.ref().SetErrorString("platform not found");
diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index 7ba9e726663e6..807d0085c7bcb 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -7,16 +7,13 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBPlatform.h"
-#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBEnvironment.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBPlatform.h"
-#include "lldb/API/SBStructuredData.h"
#include "lldb/API/SBUnixSignals.h"
#include "lldb/Host/File.h"
-#include "lldb/Interpreter/ScriptedMetadata.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/ArchSpec.h"
@@ -295,31 +292,7 @@ SBPlatform::SBPlatform() { LLDB_INSTRUMENT_VA(this); }
SBPlatform::SBPlatform(const char *platform_name) {
LLDB_INSTRUMENT_VA(this, platform_name);
- m_opaque_sp = Platform::Create(platform_name, /*debugger = */ nullptr,
- /*metadata = */ nullptr);
-}
-
-SBPlatform::SBPlatform(const char *platform_name, const SBDebugger &debugger,
- const char *script_name, const SBStructuredData &dict) {
- LLDB_INSTRUMENT_VA(this, platform_name, debugger, script_name, dict);
-
- if (!script_name || !dict.IsValid() || !dict.m_impl_up)
- return;
-
- StructuredData::ObjectSP obj_sp = dict.m_impl_up->GetObjectSP();
-
- if (!obj_sp)
- return;
-
- StructuredData::DictionarySP dict_sp =
- std::make_shared<StructuredData::Dictionary>(obj_sp);
- if (!dict_sp || dict_sp->GetType() == lldb::eStructuredDataTypeInvalid)
- return;
-
- const ScriptedMetadata metadata(script_name, dict_sp);
-
- m_opaque_sp =
- Platform::Create(platform_name, debugger.m_opaque_sp.get(), &metadata);
+ m_opaque_sp = Platform::Create(platform_name);
}
SBPlatform::SBPlatform(const SBPlatform &rhs) {
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index 610eb24ea6d7b..69c44fe8c8c44 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -139,58 +139,63 @@ class OptionPermissions : public OptionGroup {
};
// "platform select <platform-name>"
-CommandObjectPlatformSelect::CommandObjectPlatformSelect(
- CommandInterpreter &interpreter)
- : CommandObjectParsed(interpreter, "platform select",
- "Create a platform if needed and select it as the "
- "current platform.",
- "platform select <platform-name>", 0),
- m_platform_options(
- false) // Don't include the "--platform" option by passing false
-{
- m_option_group.Append(&m_platform_options, LLDB_OPT_SET_ALL, 1);
- m_option_group.Append(&m_platform_options.m_class_options,
- LLDB_OPT_SET_1 | LLDB_OPT_SET_2, LLDB_OPT_SET_ALL);
- m_option_group.Finalize();
- CommandArgumentData platform_arg{eArgTypePlatform, eArgRepeatPlain};
- m_arguments.push_back({platform_arg});
-}
+class CommandObjectPlatformSelect : public CommandObjectParsed {
+public:
+ CommandObjectPlatformSelect(CommandInterpreter &interpreter)
+ : CommandObjectParsed(interpreter, "platform select",
+ "Create a platform if needed and select it as the "
+ "current platform.",
+ "platform select <platform-name>", 0),
+ m_platform_options(
+ false) // Don't include the "--platform" option by passing false
+ {
+ m_option_group.Append(&m_platform_options, LLDB_OPT_SET_ALL, 1);
+ m_option_group.Finalize();
+ CommandArgumentData platform_arg{eArgTypePlatform, eArgRepeatPlain};
+ m_arguments.push_back({platform_arg});
+ }
-void CommandObjectPlatformSelect::HandleCompletion(CompletionRequest &request) {
- CommandCompletions::PlatformPluginNames(GetCommandInterpreter(), request,
- nullptr);
-}
+ ~CommandObjectPlatformSelect() override = default;
-Options *CommandObjectPlatformSelect::GetOptions() { return &m_option_group; }
+ void HandleCompletion(CompletionRequest &request) override {
+ CommandCompletions::PlatformPluginNames(GetCommandInterpreter(), request,
+ nullptr);
+ }
-bool CommandObjectPlatformSelect::DoExecute(Args &args,
- CommandReturnObject &result) {
- if (args.GetArgumentCount() == 1) {
- const char *platform_name = args.GetArgumentAtIndex(0);
- if (platform_name && platform_name[0]) {
- const bool select = true;
- m_platform_options.SetPlatformName(platform_name);
- Status error;
- ArchSpec platform_arch;
- PlatformSP platform_sp(m_platform_options.CreatePlatformWithOptions(
- m_interpreter, ArchSpec(), select, error, platform_arch));
- if (platform_sp) {
- GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp);
+ Options *GetOptions() override { return &m_option_group; }
- platform_sp->GetStatus(result.GetOutputStream());
- result.SetStatus(eReturnStatusSuccessFinishResult);
+protected:
+ bool DoExecute(Args &args, CommandReturnObject &result) override {
+ if (args.GetArgumentCount() == 1) {
+ const char *platform_name = args.GetArgumentAtIndex(0);
+ if (platform_name && platform_name[0]) {
+ const bool select = true;
+ m_platform_options.SetPlatformName(platform_name);
+ Status error;
+ ArchSpec platform_arch;
+ PlatformSP platform_sp(m_platform_options.CreatePlatformWithOptions(
+ m_interpreter, ArchSpec(), select, error, platform_arch));
+ if (platform_sp) {
+ GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp);
+
+ platform_sp->GetStatus(result.GetOutputStream());
+ result.SetStatus(eReturnStatusSuccessFinishResult);
+ } else {
+ result.AppendError(error.AsCString());
+ }
} else {
- result.AppendError(error.AsCString());
+ result.AppendError("invalid platform name");
}
} else {
- result.AppendError("invalid platform name");
+ result.AppendError(
+ "platform create takes a platform name as an argument\n");
}
- } else {
- result.AppendError(
- "platform create takes a platform name as an argument\n");
+ return result.Succeeded();
}
- return result.Succeeded();
-}
+
+ OptionGroupOptions m_option_group;
+ OptionGroupPlatform m_platform_options;
+};
// "platform list"
class CommandObjectPlatformList : public CommandObjectParsed {
diff --git a/lldb/source/Commands/CommandObjectPlatform.h b/lldb/source/Commands/CommandObjectPlatform.h
index c7219263d4111..86f55c7d9b085 100644
--- a/lldb/source/Commands/CommandObjectPlatform.h
+++ b/lldb/source/Commands/CommandObjectPlatform.h
@@ -10,7 +10,6 @@
#define LLDB_SOURCE_COMMANDS_COMMANDOBJECTPLATFORM_H
#include "lldb/Interpreter/CommandObjectMultiword.h"
-#include "lldb/Interpreter/OptionGroupPlatform.h"
namespace lldb_private {
@@ -28,23 +27,6 @@ class CommandObjectPlatform : public CommandObjectMultiword {
operator=(const CommandObjectPlatform &) = delete;
};
-class CommandObjectPlatformSelect : public CommandObjectParsed {
-public:
- CommandObjectPlatformSelect(CommandInterpreter &interpreter);
-
- ~CommandObjectPlatformSelect() override = default;
-
- void HandleCompletion(CompletionRequest &request) override;
-
- Options *GetOptions() override;
-
-protected:
- bool DoExecute(Args &args, CommandReturnObject &result) override;
-
- OptionGroupOptions m_option_group;
- OptionGroupPlatform m_platform_options;
-};
-
} // namespace lldb_private
#endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTPLATFORM_H
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 413328f474303..8a8a01c70ce66 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -764,7 +764,7 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
m_error_stream_sp(std::make_shared<StreamFile>(stderr, false)),
m_input_recorder(nullptr),
m_broadcaster_manager_sp(BroadcasterManager::MakeBroadcasterManager()),
- m_terminal_state(), m_target_list(*this), m_platform_list(*this),
+ m_terminal_state(), m_target_list(*this), m_platform_list(),
m_listener_sp(Listener::MakeListener("lldb.Debugger")),
m_source_manager_up(), m_source_file_cache(),
m_command_interpreter_up(
diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp
index 16daa12d5299d..60107eb288069 100644
--- a/lldb/source/Interpreter/OptionGroupPlatform.cpp
+++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp
@@ -10,7 +10,6 @@
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/ScriptedMetadata.h"
#include "lldb/Target/Platform.h"
using namespace lldb;
@@ -23,10 +22,8 @@ PlatformSP OptionGroupPlatform::CreatePlatformWithOptions(
PlatformSP platform_sp;
- const ScriptedMetadata metadata(m_class_options);
-
if (!m_platform_name.empty()) {
- platform_sp = platforms.Create(m_platform_name, &metadata);
+ platform_sp = platforms.Create(m_platform_name);
if (!platform_sp) {
error.SetErrorStringWithFormatv(
"unable to find a plug-in for the platform named \"{0}\"",
@@ -44,8 +41,7 @@ PlatformSP OptionGroupPlatform::CreatePlatformWithOptions(
}
}
} else if (arch.IsValid()) {
- platform_sp =
- platforms.GetOrCreate(arch, {}, &platform_arch, error, &metadata);
+ platform_sp = platforms.GetOrCreate(arch, {}, &platform_arch, error);
}
if (platform_sp) {
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index c3cd2865fff6d..09dd94d9186d3 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -511,7 +511,7 @@ DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel(Process *process,
process->SetCanRunCode(false);
PlatformSP platform_sp =
process->GetTarget().GetDebugger().GetPlatformList().Create(
- PlatformDarwinKernel::GetPluginNameStatic(), /*metadata = */ nullptr);
+ PlatformDarwinKernel::GetPluginNameStatic());
if (platform_sp.get())
process->GetTarget().SetPlatform(platform_sp);
}
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index ef3e102cd7233..1afce4f41a823 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -59,9 +59,7 @@ void PlatformAndroid::Terminate() {
PlatformLinux::Terminate();
}
-PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h
index 38239861cfb5e..1a66ddebb2438 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h
@@ -28,9 +28,7 @@ class PlatformAndroid : public platform_linux::PlatformLinux {
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static llvm::StringRef GetPluginNameStatic(bool is_host) {
return is_host ? Platform::GetHostPlatformName() : "remote-android";
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
index 0321eba5bb811..0c6831b77d875 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -44,9 +44,8 @@ LLDB_PLUGIN_DEFINE(PlatformFreeBSD)
static uint32_t g_initialize_count = 0;
-PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+
+PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
arch ? arch->GetArchitectureName() : "<null>",
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
index 1bf3ba2b27562..1e92bb4a1e147 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -24,9 +24,7 @@ class PlatformFreeBSD : public PlatformPOSIX {
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static llvm::StringRef GetPluginNameStatic(bool is_host) {
return is_host ? Platform::GetHostPlatformName() : "remote-freebsd";
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index c9c360831b993..bf226fabda5c9 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -41,9 +41,8 @@ LLDB_PLUGIN_DEFINE(PlatformLinux)
static uint32_t g_initialize_count = 0;
-PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+
+PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
arch ? arch->GetArchitectureName() : "<null>",
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
index 7ac24d9e9012a..89f0bd709ef60 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -24,9 +24,7 @@ class PlatformLinux : public PlatformPOSIX {
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static llvm::StringRef GetPluginNameStatic(bool is_host) {
return is_host ? Platform::GetHostPlatformName() : "remote-linux";
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
index 4411b7c4d4528..1e117f26dacf8 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -552,9 +552,7 @@ struct PlatformiOSSimulator {
PluginManager::UnregisterPlugin(PlatformiOSSimulator::CreateInstance);
}
- static PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+ static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
if (shouldSkipSimulatorPlatform(force, arch))
return nullptr;
@@ -599,9 +597,7 @@ struct PlatformAppleTVSimulator {
PluginManager::UnregisterPlugin(PlatformAppleTVSimulator::CreateInstance);
}
- static PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+ static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
if (shouldSkipSimulatorPlatform(force, arch))
return nullptr;
return PlatformAppleSimulator::CreateInstance(
@@ -643,9 +639,7 @@ struct PlatformAppleWatchSimulator {
PlatformAppleWatchSimulator::CreateInstance);
}
- static PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+ static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
if (shouldSkipSimulatorPlatform(force, arch))
return nullptr;
return PlatformAppleSimulator::CreateInstance(
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 85a18f0f4a94c..4f49e46ee4426 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -106,11 +106,9 @@ llvm::StringRef PlatformDarwin::GetDescriptionStatic() {
return "Darwin platform plug-in.";
}
-PlatformSP PlatformDarwin::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
- // We only create subclasses of the PlatformDarwin plugin.
- return PlatformSP();
+PlatformSP PlatformDarwin::CreateInstance(bool force, const ArchSpec *arch) {
+ // We only create subclasses of the PlatformDarwin plugin.
+ return PlatformSP();
}
#define LLDB_PROPERTIES_platformdarwin
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
index 782316c931e56..4b564bba7de0c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -48,9 +48,7 @@ class PlatformDarwin : public PlatformPOSIX {
~PlatformDarwin() override;
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static void DebuggerInitialize(lldb_private::Debugger &debugger);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 2f16b442bed6b..3c9cc8e77189e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -72,10 +72,8 @@ void PlatformDarwinKernel::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP
-PlatformDarwinKernel::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
+ const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
@@ -970,7 +968,7 @@ bool PlatformDarwinKernel::LoadPlatformBinaryAndSetup(Process *process,
PlatformSP platform_sp =
process->GetTarget().GetDebugger().GetPlatformList().Create(
- PlatformDarwinKernel::GetPluginNameStatic(), /*metadata = */ nullptr);
+ PlatformDarwinKernel::GetPluginNameStatic());
if (platform_sp)
process->GetTarget().SetPlatform(platform_sp);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
index 61428ac46cdf8..1b0708cd9f8dc 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
@@ -36,9 +36,7 @@ class Stream;
class PlatformDarwinKernel : public PlatformDarwin {
public:
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static void DebuggerInitialize(Debugger &debugger);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 18f1936bf875d..25b821d12a314 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -90,9 +90,7 @@ llvm::StringRef PlatformMacOSX::GetDescriptionStatic() {
return "Local Mac OS X user platform plug-in.";
}
-PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) {
// The only time we create an instance is when we are creating a remote
// macosx platform which is handled by PlatformRemoteMacOSX.
return PlatformSP();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
index fb15a4802def2..be844856ef923 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
@@ -32,9 +32,7 @@ class PlatformMacOSX : public PlatformDarwinDevice {
public:
PlatformMacOSX();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
index 29874b1c48f8e..5515d76a1c99d 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
@@ -56,10 +56,8 @@ void PlatformRemoteAppleBridge::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP
-PlatformRemoteAppleBridge::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force,
+ const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
index 804fdc04126c6..91dd02cc94323 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
@@ -24,9 +24,7 @@ class PlatformRemoteAppleBridge : public PlatformRemoteDarwinDevice {
public:
PlatformRemoteAppleBridge();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index ca87916ffd2c8..5b729690eda13 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -57,10 +57,8 @@ void PlatformRemoteAppleTV::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP
-PlatformRemoteAppleTV::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force,
+ const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
index c3ee6cc96f9c4..2962f19bd2ee2 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
@@ -26,9 +26,8 @@ class PlatformRemoteAppleTV : public PlatformRemoteDarwinDevice {
PlatformRemoteAppleTV();
// Class Functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force,
+ const lldb_private::ArchSpec *arch);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
index 5fc22689cc975..7dc8b9b4c9de3 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
@@ -54,10 +54,8 @@ void PlatformRemoteAppleWatch::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP
-PlatformRemoteAppleWatch::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force,
+ const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
index f36e6d20deec1..20694f00d9f5e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
@@ -22,9 +22,7 @@ class PlatformRemoteAppleWatch : public PlatformRemoteDarwinDevice {
public:
PlatformRemoteAppleWatch();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
index bc67a7ecfb03a..460f6d8bd6170 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
@@ -57,10 +57,8 @@ void PlatformRemoteMacOSX::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP
-PlatformRemoteMacOSX::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformRemoteMacOSX::CreateInstance(bool force,
+ const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
index 3b0505d8fc226..17ae372e3616b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
@@ -27,9 +27,7 @@ class PlatformRemoteMacOSX : public virtual PlatformRemoteDarwinDevice {
public:
PlatformRemoteMacOSX();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index 9acc02c718871..d6f573bbe2754 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -52,9 +52,7 @@ void PlatformRemoteiOS::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
index cdf12c4243674..991bf1d4dd1a3 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
@@ -22,9 +22,7 @@ class PlatformRemoteiOS : public PlatformRemoteDarwinDevice {
public:
PlatformRemoteiOS();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
index 8da4a7c480e5c..59bbc3f638af1 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
@@ -39,9 +39,8 @@ LLDB_PLUGIN_DEFINE(PlatformNetBSD)
static uint32_t g_initialize_count = 0;
-PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+
+PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
arch ? arch->GetArchitectureName() : "<null>",
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
index 17039b7adeea9..3437d7e5eb511 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
@@ -24,9 +24,7 @@ class PlatformNetBSD : public PlatformPOSIX {
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static llvm::StringRef GetPluginNameStatic(bool is_host) {
return is_host ? Platform::GetHostPlatformName() : "remote-netbsd";
diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
index 4e6a812ddbd6a..3946092276fd4 100644
--- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
+++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
@@ -39,9 +39,8 @@ LLDB_PLUGIN_DEFINE(PlatformOpenBSD)
static uint32_t g_initialize_count = 0;
-PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+
+PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) {
Log *log = GetLog(LLDBLog::Platform);
LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force,
arch ? arch->GetArchitectureName() : "<null>",
diff --git a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
index 3975773a7d051..fcdc03576711a 100644
--- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
+++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
@@ -23,9 +23,7 @@ class PlatformOpenBSD : public PlatformPOSIX {
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static llvm::StringRef GetPluginNameStatic(bool is_host) {
return is_host ? Platform::GetHostPlatformName() : "remote-openbsd";
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index c91d876e22ce6..222dbfa719647 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -310,8 +310,7 @@ Status PlatformPOSIX::ConnectRemote(Args &args) {
if (!m_remote_platform_sp)
m_remote_platform_sp =
platform_gdb_server::PlatformRemoteGDBServer::CreateInstance(
- /*force=*/true, /*arch=*/nullptr, /*debugger=*/nullptr,
- /*metadata=*/nullptr);
+ /*force=*/true, nullptr);
if (m_remote_platform_sp && error.Success())
error = m_remote_platform_sp->ConnectRemote(args);
diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 89ffbf8da6567..4ba20117cdb56 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -103,9 +103,7 @@ void PlatformQemuUser::DebuggerInitialize(Debugger &debugger) {
}
}
-PlatformSP PlatformQemuUser::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformQemuUser::CreateInstance(bool force, const ArchSpec *arch) {
if (force)
return PlatformSP(new PlatformQemuUser());
return nullptr;
diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
index eeb2f371711bb..596cf75b591f2 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
@@ -70,9 +70,7 @@ class PlatformQemuUser : public Platform {
}
private:
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static void DebuggerInitialize(Debugger &debugger);
PlatformQemuUser() : Platform(/*is_host=*/true) {}
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index fb84fd5b2d2b3..017318fe4b420 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -41,9 +41,8 @@ LLDB_PLUGIN_DEFINE(PlatformWindows)
static uint32_t g_initialize_count = 0;
-PlatformSP PlatformWindows::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformWindows::CreateInstance(bool force,
+ const lldb_private::ArchSpec *arch) {
// The only time we create an instance is when we are creating a remote
// windows platform
const bool is_host = false;
@@ -138,12 +137,10 @@ Status PlatformWindows::ConnectRemote(Args &args) {
"can't connect to the host platform '{0}', always connected",
GetPluginName());
} else {
- if (!m_remote_platform_sp) {
+ if (!m_remote_platform_sp)
m_remote_platform_sp =
platform_gdb_server::PlatformRemoteGDBServer::CreateInstance(
- /*force=*/true, /*arch=*/nullptr, /*debugger=*/nullptr,
- /*metadata=*/nullptr);
- }
+ /*force=*/true, nullptr);
if (m_remote_platform_sp) {
if (error.Success()) {
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
index 610b4b2fdab90..771133f341e90 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
@@ -22,9 +22,8 @@ class PlatformWindows : public RemoteAwarePlatform {
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force,
+ const lldb_private::ArchSpec *arch);
static llvm::StringRef GetPluginNameStatic(bool is_host) {
return is_host ? Platform::GetHostPlatformName() : "remote-windows";
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 8cd17f743d33c..0858a2a8d3c8b 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -64,10 +64,8 @@ void PlatformRemoteGDBServer::Terminate() {
Platform::Terminate();
}
-PlatformSP
-PlatformRemoteGDBServer::CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformRemoteGDBServer::CreateInstance(bool force,
+ const ArchSpec *arch) {
bool create = force;
if (!create) {
create = !arch->TripleVendorWasSpecified() && !arch->TripleOSWasSpecified();
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index f1b90c09dd472..638f7db5ef800 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -26,9 +26,7 @@ class PlatformRemoteGDBServer : public Platform, private UserIDResolver {
static void Terminate();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
static llvm::StringRef GetPluginNameStatic() { return "remote-gdb-server"; }
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index dfaa7f4b73468..1ddd7596280ee 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -164,6 +164,40 @@ Platform::LocateExecutableScriptingResources(Target *target, Module &module,
return FileSpecList();
}
+// PlatformSP
+// Platform::FindPlugin (Process *process, ConstString plugin_name)
+//{
+// PlatformCreateInstance create_callback = nullptr;
+// if (plugin_name)
+// {
+// create_callback =
+// PluginManager::GetPlatformCreateCallbackForPluginName (plugin_name);
+// if (create_callback)
+// {
+// ArchSpec arch;
+// if (process)
+// {
+// arch = process->GetTarget().GetArchitecture();
+// }
+// PlatformSP platform_sp(create_callback(process, &arch));
+// if (platform_sp)
+// return platform_sp;
+// }
+// }
+// else
+// {
+// for (uint32_t idx = 0; (create_callback =
+// PluginManager::GetPlatformCreateCallbackAtIndex(idx)) != nullptr;
+// ++idx)
+// {
+// PlatformSP platform_sp(create_callback(process, nullptr));
+// if (platform_sp)
+// return platform_sp;
+// }
+// }
+// return PlatformSP();
+//}
+
Status Platform::GetSharedModule(
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
@@ -217,15 +251,14 @@ bool Platform::GetModuleSpec(const FileSpec &module_file_spec,
module_spec);
}
-PlatformSP Platform::Create(llvm::StringRef name, const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+PlatformSP Platform::Create(llvm::StringRef name) {
lldb::PlatformSP platform_sp;
if (name == GetHostPlatformName())
return GetHostPlatform();
if (PlatformCreateInstance create_callback =
PluginManager::GetPlatformCreateCallbackForPluginName(name))
- return create_callback(true, nullptr, debugger, metadata);
+ return create_callback(true, nullptr);
return nullptr;
}
@@ -1934,20 +1967,19 @@ Args Platform::GetExtraStartupCommands() {
return {};
}
-PlatformSP PlatformList::GetOrCreate(llvm::StringRef name,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformList::GetOrCreate(llvm::StringRef name) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
for (const PlatformSP &platform_sp : m_platforms) {
if (platform_sp->GetName() == name)
return platform_sp;
}
- return Create(name, metadata);
+ return Create(name);
}
PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
const ArchSpec &process_host_arch,
- ArchSpec *platform_arch_ptr, Status &error,
- const ScriptedMetadata *metadata) {
+ ArchSpec *platform_arch_ptr,
+ Status &error) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
// First try exact arch matches across all platforms already created
for (const auto &platform_sp : m_platforms) {
@@ -1970,8 +2002,7 @@ PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
for (idx = 0;
(create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx));
++idx) {
- PlatformSP platform_sp =
- create_callback(false, &arch, &m_debugger, metadata);
+ PlatformSP platform_sp = create_callback(false, &arch);
if (platform_sp &&
platform_sp->IsCompatibleArchitecture(
arch, process_host_arch, ArchSpec::ExactMatch, platform_arch_ptr)) {
@@ -1983,8 +2014,7 @@ PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
for (idx = 0;
(create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx));
++idx) {
- PlatformSP platform_sp =
- create_callback(false, &arch, &m_debugger, metadata);
+ PlatformSP platform_sp = create_callback(false, &arch);
if (platform_sp && platform_sp->IsCompatibleArchitecture(
arch, process_host_arch, ArchSpec::CompatibleMatch,
platform_arch_ptr)) {
@@ -1999,19 +2029,16 @@ PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
const ArchSpec &process_host_arch,
- ArchSpec *platform_arch_ptr,
- const ScriptedMetadata *metadata) {
+ ArchSpec *platform_arch_ptr) {
Status error;
if (arch.IsValid())
- return GetOrCreate(arch, process_host_arch, platform_arch_ptr, error,
- metadata);
+ return GetOrCreate(arch, process_host_arch, platform_arch_ptr, error);
return nullptr;
}
PlatformSP PlatformList::GetOrCreate(llvm::ArrayRef<ArchSpec> archs,
const ArchSpec &process_host_arch,
- std::vector<PlatformSP> &candidates,
- const ScriptedMetadata *metadata) {
+ std::vector<PlatformSP> &candidates) {
candidates.clear();
candidates.reserve(archs.size());
@@ -2040,9 +2067,7 @@ PlatformSP PlatformList::GetOrCreate(llvm::ArrayRef<ArchSpec> archs,
// Collect a list of candidate platforms for the architectures.
for (const ArchSpec &arch : archs) {
- if (PlatformSP platform = GetOrCreate(arch, process_host_arch,
- /*platform_arch_ptr = */ nullptr,
- /*metadata = */ nullptr))
+ if (PlatformSP platform = GetOrCreate(arch, process_host_arch, nullptr))
candidates.push_back(platform);
}
@@ -2063,10 +2088,9 @@ PlatformSP PlatformList::GetOrCreate(llvm::ArrayRef<ArchSpec> archs,
return nullptr;
}
-PlatformSP PlatformList::Create(llvm::StringRef name,
- const ScriptedMetadata *metadata) {
+PlatformSP PlatformList::Create(llvm::StringRef name) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- PlatformSP platform_sp = Platform::Create(name, &m_debugger, metadata);
+ PlatformSP platform_sp = Platform::Create(name);
m_platforms.push_back(platform_sp);
return platform_sp;
}
@@ -2080,8 +2104,7 @@ bool PlatformList::LoadPlatformBinaryAndSetup(Process *process,
(create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx));
++idx) {
ArchSpec arch;
- PlatformSP platform_sp =
- create_callback(true, &arch, &m_debugger, /*metadata = */ nullptr);
+ PlatformSP platform_sp = create_callback(true, &arch);
if (platform_sp) {
if (platform_sp->LoadPlatformBinaryAndSetup(process, addr, notify))
return true;
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f30a8a0e9086f..e0cca0595ee30 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2931,8 +2931,7 @@ void Process::CompleteAttach() {
ArchSpec::CompatibleMatch, nullptr)) {
ArchSpec platform_arch;
platform_sp = GetTarget().GetDebugger().GetPlatformList().GetOrCreate(
- target_arch, process_host_arch, &platform_arch,
- /*metadata = */ nullptr);
+ target_arch, process_host_arch, &platform_arch);
if (platform_sp) {
GetTarget().SetPlatform(platform_sp);
GetTarget().SetArchitecture(platform_arch);
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 985f3f3db355a..fd0cf0a5361d2 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1503,9 +1503,8 @@ bool Target::SetArchitecture(const ArchSpec &arch_spec, bool set_platform,
other, {}, ArchSpec::CompatibleMatch, nullptr)) {
ArchSpec platform_arch;
if (PlatformSP arch_platform_sp =
- GetDebugger().GetPlatformList().GetOrCreate(
- other, /*process_host_arch = */ {}, &platform_arch,
- /*metadata = */ nullptr)) {
+ GetDebugger().GetPlatformList().GetOrCreate(other, {},
+ &platform_arch)) {
SetPlatform(arch_platform_sp);
if (platform_arch.IsValid())
other = platform_arch;
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 665243b0ae0cb..8ce2ae8c2898e 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -184,9 +184,8 @@ Status TargetList::CreateTargetInternal(
std::vector<ArchSpec> archs;
for (const ModuleSpec &spec : module_specs.ModuleSpecs())
archs.push_back(spec.GetArchitecture());
- if (PlatformSP platform_for_archs_sp = platform_list.GetOrCreate(
- archs, /*process_host_arch = */ {}, candidates,
- /*metadata = */ nullptr)) {
+ if (PlatformSP platform_for_archs_sp =
+ platform_list.GetOrCreate(archs, {}, candidates)) {
platform_sp = platform_for_archs_sp;
} else if (candidates.empty()) {
error.SetErrorString("no matching platforms found for this file");
@@ -219,9 +218,7 @@ Status TargetList::CreateTargetInternal(
if (!prefer_platform_arch && arch.IsValid()) {
if (!platform_sp->IsCompatibleArchitecture(
arch, {}, ArchSpec::CompatibleMatch, nullptr)) {
- platform_sp =
- platform_list.GetOrCreate(arch, /*process_host_arch = */ {},
- &platform_arch, /*metadata = */ nullptr);
+ platform_sp = platform_list.GetOrCreate(arch, {}, &platform_arch);
if (platform_sp)
platform_list.SetSelectedPlatform(platform_sp);
}
@@ -231,9 +228,8 @@ Status TargetList::CreateTargetInternal(
ArchSpec fixed_platform_arch;
if (!platform_sp->IsCompatibleArchitecture(
platform_arch, {}, ArchSpec::CompatibleMatch, nullptr)) {
- platform_sp = platform_list.GetOrCreate(
- platform_arch, /*process_host_arch = */ {}, &fixed_platform_arch,
- /*metadata = */ nullptr);
+ platform_sp =
+ platform_list.GetOrCreate(platform_arch, {}, &fixed_platform_arch);
if (platform_sp)
platform_list.SetSelectedPlatform(platform_sp);
}
@@ -264,9 +260,8 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
if (arch.IsValid()) {
if (!platform_sp || !platform_sp->IsCompatibleArchitecture(
arch, {}, ArchSpec::CompatibleMatch, nullptr))
- platform_sp = debugger.GetPlatformList().GetOrCreate(
- specified_arch, /*process_host_arch = */ {}, &arch,
- /*metadata = */ nullptr);
+ platform_sp =
+ debugger.GetPlatformList().GetOrCreate(specified_arch, {}, &arch);
}
if (!platform_sp)
diff --git a/lldb/unittests/Core/DiagnosticEventTest.cpp b/lldb/unittests/Core/DiagnosticEventTest.cpp
index 7531913407790..bca8f3789955a 100644
--- a/lldb/unittests/Core/DiagnosticEventTest.cpp
+++ b/lldb/unittests/Core/DiagnosticEventTest.cpp
@@ -39,8 +39,7 @@ class DiagnosticEventTest : public ::testing::Test {
[]() { Debugger::Initialize(nullptr); });
ArchSpec arch("x86_64-apple-macosx-");
Platform::SetHostPlatform(
- PlatformRemoteMacOSX::CreateInstance(true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ PlatformRemoteMacOSX::CreateInstance(true, &arch));
}
void TearDown() override {
PlatformMacOSX::Terminate();
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index 88e1280b7e2f4..942426e4345eb 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -369,9 +369,8 @@ TEST_F(DWARFExpressionMockProcessTest, DW_OP_deref) {
// Set up a mock process.
ArchSpec arch("i386-pc-linux");
- Platform::SetHostPlatform(platform_linux::PlatformLinux::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ Platform::SetHostPlatform(
+ platform_linux::PlatformLinux::CreateInstance(true, &arch));
lldb::DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
lldb::TargetSP target_sp;
@@ -410,9 +409,7 @@ TEST_F(DWARFExpressionMockProcessTest, WASM_DW_OP_addr) {
// Set up a wasm target
ArchSpec arch("wasm32-unknown-unknown-wasm");
lldb::PlatformSP host_platform_sp =
- platform_linux::PlatformLinux::CreateInstance(true, &arch,
- /*debugger=*/nullptr,
- /*metadata=*/nullptr);
+ platform_linux::PlatformLinux::CreateInstance(true, &arch);
ASSERT_TRUE(host_platform_sp);
Platform::SetHostPlatform(host_platform_sp);
lldb::DebuggerSP debugger_sp = Debugger::CreateInstance();
@@ -491,9 +488,7 @@ TEST_F(DWARFExpressionMockProcessTest, WASM_DW_OP_addr_index) {
// Set up a wasm target
ArchSpec arch("wasm32-unknown-unknown-wasm");
lldb::PlatformSP host_platform_sp =
- platform_linux::PlatformLinux::CreateInstance(true, &arch,
- /*debugger=*/nullptr,
- /*metadata=*/nullptr);
+ platform_linux::PlatformLinux::CreateInstance(true, &arch);
ASSERT_TRUE(host_platform_sp);
Platform::SetHostPlatform(host_platform_sp);
lldb::DebuggerSP debugger_sp = Debugger::CreateInstance();
diff --git a/lldb/unittests/Interpreter/TestCommandPaths.cpp b/lldb/unittests/Interpreter/TestCommandPaths.cpp
index fd0c120a61581..78948ae5b7065 100644
--- a/lldb/unittests/Interpreter/TestCommandPaths.cpp
+++ b/lldb/unittests/Interpreter/TestCommandPaths.cpp
@@ -104,10 +104,8 @@ void RunTest(CommandInterpreter &interp, const char *args, bool is_leaf,
TEST_F(VerifyUserMultiwordCmdPathTest, TestErrors) {
ArchSpec arch("x86_64-apple-macosx-");
- Platform::SetHostPlatform(
- PlatformRemoteMacOSX::CreateInstance(true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
-
+ Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
+
DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
diff --git a/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp b/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
index 3b5198226ce2b..f30edfb9541ae 100644
--- a/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
+++ b/lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
@@ -9,13 +9,10 @@
#include "gtest/gtest.h"
#include "Plugins/Platform/MacOSX/PlatformAppleSimulator.h"
-#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h"
-#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteiOS.h"
#include "TestingSupport/SubsystemRAII.h"
-#include "lldb/Core/Debugger.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Platform.h"
@@ -23,36 +20,16 @@
using namespace lldb;
using namespace lldb_private;
-static std::once_flag platform_initialize_flag;
-static std::once_flag debugger_initialize_flag;
-
class PlatformAppleSimulatorTest : public ::testing::Test {
SubsystemRAII<FileSystem, HostInfo, PlatformAppleSimulator, PlatformRemoteiOS,
PlatformRemoteAppleTV, PlatformRemoteAppleWatch>
subsystems;
-
-public:
- void SetUp() override {
- std::call_once(platform_initialize_flag,
- []() { PlatformMacOSX::Initialize(); });
- std::call_once(debugger_initialize_flag,
- []() { Debugger::Initialize(nullptr); });
- ArchSpec arch("x86_64-apple-macosx-");
- Platform::SetHostPlatform(
- PlatformRemoteMacOSX::CreateInstance(true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
- }
- void TearDown() override { PlatformMacOSX::Terminate(); }
-
-protected:
- DebuggerSP m_debugger_sp = nullptr;
};
#ifdef __APPLE__
static void testSimPlatformArchHasSimEnvironment(llvm::StringRef name) {
- auto platform_sp = Platform::Create(name, /*debugger=*/nullptr,
- /*metadata=*/nullptr);
+ auto platform_sp = Platform::Create(name);
ASSERT_TRUE(platform_sp);
int num_arches = 0;
@@ -81,13 +58,12 @@ TEST_F(PlatformAppleSimulatorTest, TestHostPlatformToSim) {
};
for (auto sim : sim_platforms) {
- PlatformList list(*m_debugger_sp.get());
+ PlatformList list;
ArchSpec arch = platform_arch;
arch.GetTriple().setOS(sim);
arch.GetTriple().setEnvironment(llvm::Triple::Simulator);
- auto platform_sp = list.GetOrCreate(arch, {}, /*platform_arch_ptr=*/nullptr,
- /*metadata=*/nullptr);
+ auto platform_sp = list.GetOrCreate(arch, {}, nullptr);
EXPECT_TRUE(platform_sp);
}
}
@@ -102,10 +78,10 @@ TEST_F(PlatformAppleSimulatorTest, TestPlatformSelectionOrder) {
llvm::Triple::WatchOS,
};
- PlatformList list(*m_debugger_sp.get());
- list.GetOrCreate("remote-ios", /*metadata=*/nullptr);
- list.GetOrCreate("remote-tvos", /*metadata=*/nullptr);
- list.GetOrCreate("remote-watchos", /*metadata=*/nullptr);
+ PlatformList list;
+ list.GetOrCreate("remote-ios");
+ list.GetOrCreate("remote-tvos");
+ list.GetOrCreate("remote-watchos");
for (auto sim : sim_platforms) {
ArchSpec arch = platform_arch;
@@ -113,9 +89,7 @@ TEST_F(PlatformAppleSimulatorTest, TestPlatformSelectionOrder) {
arch.GetTriple().setEnvironment(llvm::Triple::Simulator);
Status error;
- auto platform_sp =
- list.GetOrCreate(arch, {}, /*platform_arch_ptr=*/nullptr, error,
- /*metadata=*/nullptr);
+ auto platform_sp = list.GetOrCreate(arch, {}, nullptr, error);
EXPECT_TRUE(platform_sp);
EXPECT_TRUE(platform_sp->GetName().contains("simulator"));
}
diff --git a/lldb/unittests/Platform/PlatformSiginfoTest.cpp b/lldb/unittests/Platform/PlatformSiginfoTest.cpp
index 071f58fda747c..54dbcb41beca3 100644
--- a/lldb/unittests/Platform/PlatformSiginfoTest.cpp
+++ b/lldb/unittests/Platform/PlatformSiginfoTest.cpp
@@ -82,19 +82,15 @@ class PlatformSiginfoTest : public ::testing::Test {
switch (arch.GetTriple().getOS()) {
case llvm::Triple::FreeBSD:
- platform_sp = platform_freebsd::PlatformFreeBSD::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr);
+ platform_sp =
+ platform_freebsd::PlatformFreeBSD::CreateInstance(true, &arch);
break;
case llvm::Triple::Linux:
- platform_sp = platform_linux::PlatformLinux::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr);
+ platform_sp = platform_linux::PlatformLinux::CreateInstance(true, &arch);
break;
case llvm::Triple::NetBSD:
- platform_sp = platform_netbsd::PlatformNetBSD::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr);
+ platform_sp =
+ platform_netbsd::PlatformNetBSD::CreateInstance(true, &arch);
break;
default:
llvm_unreachable("unknown ostype in triple");
diff --git a/lldb/unittests/Platform/PlatformTest.cpp b/lldb/unittests/Platform/PlatformTest.cpp
index bd0341b4b1943..8ab223ea2cd57 100644
--- a/lldb/unittests/Platform/PlatformTest.cpp
+++ b/lldb/unittests/Platform/PlatformTest.cpp
@@ -10,7 +10,6 @@
#include "Plugins/Platform/POSIX/PlatformPOSIX.h"
#include "TestingSupport/SubsystemRAII.h"
-#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
@@ -19,8 +18,6 @@
using namespace lldb;
using namespace lldb_private;
-static std::once_flag debugger_initialize_flag;
-
class TestPlatform : public PlatformPOSIX {
public:
TestPlatform() : PlatformPOSIX(false) {}
@@ -62,9 +59,7 @@ class PlatformThumb : public TestPlatform {
PluginManager::UnregisterPlugin(PlatformThumb::CreateInstance);
}
- static PlatformSP CreateInstance(bool force, const ArchSpec *arch,
- const Debugger *debugger,
- const ScriptedMetadata *metadata) {
+ static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
return std::make_shared<PlatformThumb>();
}
@@ -81,21 +76,12 @@ class PlatformTest : public ::testing::Test {
SubsystemRAII<FileSystem, HostInfo> subsystems;
protected:
- PlatformList *list = nullptr;
- DebuggerSP m_debugger_sp = nullptr;
-
- void SetUp() override {
- std::call_once(debugger_initialize_flag,
- []() { Debugger::Initialize(nullptr); });
- list = new PlatformList(*m_debugger_sp.get());
- }
-
- void TearDown() override { delete list; }
+ PlatformList list;
void SetHostPlatform(const PlatformSP &platform_sp) {
Platform::SetHostPlatform(platform_sp);
ASSERT_EQ(Platform::GetHostPlatform(), platform_sp);
- list->Append(platform_sp, /*set_selected=*/true);
+ list.Append(platform_sp, /*set_selected=*/true);
}
};
@@ -107,8 +93,7 @@ TEST_F(PlatformTest, GetPlatformForArchitecturesHost) {
std::vector<PlatformSP> candidates;
// The host platform matches all architectures.
- PlatformSP platform_sp =
- list->GetOrCreate(archs, {}, candidates, /*metadata=*/nullptr);
+ PlatformSP platform_sp = list.GetOrCreate(archs, {}, candidates);
ASSERT_TRUE(platform_sp);
EXPECT_EQ(platform_sp, Platform::GetHostPlatform());
}
@@ -121,14 +106,13 @@ TEST_F(PlatformTest, GetPlatformForArchitecturesSelected) {
std::vector<PlatformSP> candidates;
// The host platform matches no architectures.
- PlatformSP platform_sp =
- list->GetOrCreate(archs, {}, candidates, /*metadata=*/nullptr);
+ PlatformSP platform_sp = list.GetOrCreate(archs, {}, candidates);
ASSERT_FALSE(platform_sp);
// The selected platform matches all architectures.
const PlatformSP selected_platform_sp = std::make_shared<PlatformArm>();
- list->Append(selected_platform_sp, /*set_selected=*/true);
- platform_sp = list->GetOrCreate(archs, {}, candidates, /*metadata=*/nullptr);
+ list.Append(selected_platform_sp, /*set_selected=*/true);
+ platform_sp = list.GetOrCreate(archs, {}, candidates);
ASSERT_TRUE(platform_sp);
EXPECT_EQ(platform_sp, selected_platform_sp);
}
@@ -141,16 +125,15 @@ TEST_F(PlatformTest, GetPlatformForArchitecturesSelectedOverHost) {
std::vector<PlatformSP> candidates;
// The host platform matches one architecture.
- PlatformSP platform_sp =
- list->GetOrCreate(archs, {}, candidates, /*metadata=*/nullptr);
+ PlatformSP platform_sp = list.GetOrCreate(archs, {}, candidates);
ASSERT_TRUE(platform_sp);
EXPECT_EQ(platform_sp, Platform::GetHostPlatform());
// The selected and host platform each match one architecture.
// The selected platform is preferred.
const PlatformSP selected_platform_sp = std::make_shared<PlatformArm>();
- list->Append(selected_platform_sp, /*set_selected=*/true);
- platform_sp = list->GetOrCreate(archs, {}, candidates, /*metadata=*/nullptr);
+ list.Append(selected_platform_sp, /*set_selected=*/true);
+ platform_sp = list.GetOrCreate(archs, {}, candidates);
ASSERT_TRUE(platform_sp);
EXPECT_EQ(platform_sp, selected_platform_sp);
}
@@ -161,15 +144,14 @@ TEST_F(PlatformTest, GetPlatformForArchitecturesCandidates) {
SetHostPlatform(std::make_shared<PlatformIntel>());
const PlatformSP selected_platform_sp = std::make_shared<PlatformArm>();
- list->Append(selected_platform_sp, /*set_selected=*/true);
+ list.Append(selected_platform_sp, /*set_selected=*/true);
const std::vector<ArchSpec> archs = {ArchSpec("thumbv7-apple-ps4"),
ArchSpec("thumbv7f-apple-ps4")};
std::vector<PlatformSP> candidates;
// The host platform matches one architecture.
- PlatformSP platform_sp =
- list->GetOrCreate(archs, {}, candidates, /*metadata=*/nullptr);
+ PlatformSP platform_sp = list.GetOrCreate(archs, {}, candidates);
ASSERT_TRUE(platform_sp);
EXPECT_EQ(platform_sp->GetName(), "thumb");
diff --git a/lldb/unittests/Process/ProcessEventDataTest.cpp b/lldb/unittests/Process/ProcessEventDataTest.cpp
index eed008ede4213..dd159496cd881 100644
--- a/lldb/unittests/Process/ProcessEventDataTest.cpp
+++ b/lldb/unittests/Process/ProcessEventDataTest.cpp
@@ -142,9 +142,7 @@ ThreadSP CreateThread(ProcessSP &process_sp, bool should_stop,
TEST_F(ProcessEventDataTest, DoOnRemoval) {
ArchSpec arch("x86_64-apple-macosx-");
- Platform::SetHostPlatform(
- PlatformRemoteMacOSX::CreateInstance(true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
@@ -184,9 +182,7 @@ TEST_F(ProcessEventDataTest, DoOnRemoval) {
TEST_F(ProcessEventDataTest, ShouldStop) {
ArchSpec arch("x86_64-apple-macosx-");
- Platform::SetHostPlatform(
- PlatformRemoteMacOSX::CreateInstance(true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
diff --git a/lldb/unittests/Target/ExecutionContextTest.cpp b/lldb/unittests/Target/ExecutionContextTest.cpp
index 6b461b0d60432..cba32c21423e3 100644
--- a/lldb/unittests/Target/ExecutionContextTest.cpp
+++ b/lldb/unittests/Target/ExecutionContextTest.cpp
@@ -72,9 +72,8 @@ TEST_F(ExecutionContextTest, GetByteOrder) {
TEST_F(ExecutionContextTest, GetByteOrderTarget) {
ArchSpec arch("powerpc64-pc-linux");
- Platform::SetHostPlatform(platform_linux::PlatformLinux::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ Platform::SetHostPlatform(
+ platform_linux::PlatformLinux::CreateInstance(true, &arch));
DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
@@ -95,9 +94,8 @@ TEST_F(ExecutionContextTest, GetByteOrderTarget) {
TEST_F(ExecutionContextTest, GetByteOrderProcess) {
ArchSpec arch("powerpc64-pc-linux");
- Platform::SetHostPlatform(platform_linux::PlatformLinux::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ Platform::SetHostPlatform(
+ platform_linux::PlatformLinux::CreateInstance(true, &arch));
DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
diff --git a/lldb/unittests/Target/StackFrameRecognizerTest.cpp b/lldb/unittests/Target/StackFrameRecognizerTest.cpp
index 6f03b3bd9100f..695f091227d6a 100644
--- a/lldb/unittests/Target/StackFrameRecognizerTest.cpp
+++ b/lldb/unittests/Target/StackFrameRecognizerTest.cpp
@@ -32,9 +32,8 @@ class StackFrameRecognizerTest : public ::testing::Test {
// Pretend Linux is the host platform.
platform_linux::PlatformLinux::Initialize();
ArchSpec arch("powerpc64-pc-linux");
- Platform::SetHostPlatform(platform_linux::PlatformLinux::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ Platform::SetHostPlatform(
+ platform_linux::PlatformLinux::CreateInstance(true, &arch));
}
void TearDown() override {
diff --git a/lldb/unittests/Thread/ThreadTest.cpp b/lldb/unittests/Thread/ThreadTest.cpp
index 57aa3d7dd2be6..bd8cdce99f172 100644
--- a/lldb/unittests/Thread/ThreadTest.cpp
+++ b/lldb/unittests/Thread/ThreadTest.cpp
@@ -91,9 +91,8 @@ TargetSP CreateTarget(DebuggerSP &debugger_sp, ArchSpec &arch) {
TEST_F(ThreadTest, SetStopInfo) {
ArchSpec arch("powerpc64-pc-linux");
- Platform::SetHostPlatform(platform_linux::PlatformLinux::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ Platform::SetHostPlatform(
+ platform_linux::PlatformLinux::CreateInstance(true, &arch));
DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
@@ -127,9 +126,8 @@ TEST_F(ThreadTest, SetStopInfo) {
TEST_F(ThreadTest, GetPrivateStopInfo) {
ArchSpec arch("powerpc64-pc-linux");
- Platform::SetHostPlatform(platform_linux::PlatformLinux::CreateInstance(
- true, &arch, /*debugger=*/nullptr,
- /*metadata=*/nullptr));
+ Platform::SetHostPlatform(
+ platform_linux::PlatformLinux::CreateInstance(true, &arch));
DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
More information about the lldb-commits
mailing list