aboutsummaryrefslogtreecommitdiff
path: root/lldb/source
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2023-01-09 20:26:19 -0800
committerMed Ismail Bennani <medismail.bennani@gmail.com>2023-01-12 12:49:05 -0800
commit2d53527e9c64c70c24e1abba74fa0a8c8b3392b1 (patch)
tree9d629efec95e7633675765fa301768d60603e4cb /lldb/source
parent3fbc89048517e7152cce763db3b1e5738d558113 (diff)
downloadllvm-2d53527e9c64c70c24e1abba74fa0a8c8b3392b1.zip
llvm-2d53527e9c64c70c24e1abba74fa0a8c8b3392b1.tar.gz
llvm-2d53527e9c64c70c24e1abba74fa0a8c8b3392b1.tar.bz2
[lldb] Add Debugger & ScriptedMetadata reference to Platform::CreateInstance
This patch is preparatory work for Scripted Platform support and does multiple things: First, it introduces new options for the `platform select` command and `SBPlatform::Create` API, to hold a reference to the debugger object, the name of the python script managing the Scripted Platform and a structured data dictionary that the user can use to pass arbitrary data. Then, it updates the various `Create` and `GetOrCreate` methods for the `Platform` and `PlatformList` classes to pass down the new parameter to the `Platform::CreateInstance` callbacks. Finally, it updates every callback to reflect these changes. Differential Revision: https://reviews.llvm.org/D139249 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBDebugger.cpp3
-rw-r--r--lldb/source/API/SBPlatform.cpp29
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp91
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.h18
-rw-r--r--lldb/source/Core/Debugger.cpp2
-rw-r--r--lldb/source/Interpreter/OptionGroupPlatform.cpp8
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp2
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp4
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroid.h4
-rw-r--r--lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp5
-rw-r--r--lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h4
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp5
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.h4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp12
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp8
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp8
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h5
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h4
-rw-r--r--lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp5
-rw-r--r--lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h4
-rw-r--r--lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp5
-rw-r--r--lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h4
-rw-r--r--lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp3
-rw-r--r--lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp4
-rw-r--r--lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h4
-rw-r--r--lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp11
-rw-r--r--lldb/source/Plugins/Platform/Windows/PlatformWindows.h5
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp6
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h4
-rw-r--r--lldb/source/Target/Platform.cpp75
-rw-r--r--lldb/source/Target/Process.cpp3
-rw-r--r--lldb/source/Target/Target.cpp5
-rw-r--r--lldb/source/Target/TargetList.cpp19
45 files changed, 262 insertions, 167 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 851c80a..743e928 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -1498,7 +1498,8 @@ 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))
+ if (PlatformSP platform_sp = platforms.GetOrCreate(
+ platform_name_cstr, /*metadata = */ nullptr))
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 807d008..7ba9e72 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -7,13 +7,16 @@
//===----------------------------------------------------------------------===//
#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"
@@ -292,7 +295,31 @@ 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);
+ 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);
}
SBPlatform::SBPlatform(const SBPlatform &rhs) {
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index 69c44fe..610eb24 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -139,63 +139,58 @@ private:
};
// "platform select <platform-name>"
-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});
- }
+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});
+}
- ~CommandObjectPlatformSelect() override = default;
+void CommandObjectPlatformSelect::HandleCompletion(CompletionRequest &request) {
+ CommandCompletions::PlatformPluginNames(GetCommandInterpreter(), request,
+ nullptr);
+}
- void HandleCompletion(CompletionRequest &request) override {
- CommandCompletions::PlatformPluginNames(GetCommandInterpreter(), request,
- nullptr);
- }
+Options *CommandObjectPlatformSelect::GetOptions() { return &m_option_group; }
- Options *GetOptions() override { return &m_option_group; }
+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);
-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());
- }
+ platform_sp->GetStatus(result.GetOutputStream());
+ result.SetStatus(eReturnStatusSuccessFinishResult);
} else {
- result.AppendError("invalid platform name");
+ result.AppendError(error.AsCString());
}
} else {
- result.AppendError(
- "platform create takes a platform name as an argument\n");
+ result.AppendError("invalid platform name");
}
- return result.Succeeded();
+ } else {
+ result.AppendError(
+ "platform create takes a platform name as an argument\n");
}
-
- OptionGroupOptions m_option_group;
- OptionGroupPlatform m_platform_options;
-};
+ return result.Succeeded();
+}
// "platform list"
class CommandObjectPlatformList : public CommandObjectParsed {
diff --git a/lldb/source/Commands/CommandObjectPlatform.h b/lldb/source/Commands/CommandObjectPlatform.h
index 86f55c7..c721926 100644
--- a/lldb/source/Commands/CommandObjectPlatform.h
+++ b/lldb/source/Commands/CommandObjectPlatform.h
@@ -10,6 +10,7 @@
#define LLDB_SOURCE_COMMANDS_COMMANDOBJECTPLATFORM_H
#include "lldb/Interpreter/CommandObjectMultiword.h"
+#include "lldb/Interpreter/OptionGroupPlatform.h"
namespace lldb_private {
@@ -27,6 +28,23 @@ private:
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 8a8a01c..413328f 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(),
+ m_terminal_state(), m_target_list(*this), m_platform_list(*this),
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 60107eb..16daa12 100644
--- a/lldb/source/Interpreter/OptionGroupPlatform.cpp
+++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp
@@ -10,6 +10,7 @@
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptedMetadata.h"
#include "lldb/Target/Platform.h"
using namespace lldb;
@@ -22,8 +23,10 @@ PlatformSP OptionGroupPlatform::CreatePlatformWithOptions(
PlatformSP platform_sp;
+ const ScriptedMetadata metadata(m_class_options);
+
if (!m_platform_name.empty()) {
- platform_sp = platforms.Create(m_platform_name);
+ platform_sp = platforms.Create(m_platform_name, &metadata);
if (!platform_sp) {
error.SetErrorStringWithFormatv(
"unable to find a plug-in for the platform named \"{0}\"",
@@ -41,7 +44,8 @@ PlatformSP OptionGroupPlatform::CreatePlatformWithOptions(
}
}
} else if (arch.IsValid()) {
- platform_sp = platforms.GetOrCreate(arch, {}, &platform_arch, error);
+ platform_sp =
+ platforms.GetOrCreate(arch, {}, &platform_arch, error, &metadata);
}
if (platform_sp) {
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 09dd94d..c3cd286 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());
+ PlatformDarwinKernel::GetPluginNameStatic(), /*metadata = */ nullptr);
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 1afce4f..ef3e102 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -59,7 +59,9 @@ void PlatformAndroid::Terminate() {
PlatformLinux::Terminate();
}
-PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) {
+PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 1a66dde..38239861 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.h
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.h
@@ -28,7 +28,9 @@ public:
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
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 0c6831b..0321eba 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -44,8 +44,9 @@ LLDB_PLUGIN_DEFINE(PlatformFreeBSD)
static uint32_t g_initialize_count = 0;
-
-PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) {
+PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 1e92bb4..1bf3ba2 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -24,7 +24,9 @@ public:
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
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 bf226fa..c9c3608 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -41,8 +41,9 @@ LLDB_PLUGIN_DEFINE(PlatformLinux)
static uint32_t g_initialize_count = 0;
-
-PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) {
+PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 89f0bd7..7ac24d9 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -24,7 +24,9 @@ public:
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
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 1e117f2..4411b7c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
@@ -552,7 +552,9 @@ struct PlatformiOSSimulator {
PluginManager::UnregisterPlugin(PlatformiOSSimulator::CreateInstance);
}
- static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ static PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
if (shouldSkipSimulatorPlatform(force, arch))
return nullptr;
@@ -597,7 +599,9 @@ struct PlatformAppleTVSimulator {
PluginManager::UnregisterPlugin(PlatformAppleTVSimulator::CreateInstance);
}
- static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ static PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
if (shouldSkipSimulatorPlatform(force, arch))
return nullptr;
return PlatformAppleSimulator::CreateInstance(
@@ -639,7 +643,9 @@ struct PlatformAppleWatchSimulator {
PlatformAppleWatchSimulator::CreateInstance);
}
- static PlatformSP CreateInstance(bool force, const ArchSpec *arch) {
+ static PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 4f49e46..85a18f0 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -106,9 +106,11 @@ llvm::StringRef PlatformDarwin::GetDescriptionStatic() {
return "Darwin platform plug-in.";
}
-PlatformSP PlatformDarwin::CreateInstance(bool force, const ArchSpec *arch) {
- // We only create subclasses of the PlatformDarwin plugin.
- return PlatformSP();
+PlatformSP PlatformDarwin::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
+ // 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 4b564bb..782316c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -48,7 +48,9 @@ public:
~PlatformDarwin() override;
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
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 3c9cc8e..2f16b44 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -72,8 +72,10 @@ void PlatformDarwinKernel::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
- const ArchSpec *arch) {
+PlatformSP
+PlatformDarwinKernel::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
Log *log = GetLog(LLDBLog::Platform);
if (log) {
const char *arch_name;
@@ -968,7 +970,7 @@ bool PlatformDarwinKernel::LoadPlatformBinaryAndSetup(Process *process,
PlatformSP platform_sp =
process->GetTarget().GetDebugger().GetPlatformList().Create(
- PlatformDarwinKernel::GetPluginNameStatic());
+ PlatformDarwinKernel::GetPluginNameStatic(), /*metadata = */ nullptr);
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 1b0708c..61428ac46 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
@@ -36,7 +36,9 @@ class Stream;
class PlatformDarwinKernel : public PlatformDarwin {
public:
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
static void DebuggerInitialize(Debugger &debugger);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 25b821d..18f1936 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -90,7 +90,9 @@ llvm::StringRef PlatformMacOSX::GetDescriptionStatic() {
return "Local Mac OS X user platform plug-in.";
}
-PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch) {
+PlatformSP PlatformMacOSX::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
// 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 be84485..fb15a48 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
@@ -32,7 +32,9 @@ class PlatformMacOSX : public PlatformDarwinDevice {
public:
PlatformMacOSX();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
index 5515d76..29874b1 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp
@@ -56,8 +56,10 @@ void PlatformRemoteAppleBridge::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force,
- const ArchSpec *arch) {
+PlatformSP
+PlatformRemoteAppleBridge::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 91dd02c..804fdc0 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h
@@ -24,7 +24,9 @@ class PlatformRemoteAppleBridge : public PlatformRemoteDarwinDevice {
public:
PlatformRemoteAppleBridge();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
index 5b72969..ca87916 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
@@ -57,8 +57,10 @@ void PlatformRemoteAppleTV::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force,
- const ArchSpec *arch) {
+PlatformSP
+PlatformRemoteAppleTV::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 2962f19..c3ee6cc 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
@@ -26,8 +26,9 @@ public:
PlatformRemoteAppleTV();
// Class Functions
- static lldb::PlatformSP CreateInstance(bool force,
- const lldb_private::ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
index 7dc8b9b..5fc2268 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
@@ -54,8 +54,10 @@ void PlatformRemoteAppleWatch::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force,
- const ArchSpec *arch) {
+PlatformSP
+PlatformRemoteAppleWatch::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 20694f0..f36e6d2 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
@@ -22,7 +22,9 @@ class PlatformRemoteAppleWatch : public PlatformRemoteDarwinDevice {
public:
PlatformRemoteAppleWatch();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
index 460f6d8..bc67a7ec 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
@@ -57,8 +57,10 @@ void PlatformRemoteMacOSX::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP PlatformRemoteMacOSX::CreateInstance(bool force,
- const ArchSpec *arch) {
+PlatformSP
+PlatformRemoteMacOSX::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 17ae372..3b0505d 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
@@ -27,7 +27,9 @@ class PlatformRemoteMacOSX : public virtual PlatformRemoteDarwinDevice {
public:
PlatformRemoteMacOSX();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index d6f573b..9acc02c 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -52,7 +52,9 @@ void PlatformRemoteiOS::Terminate() {
PlatformDarwin::Terminate();
}
-PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) {
+PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 991bf1d..cdf12c4 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
@@ -22,7 +22,9 @@ class PlatformRemoteiOS : public PlatformRemoteDarwinDevice {
public:
PlatformRemoteiOS();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
static void Initialize();
diff --git a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
index 59bbc3f..8da4a7c 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
@@ -39,8 +39,9 @@ LLDB_PLUGIN_DEFINE(PlatformNetBSD)
static uint32_t g_initialize_count = 0;
-
-PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) {
+PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 3437d7e..17039b7 100644
--- a/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
+++ b/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
@@ -24,7 +24,9 @@ public:
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
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 3946092..4e6a812 100644
--- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
+++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp
@@ -39,8 +39,9 @@ LLDB_PLUGIN_DEFINE(PlatformOpenBSD)
static uint32_t g_initialize_count = 0;
-
-PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) {
+PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 fcdc035..3975773 100644
--- a/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
+++ b/lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h
@@ -23,7 +23,9 @@ public:
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
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 222dbfa..c91d876 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -310,7 +310,8 @@ Status PlatformPOSIX::ConnectRemote(Args &args) {
if (!m_remote_platform_sp)
m_remote_platform_sp =
platform_gdb_server::PlatformRemoteGDBServer::CreateInstance(
- /*force=*/true, nullptr);
+ /*force=*/true, /*arch=*/nullptr, /*debugger=*/nullptr,
+ /*metadata=*/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 4ba2011..89ffbf8 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -103,7 +103,9 @@ void PlatformQemuUser::DebuggerInitialize(Debugger &debugger) {
}
}
-PlatformSP PlatformQemuUser::CreateInstance(bool force, const ArchSpec *arch) {
+PlatformSP PlatformQemuUser::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 596cf75..eeb2f37 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
@@ -70,7 +70,9 @@ public:
}
private:
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
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 017318f..fb84fd5 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -41,8 +41,9 @@ LLDB_PLUGIN_DEFINE(PlatformWindows)
static uint32_t g_initialize_count = 0;
-PlatformSP PlatformWindows::CreateInstance(bool force,
- const lldb_private::ArchSpec *arch) {
+PlatformSP PlatformWindows::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
// The only time we create an instance is when we are creating a remote
// windows platform
const bool is_host = false;
@@ -137,10 +138,12 @@ 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, nullptr);
+ /*force=*/true, /*arch=*/nullptr, /*debugger=*/nullptr,
+ /*metadata=*/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 771133f..610b4b2f 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
@@ -22,8 +22,9 @@ public:
static void Terminate();
// lldb_private::PluginInterface functions
- static lldb::PlatformSP CreateInstance(bool force,
- const lldb_private::ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
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 0858a2a..8cd17f7 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -64,8 +64,10 @@ void PlatformRemoteGDBServer::Terminate() {
Platform::Terminate();
}
-PlatformSP PlatformRemoteGDBServer::CreateInstance(bool force,
- const ArchSpec *arch) {
+PlatformSP
+PlatformRemoteGDBServer::CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
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 638f7db..f1b90c0 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -26,7 +26,9 @@ public:
static void Terminate();
- static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
+ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch,
+ const Debugger *debugger,
+ const ScriptedMetadata *metadata);
static llvm::StringRef GetPluginNameStatic() { return "remote-gdb-server"; }
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 1ddd759..dfaa7f4 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -164,40 +164,6 @@ 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,
@@ -251,14 +217,15 @@ bool Platform::GetModuleSpec(const FileSpec &module_file_spec,
module_spec);
}
-PlatformSP Platform::Create(llvm::StringRef name) {
+PlatformSP Platform::Create(llvm::StringRef name, const Debugger *debugger,
+ const ScriptedMetadata *metadata) {
lldb::PlatformSP platform_sp;
if (name == GetHostPlatformName())
return GetHostPlatform();
if (PlatformCreateInstance create_callback =
PluginManager::GetPlatformCreateCallbackForPluginName(name))
- return create_callback(true, nullptr);
+ return create_callback(true, nullptr, debugger, metadata);
return nullptr;
}
@@ -1967,19 +1934,20 @@ Args Platform::GetExtraStartupCommands() {
return {};
}
-PlatformSP PlatformList::GetOrCreate(llvm::StringRef name) {
+PlatformSP PlatformList::GetOrCreate(llvm::StringRef name,
+ const ScriptedMetadata *metadata) {
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);
+ return Create(name, metadata);
}
PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
const ArchSpec &process_host_arch,
- ArchSpec *platform_arch_ptr,
- Status &error) {
+ ArchSpec *platform_arch_ptr, Status &error,
+ const ScriptedMetadata *metadata) {
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) {
@@ -2002,7 +1970,8 @@ PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
for (idx = 0;
(create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx));
++idx) {
- PlatformSP platform_sp = create_callback(false, &arch);
+ PlatformSP platform_sp =
+ create_callback(false, &arch, &m_debugger, metadata);
if (platform_sp &&
platform_sp->IsCompatibleArchitecture(
arch, process_host_arch, ArchSpec::ExactMatch, platform_arch_ptr)) {
@@ -2014,7 +1983,8 @@ PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
for (idx = 0;
(create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx));
++idx) {
- PlatformSP platform_sp = create_callback(false, &arch);
+ PlatformSP platform_sp =
+ create_callback(false, &arch, &m_debugger, metadata);
if (platform_sp && platform_sp->IsCompatibleArchitecture(
arch, process_host_arch, ArchSpec::CompatibleMatch,
platform_arch_ptr)) {
@@ -2029,16 +1999,19 @@ PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
PlatformSP PlatformList::GetOrCreate(const ArchSpec &arch,
const ArchSpec &process_host_arch,
- ArchSpec *platform_arch_ptr) {
+ ArchSpec *platform_arch_ptr,
+ const ScriptedMetadata *metadata) {
Status error;
if (arch.IsValid())
- return GetOrCreate(arch, process_host_arch, platform_arch_ptr, error);
+ return GetOrCreate(arch, process_host_arch, platform_arch_ptr, error,
+ metadata);
return nullptr;
}
PlatformSP PlatformList::GetOrCreate(llvm::ArrayRef<ArchSpec> archs,
const ArchSpec &process_host_arch,
- std::vector<PlatformSP> &candidates) {
+ std::vector<PlatformSP> &candidates,
+ const ScriptedMetadata *metadata) {
candidates.clear();
candidates.reserve(archs.size());
@@ -2067,7 +2040,9 @@ 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, nullptr))
+ if (PlatformSP platform = GetOrCreate(arch, process_host_arch,
+ /*platform_arch_ptr = */ nullptr,
+ /*metadata = */ nullptr))
candidates.push_back(platform);
}
@@ -2088,9 +2063,10 @@ PlatformSP PlatformList::GetOrCreate(llvm::ArrayRef<ArchSpec> archs,
return nullptr;
}
-PlatformSP PlatformList::Create(llvm::StringRef name) {
+PlatformSP PlatformList::Create(llvm::StringRef name,
+ const ScriptedMetadata *metadata) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- PlatformSP platform_sp = Platform::Create(name);
+ PlatformSP platform_sp = Platform::Create(name, &m_debugger, metadata);
m_platforms.push_back(platform_sp);
return platform_sp;
}
@@ -2104,7 +2080,8 @@ bool PlatformList::LoadPlatformBinaryAndSetup(Process *process,
(create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx));
++idx) {
ArchSpec arch;
- PlatformSP platform_sp = create_callback(true, &arch);
+ PlatformSP platform_sp =
+ create_callback(true, &arch, &m_debugger, /*metadata = */ nullptr);
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 e0cca05..f30a8a0 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2931,7 +2931,8 @@ void Process::CompleteAttach() {
ArchSpec::CompatibleMatch, nullptr)) {
ArchSpec platform_arch;
platform_sp = GetTarget().GetDebugger().GetPlatformList().GetOrCreate(
- target_arch, process_host_arch, &platform_arch);
+ target_arch, process_host_arch, &platform_arch,
+ /*metadata = */ nullptr);
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 fd0cf0a..985f3f3 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1503,8 +1503,9 @@ 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, {},
- &platform_arch)) {
+ GetDebugger().GetPlatformList().GetOrCreate(
+ other, /*process_host_arch = */ {}, &platform_arch,
+ /*metadata = */ nullptr)) {
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 8ce2ae8c..665243b 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -184,8 +184,9 @@ 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, {}, candidates)) {
+ if (PlatformSP platform_for_archs_sp = platform_list.GetOrCreate(
+ archs, /*process_host_arch = */ {}, candidates,
+ /*metadata = */ nullptr)) {
platform_sp = platform_for_archs_sp;
} else if (candidates.empty()) {
error.SetErrorString("no matching platforms found for this file");
@@ -218,7 +219,9 @@ Status TargetList::CreateTargetInternal(
if (!prefer_platform_arch && arch.IsValid()) {
if (!platform_sp->IsCompatibleArchitecture(
arch, {}, ArchSpec::CompatibleMatch, nullptr)) {
- platform_sp = platform_list.GetOrCreate(arch, {}, &platform_arch);
+ platform_sp =
+ platform_list.GetOrCreate(arch, /*process_host_arch = */ {},
+ &platform_arch, /*metadata = */ nullptr);
if (platform_sp)
platform_list.SetSelectedPlatform(platform_sp);
}
@@ -228,8 +231,9 @@ Status TargetList::CreateTargetInternal(
ArchSpec fixed_platform_arch;
if (!platform_sp->IsCompatibleArchitecture(
platform_arch, {}, ArchSpec::CompatibleMatch, nullptr)) {
- platform_sp =
- platform_list.GetOrCreate(platform_arch, {}, &fixed_platform_arch);
+ platform_sp = platform_list.GetOrCreate(
+ platform_arch, /*process_host_arch = */ {}, &fixed_platform_arch,
+ /*metadata = */ nullptr);
if (platform_sp)
platform_list.SetSelectedPlatform(platform_sp);
}
@@ -260,8 +264,9 @@ 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, {}, &arch);
+ platform_sp = debugger.GetPlatformList().GetOrCreate(
+ specified_arch, /*process_host_arch = */ {}, &arch,
+ /*metadata = */ nullptr);
}
if (!platform_sp)