[Lldb-commits] [lldb] r231966 - Initialize ProcessGDBRemoteLog for LLGS to fix remote platform logging
Robert Flack
flackr at gmail.com
Wed Mar 11 14:14:22 PDT 2015
Author: flackr
Date: Wed Mar 11 16:14:22 2015
New Revision: 231966
URL: http://llvm.org/viewvc/llvm-project?rev=231966&view=rev
Log:
Initialize ProcessGDBRemoteLog for LLGS to fix remote platform logging
This was previously initialized by ProcessGDBRemote::Initialize but lldb-server does not contain ProcessGDBRemote anymore so this needs to be initialized directly.
Differential Revision: http://reviews.llvm.org/D8186
Modified:
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
lldb/trunk/source/lldb.cpp
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Wed Mar 11 16:14:22 2015
@@ -63,14 +63,7 @@ ProcessFreeBSD::Initialize()
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance);
- Log::Callbacks log_callbacks = {
- ProcessPOSIXLog::DisableLog,
- ProcessPOSIXLog::EnableLog,
- ProcessPOSIXLog::ListLogCategories
- };
-
- Log::RegisterLogChannel (ProcessFreeBSD::GetPluginNameStatic(), log_callbacks);
- ProcessPOSIXLog::RegisterPluginName(GetPluginNameStatic());
+ ProcessPOSIXLog::Initialize(GetPluginNameStatic());
g_initialized = true;
}
}
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Wed Mar 11 16:14:22 2015
@@ -1125,27 +1125,6 @@ NativeProcessLinux::AttachArgs::~AttachA
// Public Static Methods
// -----------------------------------------------------------------------------
-void
-NativeProcessLinux::Initialize()
-{
- static ConstString g_name("linux");
- static bool g_initialized = false;
-
- if (!g_initialized)
- {
- g_initialized = true;
-
- Log::Callbacks log_callbacks = {
- ProcessPOSIXLog::DisableLog,
- ProcessPOSIXLog::EnableLog,
- ProcessPOSIXLog::ListLogCategories
- };
-
- Log::RegisterLogChannel (g_name, log_callbacks);
- ProcessPOSIXLog::RegisterPluginName (g_name);
- }
-}
-
lldb_private::Error
NativeProcessLinux::LaunchProcess (
lldb_private::Module *exe_module,
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Wed Mar 11 16:14:22 2015
@@ -45,12 +45,6 @@ namespace lldb_private
{
public:
- // ---------------------------------------------------------------------
- // Public Static Methods
- // ---------------------------------------------------------------------
- static void
- Initialize();
-
static lldb_private::Error
LaunchProcess (
Module *exe_module,
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Wed Mar 11 16:14:22 2015
@@ -60,15 +60,7 @@ ProcessLinux::Initialize()
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance);
-
- Log::Callbacks log_callbacks = {
- ProcessPOSIXLog::DisableLog,
- ProcessPOSIXLog::EnableLog,
- ProcessPOSIXLog::ListLogCategories
- };
-
- Log::RegisterLogChannel (ProcessLinux::GetPluginNameStatic(), log_callbacks);
- ProcessPOSIXLog::RegisterPluginName(GetPluginNameStatic());
+ ProcessPOSIXLog::Initialize(GetPluginNameStatic());
}
}
Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp Wed Mar 11 16:14:22 2015
@@ -9,6 +9,8 @@
#include "ProcessPOSIXLog.h"
+#include <mutex>
+
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/StreamFile.h"
@@ -33,6 +35,22 @@ GetLog ()
return g_log;
}
+void
+ProcessPOSIXLog::Initialize(ConstString name)
+{
+ static std::once_flag g_once_flag;
+
+ std::call_once(g_once_flag, [name](){
+ Log::Callbacks log_callbacks = {
+ DisableLog,
+ EnableLog,
+ ListLogCategories
+ };
+
+ Log::RegisterLogChannel (name, log_callbacks);
+ RegisterPluginName(name);
+ });
+}
Log *
ProcessPOSIXLog::GetLogIfAllCategoriesSet (uint32_t mask)
Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.h?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.h Wed Mar 11 16:14:22 2015
@@ -43,6 +43,12 @@ class ProcessPOSIXLog
static const char *m_pluginname;
public:
+ // ---------------------------------------------------------------------
+ // Public Static Methods
+ // ---------------------------------------------------------------------
+ static void
+ Initialize(lldb_private::ConstString name);
+
static void
RegisterPluginName(const char *pluginName)
{
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Mar 11 16:14:22 2015
@@ -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);
}
}
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Wed Mar 11 16:14:22 2015
@@ -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)
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h Wed Mar 11 16:14:22 2015
@@ -35,6 +35,9 @@
class ProcessGDBRemoteLog
{
public:
+ static void
+ Initialize();
+
static lldb_private::Log *
GetLogIfAllCategoriesSet(uint32_t mask = 0);
Modified: lldb/trunk/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/source/lldb.cpp (original)
+++ lldb/trunk/source/lldb.cpp Wed Mar 11 16:14:22 2015
@@ -81,6 +81,7 @@
#if defined (__linux__)
#include "Plugins/Process/Linux/ProcessLinux.h"
+#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
#endif
#if defined (_WIN32)
@@ -95,6 +96,7 @@
#endif
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"
+#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h"
#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
#include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h"
@@ -146,8 +148,9 @@ lldb_private::InitializeForLLGS ()
llvm::install_fatal_error_handler(fatal_error_handler, 0);
- // Initialize plug-ins
+ ProcessGDBRemoteLog::Initialize();
+ // Initialize plug-ins
ObjectContainerBSDArchive::Initialize();
ObjectFileELF::Initialize();
ObjectFilePECOFF::Initialize();
@@ -173,6 +176,10 @@ lldb_private::InitializeForLLGS ()
PlatformDarwinKernel::Initialize();
ObjectFileMachO::Initialize();
#endif
+#if defined (__linux__)
+ static ConstString g_linux_log_name("linux");
+ ProcessPOSIXLog::Initialize(g_linux_log_name);
+#endif
#ifndef LLDB_DISABLE_PYTHON
ScriptInterpreterPython::InitializePrivate();
OperatingSystemPython::Initialize();
Modified: lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp?rev=231966&r1=231965&r2=231966&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Wed Mar 11 16:14:22 2015
@@ -40,7 +40,6 @@
#include "lldb/Interpreter/CommandReturnObject.h"
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
-#include "Plugins/Process/Linux/NativeProcessLinux.h"
#ifndef LLGS_PROGRAM_NAME
#define LLGS_PROGRAM_NAME "lldb-server"
@@ -482,30 +481,17 @@ ConnectToRemote (GDBRemoteCommunicationS
}
}
-static void
-initialize ()
-{
-#ifndef _WIN32
- // Setup signal handlers first thing.
- signal (SIGPIPE, signal_handler);
- signal (SIGHUP, signal_handler);
-#endif
-
-#if defined (__linux__)
- //----------------------------------------------------------------------
- // Linux hosted plugins
- //----------------------------------------------------------------------
- NativeProcessLinux::Initialize();
-#endif
-}
-
//----------------------------------------------------------------------
// main
//----------------------------------------------------------------------
int
main_gdbserver (int argc, char *argv[])
{
- initialize ();
+#ifndef _WIN32
+ // Setup signal handlers first thing.
+ signal (SIGPIPE, signal_handler);
+ signal (SIGHUP, signal_handler);
+#endif
const char *progname = argv[0];
const char *subcommand = argv[1];
More information about the lldb-commits
mailing list