[Lldb-commits] [PATCH] D68258: [Windows] Introduce a switch for the `lldb-server` mode on Windows

Aleksandr Urakov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 30 22:44:14 PDT 2019


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() {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68258.222544.patch
Type: text/x-patch
Size: 1317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191001/408c6581/attachment.bin>


More information about the lldb-commits mailing list