Author: aleksandr.urakov Date: Thu Oct 10 05:21:04 2019 New Revision: 374325
URL: http://llvm.org/viewvc/llvm-project?rev=374325&view=rev Log: [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 Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=374325&r1=374324&r2=374325&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (original) +++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Thu Oct 10 05:21:04 2019 @@ -81,13 +81,24 @@ ProcessSP ProcessWindows::CreateInstance return ProcessSP(new ProcessWindows(target_sp, listener_sp)); } +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"); +} + void ProcessWindows::Initialize() { - static llvm::once_flag g_once_flag; + if (!ShouldUseLLDBServer()) { + static llvm::once_flag g_once_flag; - llvm::call_once(g_once_flag, []() { - PluginManager::RegisterPlugin(GetPluginNameStatic(), - GetPluginDescriptionStatic(), CreateInstance); - }); + llvm::call_once(g_once_flag, []() { + PluginManager::RegisterPlugin(GetPluginNameStatic(), + GetPluginDescriptionStatic(), + CreateInstance); + }); + } } void ProcessWindows::Terminate() {} _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits