diff options
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
3 files changed, 21 insertions, 8 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 30caf92a335..e68a5d41a3a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2961,14 +2961,6 @@ ProcessGDBRemote::Initialize() GetPluginDescriptionStatic(), CreateInstance, DebuggerInitialize); - - Log::Callbacks log_callbacks = { - ProcessGDBRemoteLog::DisableLog, - ProcessGDBRemoteLog::EnableLog, - ProcessGDBRemoteLog::ListLogCategories - }; - - Log::RegisterLogChannel (ProcessGDBRemote::GetPluginNameStatic(), log_callbacks); } } diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp index 15b861feaa8..0f73e44590b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp @@ -9,6 +9,8 @@ #include "ProcessGDBRemoteLog.h" +#include <mutex> + #include "lldb/Interpreter/Args.h" #include "lldb/Core/StreamFile.h" @@ -32,6 +34,22 @@ GetLog () return g_log; } +void +ProcessGDBRemoteLog::Initialize() +{ + static ConstString g_name("gdb-remote"); + static std::once_flag g_once_flag; + + std::call_once(g_once_flag, [](){ + Log::Callbacks log_callbacks = { + DisableLog, + EnableLog, + ListLogCategories + }; + + Log::RegisterLogChannel (g_name, log_callbacks); + }); +} Log * ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (uint32_t mask) diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h index 93734067f13..c551f8eba59 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h @@ -35,6 +35,9 @@ class ProcessGDBRemoteLog { public: + static void + Initialize(); + static lldb_private::Log * GetLogIfAllCategoriesSet(uint32_t mask = 0); |