aleksandr.urakov created this revision.
aleksandr.urakov added reviewers: labath, amccarth, asmith, stella.stamenova.
aleksandr.urakov added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere, abidh.
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.
Repository:
rLLDB LLDB
https://reviews.llvm.org/D68258
Files:
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
Index: lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
===================================================================
--- lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -81,13 +81,24 @@
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() {}
Index: lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
===================================================================
--- lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -81,13 +81,24 @@
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() {}
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits