[Windows] Introduce a switch for the `lldb-server` mode on Windows

Summary:
This patch introduces a switch, based on the environment variable
`LLDB_USE_LLDB_SERVER`, to determine whether to use the `ProcessWindows` plugin
(the old way) or the `lldb-server` way for debugging on Windows.

Reviewers: labath, amccarth, asmith, stella.stamenova

Reviewed By: labath, amccarth

Subscribers: mstorsjo, abidh, JDevlieghere, lldb-commits, leonid.mashinskiy

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68258

llvm-svn: 374325
This commit is contained in:
Aleksandr Urakov 2019-10-10 12:21:04 +00:00
parent 62808631ac
commit 0891366571
1 changed files with 17 additions and 6 deletions

View File

@ -81,13 +81,24 @@ ProcessSP ProcessWindows::CreateInstance(lldb::TargetSP target_sp,
return ProcessSP(new ProcessWindows(target_sp, listener_sp));
}
void ProcessWindows::Initialize() {
static llvm::once_flag g_once_flag;
static bool ShouldUseLLDBServer() {
llvm::StringRef use_lldb_server = ::getenv("LLDB_USE_LLDB_SERVER");
return use_lldb_server.equals_lower("on") ||
use_lldb_server.equals_lower("yes") ||
use_lldb_server.equals_lower("1") ||
use_lldb_server.equals_lower("true");
}
llvm::call_once(g_once_flag, []() {
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(), CreateInstance);
});
void ProcessWindows::Initialize() {
if (!ShouldUseLLDBServer()) {
static llvm::once_flag g_once_flag;
llvm::call_once(g_once_flag, []() {
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance);
});
}
}
void ProcessWindows::Terminate() {}