[Lldb-commits] [lldb] r231482 - Initialize ProcessPOSIXLog by NativeProcessLinux

Tamas Berghammer tberghammer at google.com
Fri Mar 6 07:47:24 PST 2015


Author: tberghammer
Date: Fri Mar  6 09:47:23 2015
New Revision: 231482

URL: http://llvm.org/viewvc/llvm-project?rev=231482&view=rev
Log:
Initialize ProcessPOSIXLog by NativeProcessLinux

Previously it was initialized by ProcessLinux but lldb-server don't
contain ProcessLinux anymore so it have to be initialized by
NativeProcessLinux also.

Differential revision: http://reviews.llvm.org/D8080

Modified:
    lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
    lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp

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=231482&r1=231481&r2=231482&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Fri Mar  6 09:47:23 2015
@@ -1125,6 +1125,27 @@ 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=231482&r1=231481&r2=231482&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Fri Mar  6 09:47:23 2015
@@ -48,6 +48,9 @@ namespace lldb_private
         // ---------------------------------------------------------------------
         // Public Static Methods
         // ---------------------------------------------------------------------
+        static void
+        Initialize();
+
         static lldb_private::Error
         LaunchProcess (
             Module *exe_module,

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=231482&r1=231481&r2=231482&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp Fri Mar  6 09:47:23 2015
@@ -40,6 +40,7 @@
 #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"
@@ -481,11 +482,8 @@ ConnectToRemote (GDBRemoteCommunicationS
     }
 }
 
-//----------------------------------------------------------------------
-// main
-//----------------------------------------------------------------------
-int
-main_gdbserver (int argc, char *argv[])
+static void
+initialize ()
 {
 #ifndef _WIN32
     // Setup signal handlers first thing.
@@ -493,6 +491,22 @@ main_gdbserver (int argc, char *argv[])
     signal (SIGHUP, signal_handler);
 #endif
 
+#if defined (__linux__)
+    //----------------------------------------------------------------------
+    // Linux hosted plugins
+    //----------------------------------------------------------------------
+    NativeProcessLinux::Initialize();
+#endif
+}
+
+//----------------------------------------------------------------------
+// main
+//----------------------------------------------------------------------
+int
+main_gdbserver (int argc, char *argv[])
+{
+    initialize ();
+
     const char *progname = argv[0];
     const char *subcommand = argv[1];
     argc--;





More information about the lldb-commits mailing list