[lldb] Remove ConstString from Platform plugin names
This commit is contained in:
@@ -211,7 +211,7 @@ public:
|
||||
|
||||
// Platform
|
||||
static bool
|
||||
RegisterPlugin(ConstString name, const char *description,
|
||||
RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
|
||||
PlatformCreateInstance create_callback,
|
||||
DebuggerInitializeCallback debugger_init_callback = nullptr);
|
||||
|
||||
@@ -220,11 +220,11 @@ public:
|
||||
static PlatformCreateInstance GetPlatformCreateCallbackAtIndex(uint32_t idx);
|
||||
|
||||
static PlatformCreateInstance
|
||||
GetPlatformCreateCallbackForPluginName(ConstString name);
|
||||
GetPlatformCreateCallbackForPluginName(llvm::StringRef name);
|
||||
|
||||
static const char *GetPlatformPluginNameAtIndex(uint32_t idx);
|
||||
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx);
|
||||
|
||||
static const char *GetPlatformPluginDescriptionAtIndex(uint32_t idx);
|
||||
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx);
|
||||
|
||||
static void AutoCompletePlatformName(llvm::StringRef partial_name,
|
||||
CompletionRequest &request);
|
||||
|
||||
@@ -223,7 +223,7 @@ public:
|
||||
|
||||
virtual ConstString GetFullNameForDylib(ConstString basename);
|
||||
|
||||
virtual const char *GetDescription() = 0;
|
||||
virtual llvm::StringRef GetDescription() = 0;
|
||||
|
||||
/// Report the current status for this platform.
|
||||
///
|
||||
|
||||
@@ -1114,7 +1114,7 @@ uint32_t SBDebugger::GetNumAvailablePlatforms() {
|
||||
|
||||
uint32_t idx = 0;
|
||||
while (true) {
|
||||
if (!PluginManager::GetPlatformPluginNameAtIndex(idx)) {
|
||||
if (PluginManager::GetPlatformPluginNameAtIndex(idx).empty()) {
|
||||
break;
|
||||
}
|
||||
++idx;
|
||||
@@ -1137,18 +1137,15 @@ SBStructuredData SBDebugger::GetAvailablePlatformInfoAtIndex(uint32_t idx) {
|
||||
platform_dict->AddStringItem(
|
||||
desc_str, llvm::StringRef(host_platform_sp->GetDescription()));
|
||||
} else if (idx > 0) {
|
||||
const char *plugin_name =
|
||||
llvm::StringRef plugin_name =
|
||||
PluginManager::GetPlatformPluginNameAtIndex(idx - 1);
|
||||
if (!plugin_name) {
|
||||
if (plugin_name.empty()) {
|
||||
return LLDB_RECORD_RESULT(data);
|
||||
}
|
||||
platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name));
|
||||
|
||||
const char *plugin_desc =
|
||||
llvm::StringRef plugin_desc =
|
||||
PluginManager::GetPlatformPluginDescriptionAtIndex(idx - 1);
|
||||
if (!plugin_desc) {
|
||||
return LLDB_RECORD_RESULT(data);
|
||||
}
|
||||
platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc));
|
||||
}
|
||||
|
||||
|
||||
@@ -216,15 +216,13 @@ protected:
|
||||
|
||||
uint32_t idx;
|
||||
for (idx = 0; true; ++idx) {
|
||||
const char *plugin_name =
|
||||
llvm::StringRef plugin_name =
|
||||
PluginManager::GetPlatformPluginNameAtIndex(idx);
|
||||
if (plugin_name == nullptr)
|
||||
if (plugin_name.empty())
|
||||
break;
|
||||
const char *plugin_desc =
|
||||
llvm::StringRef plugin_desc =
|
||||
PluginManager::GetPlatformPluginDescriptionAtIndex(idx);
|
||||
if (plugin_desc == nullptr)
|
||||
break;
|
||||
ostrm.Printf("%s: %s\n", plugin_name, plugin_desc);
|
||||
ostrm.Format("{0}: {1}\n", plugin_name, plugin_desc);
|
||||
}
|
||||
|
||||
if (idx == 0) {
|
||||
|
||||
@@ -1642,8 +1642,10 @@ public:
|
||||
std::vector<std::string> GetPossiblePluginNames() {
|
||||
std::vector<std::string> names;
|
||||
size_t i = 0;
|
||||
while (auto name = PluginManager::GetPlatformPluginNameAtIndex(i++))
|
||||
names.push_back(name);
|
||||
for (llvm::StringRef name =
|
||||
PluginManager::GetPlatformPluginNameAtIndex(i++);
|
||||
!name.empty(); name = PluginManager::GetProcessPluginNameAtIndex(i++))
|
||||
names.push_back(name.str());
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
@@ -778,22 +778,24 @@ static PlatformInstances &GetPlatformInstances() {
|
||||
}
|
||||
|
||||
bool PluginManager::RegisterPlugin(
|
||||
ConstString name, const char *description,
|
||||
llvm::StringRef name, llvm::StringRef description,
|
||||
PlatformCreateInstance create_callback,
|
||||
DebuggerInitializeCallback debugger_init_callback) {
|
||||
return GetPlatformInstances().RegisterPlugin(
|
||||
name, description, create_callback, debugger_init_callback);
|
||||
ConstString(name), description.str().c_str(), create_callback,
|
||||
debugger_init_callback);
|
||||
}
|
||||
|
||||
bool PluginManager::UnregisterPlugin(PlatformCreateInstance create_callback) {
|
||||
return GetPlatformInstances().UnregisterPlugin(create_callback);
|
||||
}
|
||||
|
||||
const char *PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
|
||||
llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
|
||||
return GetPlatformInstances().GetNameAtIndex(idx);
|
||||
}
|
||||
|
||||
const char *PluginManager::GetPlatformPluginDescriptionAtIndex(uint32_t idx) {
|
||||
llvm::StringRef
|
||||
PluginManager::GetPlatformPluginDescriptionAtIndex(uint32_t idx) {
|
||||
return GetPlatformInstances().GetDescriptionAtIndex(idx);
|
||||
}
|
||||
|
||||
@@ -803,8 +805,8 @@ PluginManager::GetPlatformCreateCallbackAtIndex(uint32_t idx) {
|
||||
}
|
||||
|
||||
PlatformCreateInstance
|
||||
PluginManager::GetPlatformCreateCallbackForPluginName(ConstString name) {
|
||||
return GetPlatformInstances().GetCallbackForName(name);
|
||||
PluginManager::GetPlatformCreateCallbackForPluginName(llvm::StringRef name) {
|
||||
return GetPlatformInstances().GetCallbackForName(ConstString(name));
|
||||
}
|
||||
|
||||
void PluginManager::AutoCompletePlatformName(llvm::StringRef name,
|
||||
|
||||
@@ -510,8 +510,8 @@ DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel(Process *process,
|
||||
m_kext_summary_header(), m_known_kexts(), m_mutex(),
|
||||
m_break_id(LLDB_INVALID_BREAK_ID) {
|
||||
Status error;
|
||||
PlatformSP platform_sp(
|
||||
Platform::Create(PlatformDarwinKernel::GetPluginNameStatic(), error));
|
||||
PlatformSP platform_sp(Platform::Create(
|
||||
ConstString(PlatformDarwinKernel::GetPluginNameStatic()), error));
|
||||
if (platform_sp.get())
|
||||
process->GetTarget().SetPlatform(platform_sp);
|
||||
}
|
||||
|
||||
@@ -129,21 +129,10 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) {
|
||||
PlatformAndroid::PlatformAndroid(bool is_host)
|
||||
: PlatformLinux(is_host), m_sdk_version(0) {}
|
||||
|
||||
ConstString PlatformAndroid::GetPluginNameStatic(bool is_host) {
|
||||
if (is_host) {
|
||||
static ConstString g_host_name(Platform::GetHostPlatformName());
|
||||
return g_host_name;
|
||||
} else {
|
||||
static ConstString g_remote_name("remote-android");
|
||||
return g_remote_name;
|
||||
}
|
||||
}
|
||||
|
||||
const char *PlatformAndroid::GetPluginDescriptionStatic(bool is_host) {
|
||||
llvm::StringRef PlatformAndroid::GetPluginDescriptionStatic(bool is_host) {
|
||||
if (is_host)
|
||||
return "Local Android user platform plug-in.";
|
||||
else
|
||||
return "Remote Android user platform plug-in.";
|
||||
return "Remote Android user platform plug-in.";
|
||||
}
|
||||
|
||||
Status PlatformAndroid::ConnectRemote(Args &args) {
|
||||
|
||||
@@ -30,12 +30,14 @@ public:
|
||||
// lldb_private::PluginInterface functions
|
||||
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
|
||||
|
||||
static ConstString GetPluginNameStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginNameStatic(bool is_host) {
|
||||
return is_host ? Platform::GetHostPlatformName() : "remote-android";
|
||||
}
|
||||
|
||||
static const char *GetPluginDescriptionStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
|
||||
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic(IsHost()).GetStringRef();
|
||||
return GetPluginNameStatic(IsHost());
|
||||
}
|
||||
|
||||
// lldb_private::Platform functions
|
||||
|
||||
@@ -76,21 +76,10 @@ PlatformSP PlatformFreeBSD::CreateInstance(bool force, const ArchSpec *arch) {
|
||||
return PlatformSP();
|
||||
}
|
||||
|
||||
ConstString PlatformFreeBSD::GetPluginNameStatic(bool is_host) {
|
||||
if (is_host) {
|
||||
static ConstString g_host_name(Platform::GetHostPlatformName());
|
||||
return g_host_name;
|
||||
} else {
|
||||
static ConstString g_remote_name("remote-freebsd");
|
||||
return g_remote_name;
|
||||
}
|
||||
}
|
||||
|
||||
const char *PlatformFreeBSD::GetPluginDescriptionStatic(bool is_host) {
|
||||
llvm::StringRef PlatformFreeBSD::GetPluginDescriptionStatic(bool is_host) {
|
||||
if (is_host)
|
||||
return "Local FreeBSD user platform plug-in.";
|
||||
else
|
||||
return "Remote FreeBSD user platform plug-in.";
|
||||
return "Remote FreeBSD user platform plug-in.";
|
||||
}
|
||||
|
||||
void PlatformFreeBSD::Initialize() {
|
||||
|
||||
@@ -25,16 +25,18 @@ public:
|
||||
// lldb_private::PluginInterface functions
|
||||
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
|
||||
|
||||
static ConstString GetPluginNameStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginNameStatic(bool is_host) {
|
||||
return is_host ? Platform::GetHostPlatformName() : "remote-freebsd";
|
||||
}
|
||||
|
||||
static const char *GetPluginDescriptionStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
|
||||
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic(IsHost()).GetStringRef();
|
||||
return GetPluginNameStatic(IsHost());
|
||||
}
|
||||
|
||||
// lldb_private::Platform functions
|
||||
const char *GetDescription() override {
|
||||
llvm::StringRef GetDescription() override {
|
||||
return GetPluginDescriptionStatic(IsHost());
|
||||
}
|
||||
|
||||
|
||||
@@ -72,21 +72,10 @@ PlatformSP PlatformLinux::CreateInstance(bool force, const ArchSpec *arch) {
|
||||
return PlatformSP();
|
||||
}
|
||||
|
||||
ConstString PlatformLinux::GetPluginNameStatic(bool is_host) {
|
||||
if (is_host) {
|
||||
static ConstString g_host_name(Platform::GetHostPlatformName());
|
||||
return g_host_name;
|
||||
} else {
|
||||
static ConstString g_remote_name("remote-linux");
|
||||
return g_remote_name;
|
||||
}
|
||||
}
|
||||
|
||||
const char *PlatformLinux::GetPluginDescriptionStatic(bool is_host) {
|
||||
llvm::StringRef PlatformLinux::GetPluginDescriptionStatic(bool is_host) {
|
||||
if (is_host)
|
||||
return "Local Linux user platform plug-in.";
|
||||
else
|
||||
return "Remote Linux user platform plug-in.";
|
||||
return "Remote Linux user platform plug-in.";
|
||||
}
|
||||
|
||||
void PlatformLinux::Initialize() {
|
||||
|
||||
@@ -25,16 +25,18 @@ public:
|
||||
// lldb_private::PluginInterface functions
|
||||
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
|
||||
|
||||
static ConstString GetPluginNameStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginNameStatic(bool is_host) {
|
||||
return is_host ? Platform::GetHostPlatformName() : "remote-linux";
|
||||
}
|
||||
|
||||
static const char *GetPluginDescriptionStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
|
||||
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic(IsHost()).GetStringRef();
|
||||
return GetPluginNameStatic(IsHost());
|
||||
}
|
||||
|
||||
// lldb_private::Platform functions
|
||||
const char *GetDescription() override {
|
||||
llvm::StringRef GetDescription() override {
|
||||
return GetPluginDescriptionStatic(IsHost());
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return m_plugin_name.GetStringRef();
|
||||
}
|
||||
const char *GetDescription() override { return m_description; }
|
||||
llvm::StringRef GetDescription() override { return m_description; }
|
||||
|
||||
lldb_private::Status
|
||||
LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override;
|
||||
|
||||
@@ -166,12 +166,7 @@ PlatformSP PlatformDarwinKernel::CreateInstance(bool force,
|
||||
return PlatformSP();
|
||||
}
|
||||
|
||||
lldb_private::ConstString PlatformDarwinKernel::GetPluginNameStatic() {
|
||||
static ConstString g_name("darwin-kernel");
|
||||
return g_name;
|
||||
}
|
||||
|
||||
const char *PlatformDarwinKernel::GetDescriptionStatic() {
|
||||
llvm::StringRef PlatformDarwinKernel::GetDescriptionStatic() {
|
||||
return "Darwin Kernel platform plug-in.";
|
||||
}
|
||||
|
||||
@@ -943,19 +938,4 @@ void PlatformDarwinKernel::CalculateTrapHandlerSymbolNames() {
|
||||
m_trap_handlers.push_back(ConstString("fleh_dec"));
|
||||
}
|
||||
|
||||
#else // __APPLE__
|
||||
|
||||
// Since DynamicLoaderDarwinKernel is compiled in for all systems, and relies
|
||||
// on PlatformDarwinKernel for the plug-in name, we compile just the plug-in
|
||||
// name in here to avoid issues. We are tracking an internal bug to resolve
|
||||
// this issue by either not compiling in DynamicLoaderDarwinKernel for non-
|
||||
// apple builds, or to make PlatformDarwinKernel build on all systems.
|
||||
// PlatformDarwinKernel is currently not compiled on other platforms due to the
|
||||
// use of the Mac-specific source/Host/macosx/cfcpp utilities.
|
||||
|
||||
lldb_private::ConstString PlatformDarwinKernel::GetPluginNameStatic() {
|
||||
static lldb_private::ConstString g_name("darwin-kernel");
|
||||
return g_name;
|
||||
}
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
@@ -32,9 +32,9 @@ public:
|
||||
|
||||
static void Terminate();
|
||||
|
||||
static lldb_private::ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() { return "darwin-kernel"; }
|
||||
|
||||
static const char *GetDescriptionStatic();
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
// Class Methods
|
||||
PlatformDarwinKernel(lldb_private::LazyBool is_ios_debug_session);
|
||||
@@ -42,12 +42,10 @@ public:
|
||||
virtual ~PlatformDarwinKernel();
|
||||
|
||||
// lldb_private::PluginInterface functions
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic().GetStringRef();
|
||||
}
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
// lldb_private::Platform functions
|
||||
const char *GetDescription() override { return GetDescriptionStatic(); }
|
||||
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
|
||||
|
||||
void GetStatus(lldb_private::Stream &strm) override;
|
||||
|
||||
@@ -221,7 +219,7 @@ public:
|
||||
|
||||
class PlatformDarwinKernel {
|
||||
public:
|
||||
static lldb_private::ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() { return "darwin-kernel"; }
|
||||
};
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
@@ -85,12 +85,7 @@ void PlatformMacOSX::Terminate() {
|
||||
PlatformDarwin::Terminate();
|
||||
}
|
||||
|
||||
lldb_private::ConstString PlatformMacOSX::GetPluginNameStatic() {
|
||||
static ConstString g_host_name(Platform::GetHostPlatformName());
|
||||
return g_host_name;
|
||||
}
|
||||
|
||||
const char *PlatformMacOSX::GetDescriptionStatic() {
|
||||
llvm::StringRef PlatformMacOSX::GetDescriptionStatic() {
|
||||
return "Local Mac OS X user platform plug-in.";
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,14 @@ public:
|
||||
|
||||
static void Terminate();
|
||||
|
||||
static lldb_private::ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() {
|
||||
return Platform::GetHostPlatformName();
|
||||
}
|
||||
|
||||
static const char *GetDescriptionStatic();
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
// lldb_private::PluginInterface functions
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic().GetStringRef();
|
||||
}
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
lldb_private::Status
|
||||
GetSharedModule(const lldb_private::ModuleSpec &module_spec,
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
|
||||
bool *did_create_ptr) override;
|
||||
|
||||
const char *GetDescription() override { return GetDescriptionStatic(); }
|
||||
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
|
||||
|
||||
lldb_private::Status
|
||||
GetFile(const lldb_private::FileSpec &source,
|
||||
|
||||
@@ -133,12 +133,7 @@ PlatformSP PlatformRemoteAppleBridge::CreateInstance(bool force,
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
||||
lldb_private::ConstString PlatformRemoteAppleBridge::GetPluginNameStatic() {
|
||||
static ConstString g_name("remote-bridgeos");
|
||||
return g_name;
|
||||
}
|
||||
|
||||
const char *PlatformRemoteAppleBridge::GetDescriptionStatic() {
|
||||
llvm::StringRef PlatformRemoteAppleBridge::GetDescriptionStatic() {
|
||||
return "Remote BridgeOS platform plug-in.";
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,16 @@ public:
|
||||
|
||||
static void Terminate();
|
||||
|
||||
static lldb_private::ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() { return "remote-bridgeos"; }
|
||||
|
||||
static const char *GetDescriptionStatic();
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
// lldb_private::PluginInterface functions
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic().GetStringRef();
|
||||
}
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
// lldb_private::Platform functions
|
||||
|
||||
const char *GetDescription() override { return GetDescriptionStatic(); }
|
||||
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
|
||||
|
||||
bool GetSupportedArchitectureAtIndex(uint32_t idx,
|
||||
lldb_private::ArchSpec &arch) override;
|
||||
|
||||
@@ -128,12 +128,7 @@ PlatformSP PlatformRemoteAppleTV::CreateInstance(bool force,
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
||||
lldb_private::ConstString PlatformRemoteAppleTV::GetPluginNameStatic() {
|
||||
static ConstString g_name("remote-tvos");
|
||||
return g_name;
|
||||
}
|
||||
|
||||
const char *PlatformRemoteAppleTV::GetDescriptionStatic() {
|
||||
llvm::StringRef PlatformRemoteAppleTV::GetDescriptionStatic() {
|
||||
return "Remote Apple TV platform plug-in.";
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,16 @@ public:
|
||||
|
||||
static void Terminate();
|
||||
|
||||
static lldb_private::ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() { return "remote-tvos"; }
|
||||
|
||||
static const char *GetDescriptionStatic();
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
// lldb_private::PluginInterface functions
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic().GetStringRef();
|
||||
}
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
// lldb_private::Platform functions
|
||||
|
||||
const char *GetDescription() override { return GetDescriptionStatic(); }
|
||||
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
|
||||
|
||||
bool GetSupportedArchitectureAtIndex(uint32_t idx,
|
||||
lldb_private::ArchSpec &arch) override;
|
||||
|
||||
@@ -135,12 +135,7 @@ PlatformSP PlatformRemoteAppleWatch::CreateInstance(bool force,
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
||||
lldb_private::ConstString PlatformRemoteAppleWatch::GetPluginNameStatic() {
|
||||
static ConstString g_name("remote-watchos");
|
||||
return g_name;
|
||||
}
|
||||
|
||||
const char *PlatformRemoteAppleWatch::GetDescriptionStatic() {
|
||||
llvm::StringRef PlatformRemoteAppleWatch::GetDescriptionStatic() {
|
||||
return "Remote Apple Watch platform plug-in.";
|
||||
}
|
||||
|
||||
|
||||
@@ -30,18 +30,16 @@ public:
|
||||
|
||||
static void Terminate();
|
||||
|
||||
static lldb_private::ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() { return "remote-watchos"; }
|
||||
|
||||
static const char *GetDescriptionStatic();
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
// lldb_private::Platform functions
|
||||
|
||||
const char *GetDescription() override { return GetDescriptionStatic(); }
|
||||
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
|
||||
|
||||
// lldb_private::PluginInterface functions
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic().GetStringRef();
|
||||
}
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
// lldb_private::Platform functions
|
||||
|
||||
|
||||
@@ -201,12 +201,7 @@ lldb_private::Status PlatformRemoteMacOSX::GetFileWithUUID(
|
||||
return Status();
|
||||
}
|
||||
|
||||
lldb_private::ConstString PlatformRemoteMacOSX::GetPluginNameStatic() {
|
||||
static ConstString g_name("remote-macosx");
|
||||
return g_name;
|
||||
}
|
||||
|
||||
const char *PlatformRemoteMacOSX::GetDescriptionStatic() {
|
||||
llvm::StringRef PlatformRemoteMacOSX::GetDescriptionStatic() {
|
||||
return "Remote Mac OS X user platform plug-in.";
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,13 @@ public:
|
||||
|
||||
static void Terminate();
|
||||
|
||||
static lldb_private::ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() { return "remote-macosx"; }
|
||||
|
||||
static const char *GetDescriptionStatic();
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic().GetStringRef();
|
||||
}
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
const char *GetDescription() override { return GetDescriptionStatic(); }
|
||||
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
|
||||
|
||||
lldb_private::Status
|
||||
GetFileWithUUID(const lldb_private::FileSpec &platform_file,
|
||||
|
||||
@@ -125,12 +125,7 @@ PlatformSP PlatformRemoteiOS::CreateInstance(bool force, const ArchSpec *arch) {
|
||||
return lldb::PlatformSP();
|
||||
}
|
||||
|
||||
lldb_private::ConstString PlatformRemoteiOS::GetPluginNameStatic() {
|
||||
static ConstString g_name("remote-ios");
|
||||
return g_name;
|
||||
}
|
||||
|
||||
const char *PlatformRemoteiOS::GetDescriptionStatic() {
|
||||
llvm::StringRef PlatformRemoteiOS::GetDescriptionStatic() {
|
||||
return "Remote iOS platform plug-in.";
|
||||
}
|
||||
|
||||
|
||||
@@ -28,18 +28,16 @@ public:
|
||||
|
||||
static void Terminate();
|
||||
|
||||
static lldb_private::ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() { return "remote-ios"; }
|
||||
|
||||
static const char *GetDescriptionStatic();
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
// lldb_private::Platform functions
|
||||
|
||||
const char *GetDescription() override { return GetDescriptionStatic(); }
|
||||
llvm::StringRef GetDescription() override { return GetDescriptionStatic(); }
|
||||
|
||||
// lldb_private::PluginInterface functions
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic().GetStringRef();
|
||||
}
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
bool GetSupportedArchitectureAtIndex(uint32_t idx,
|
||||
lldb_private::ArchSpec &arch) override;
|
||||
|
||||
@@ -65,21 +65,10 @@ PlatformSP PlatformNetBSD::CreateInstance(bool force, const ArchSpec *arch) {
|
||||
return PlatformSP();
|
||||
}
|
||||
|
||||
ConstString PlatformNetBSD::GetPluginNameStatic(bool is_host) {
|
||||
if (is_host) {
|
||||
static ConstString g_host_name(Platform::GetHostPlatformName());
|
||||
return g_host_name;
|
||||
} else {
|
||||
static ConstString g_remote_name("remote-netbsd");
|
||||
return g_remote_name;
|
||||
}
|
||||
}
|
||||
|
||||
const char *PlatformNetBSD::GetPluginDescriptionStatic(bool is_host) {
|
||||
llvm::StringRef PlatformNetBSD::GetPluginDescriptionStatic(bool is_host) {
|
||||
if (is_host)
|
||||
return "Local NetBSD user platform plug-in.";
|
||||
else
|
||||
return "Remote NetBSD user platform plug-in.";
|
||||
return "Remote NetBSD user platform plug-in.";
|
||||
}
|
||||
|
||||
void PlatformNetBSD::Initialize() {
|
||||
|
||||
@@ -25,16 +25,18 @@ public:
|
||||
// lldb_private::PluginInterface functions
|
||||
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
|
||||
|
||||
static ConstString GetPluginNameStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginNameStatic(bool is_host) {
|
||||
return is_host ? Platform::GetHostPlatformName() : "remote-netbsd";
|
||||
}
|
||||
|
||||
static const char *GetPluginDescriptionStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
|
||||
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic(IsHost()).GetStringRef();
|
||||
return GetPluginNameStatic(IsHost());
|
||||
}
|
||||
|
||||
// lldb_private::Platform functions
|
||||
const char *GetDescription() override {
|
||||
llvm::StringRef GetDescription() override {
|
||||
return GetPluginDescriptionStatic(IsHost());
|
||||
}
|
||||
|
||||
|
||||
@@ -71,21 +71,10 @@ PlatformSP PlatformOpenBSD::CreateInstance(bool force, const ArchSpec *arch) {
|
||||
return PlatformSP();
|
||||
}
|
||||
|
||||
ConstString PlatformOpenBSD::GetPluginNameStatic(bool is_host) {
|
||||
if (is_host) {
|
||||
static ConstString g_host_name(Platform::GetHostPlatformName());
|
||||
return g_host_name;
|
||||
} else {
|
||||
static ConstString g_remote_name("remote-openbsd");
|
||||
return g_remote_name;
|
||||
}
|
||||
}
|
||||
|
||||
const char *PlatformOpenBSD::GetPluginDescriptionStatic(bool is_host) {
|
||||
llvm::StringRef PlatformOpenBSD::GetPluginDescriptionStatic(bool is_host) {
|
||||
if (is_host)
|
||||
return "Local OpenBSD user platform plug-in.";
|
||||
else
|
||||
return "Remote OpenBSD user platform plug-in.";
|
||||
return "Remote OpenBSD user platform plug-in.";
|
||||
}
|
||||
|
||||
void PlatformOpenBSD::Initialize() {
|
||||
|
||||
@@ -25,16 +25,18 @@ public:
|
||||
// lldb_private::PluginInterface functions
|
||||
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
|
||||
|
||||
static ConstString GetPluginNameStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginNameStatic(bool is_host) {
|
||||
return is_host ? Platform::GetHostPlatformName() : "remote-openbsd";
|
||||
}
|
||||
|
||||
static const char *GetPluginDescriptionStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
|
||||
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic(IsHost()).GetStringRef();
|
||||
return GetPluginNameStatic(IsHost());
|
||||
}
|
||||
|
||||
// lldb_private::Platform functions
|
||||
const char *GetDescription() override {
|
||||
llvm::StringRef GetDescription() override {
|
||||
return GetPluginDescriptionStatic(IsHost());
|
||||
}
|
||||
|
||||
|
||||
@@ -101,17 +101,7 @@ PlatformSP PlatformWindows::CreateInstance(bool force,
|
||||
return PlatformSP();
|
||||
}
|
||||
|
||||
lldb_private::ConstString PlatformWindows::GetPluginNameStatic(bool is_host) {
|
||||
if (is_host) {
|
||||
static ConstString g_host_name(Platform::GetHostPlatformName());
|
||||
return g_host_name;
|
||||
} else {
|
||||
static ConstString g_remote_name("remote-windows");
|
||||
return g_remote_name;
|
||||
}
|
||||
}
|
||||
|
||||
const char *PlatformWindows::GetPluginDescriptionStatic(bool is_host) {
|
||||
llvm::StringRef PlatformWindows::GetPluginDescriptionStatic(bool is_host) {
|
||||
return is_host ? "Local Windows user platform plug-in."
|
||||
: "Remote Windows user platform plug-in.";
|
||||
}
|
||||
|
||||
@@ -25,16 +25,18 @@ public:
|
||||
static lldb::PlatformSP CreateInstance(bool force,
|
||||
const lldb_private::ArchSpec *arch);
|
||||
|
||||
static lldb_private::ConstString GetPluginNameStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginNameStatic(bool is_host) {
|
||||
return is_host ? Platform::GetHostPlatformName() : "remote-windows";
|
||||
}
|
||||
|
||||
static const char *GetPluginDescriptionStatic(bool is_host);
|
||||
static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
|
||||
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic(IsHost()).GetStringRef();
|
||||
return GetPluginNameStatic(IsHost());
|
||||
}
|
||||
|
||||
// lldb_private::Platform functions
|
||||
const char *GetDescription() override {
|
||||
llvm::StringRef GetDescription() override {
|
||||
return GetPluginDescriptionStatic(IsHost());
|
||||
}
|
||||
|
||||
|
||||
@@ -72,17 +72,12 @@ PlatformSP PlatformRemoteGDBServer::CreateInstance(bool force,
|
||||
return PlatformSP();
|
||||
}
|
||||
|
||||
ConstString PlatformRemoteGDBServer::GetPluginNameStatic() {
|
||||
static ConstString g_name("remote-gdb-server");
|
||||
return g_name;
|
||||
}
|
||||
|
||||
const char *PlatformRemoteGDBServer::GetDescriptionStatic() {
|
||||
llvm::StringRef PlatformRemoteGDBServer::GetDescriptionStatic() {
|
||||
return "A platform that uses the GDB remote protocol as the communication "
|
||||
"transport.";
|
||||
}
|
||||
|
||||
const char *PlatformRemoteGDBServer::GetDescription() {
|
||||
llvm::StringRef PlatformRemoteGDBServer::GetDescription() {
|
||||
if (m_platform_description.empty()) {
|
||||
if (IsConnected()) {
|
||||
// Send the get description packet
|
||||
|
||||
@@ -28,18 +28,16 @@ public:
|
||||
|
||||
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
|
||||
|
||||
static ConstString GetPluginNameStatic();
|
||||
static llvm::StringRef GetPluginNameStatic() { return "remote-gdb-server"; }
|
||||
|
||||
static const char *GetDescriptionStatic();
|
||||
static llvm::StringRef GetDescriptionStatic();
|
||||
|
||||
PlatformRemoteGDBServer();
|
||||
|
||||
~PlatformRemoteGDBServer() override;
|
||||
|
||||
// lldb_private::PluginInterface functions
|
||||
llvm::StringRef GetPluginName() override {
|
||||
return GetPluginNameStatic().GetStringRef();
|
||||
}
|
||||
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
|
||||
|
||||
// lldb_private::Platform functions
|
||||
Status
|
||||
@@ -49,7 +47,7 @@ public:
|
||||
bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
|
||||
ModuleSpec &module_spec) override;
|
||||
|
||||
const char *GetDescription() override;
|
||||
llvm::StringRef GetDescription() override;
|
||||
|
||||
Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid_ptr,
|
||||
FileSpec &local_file) override;
|
||||
|
||||
@@ -2349,9 +2349,9 @@ Status ProcessGDBRemote::DoDestroy() {
|
||||
m_public_state.GetValue() != eStateRunning) {
|
||||
PlatformSP platform_sp = GetTarget().GetPlatform();
|
||||
|
||||
// FIXME: These should be ConstStrings so we aren't doing strcmp'ing.
|
||||
if (platform_sp && platform_sp->GetName() &&
|
||||
platform_sp->GetName() == PlatformRemoteiOS::GetPluginNameStatic()) {
|
||||
platform_sp->GetName().GetStringRef() ==
|
||||
PlatformRemoteiOS::GetPluginNameStatic()) {
|
||||
if (m_destroy_tried_resuming) {
|
||||
if (log)
|
||||
log->PutCString("ProcessGDBRemote::DoDestroy() - Tried resuming to "
|
||||
|
||||
@@ -294,8 +294,8 @@ PlatformSP Platform::Create(ConstString name, Status &error) {
|
||||
if (name == g_host_platform_name)
|
||||
return GetHostPlatform();
|
||||
|
||||
create_callback =
|
||||
PluginManager::GetPlatformCreateCallbackForPluginName(name);
|
||||
create_callback = PluginManager::GetPlatformCreateCallbackForPluginName(
|
||||
name.GetStringRef());
|
||||
if (create_callback)
|
||||
platform_sp = create_callback(true, nullptr);
|
||||
else
|
||||
|
||||
@@ -24,7 +24,7 @@ class RemoteAwarePlatformTester : public RemoteAwarePlatform {
|
||||
public:
|
||||
using RemoteAwarePlatform::RemoteAwarePlatform;
|
||||
|
||||
MOCK_METHOD0(GetDescription, const char *());
|
||||
MOCK_METHOD0(GetDescription, llvm::StringRef());
|
||||
MOCK_METHOD0(GetPluginName, llvm::StringRef());
|
||||
MOCK_METHOD2(GetSupportedArchitectureAtIndex, bool(uint32_t, ArchSpec &));
|
||||
MOCK_METHOD4(Attach,
|
||||
@@ -40,7 +40,7 @@ class TargetPlatformTester : public Platform {
|
||||
public:
|
||||
using Platform::Platform;
|
||||
|
||||
MOCK_METHOD0(GetDescription, const char *());
|
||||
MOCK_METHOD0(GetDescription, llvm::StringRef());
|
||||
MOCK_METHOD0(GetPluginName, llvm::StringRef());
|
||||
MOCK_METHOD2(GetSupportedArchitectureAtIndex, bool(uint32_t, ArchSpec &));
|
||||
MOCK_METHOD4(Attach,
|
||||
|
||||
Reference in New Issue
Block a user