[Lldb-commits] [PATCH] Initialize ProcessPOSIXLog by NativeProcessLinux

Tamas Berghammer tberghammer at google.com
Thu Mar 5 06:28:11 PST 2015


Hi flackr, vharron,

Initialize ProcessPOSIXLog by NativeProcessLinux

Previously it was initialized by ProcessLinux but lldb-server don't contain ProcessLinux anymore (since the separation of the dependencies) so it have to be initialized by NativeProcessLinux also.

http://reviews.llvm.org/D8080

Files:
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.h
  source/lldb.cpp

Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===================================================================
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1125,6 +1125,27 @@
 // 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,
Index: source/Plugins/Process/Linux/NativeProcessLinux.h
===================================================================
--- source/Plugins/Process/Linux/NativeProcessLinux.h
+++ source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -48,6 +48,9 @@
         // ---------------------------------------------------------------------
         // Public Static Methods
         // ---------------------------------------------------------------------
+        static void
+        Initialize();
+
         static lldb_private::Error
         LaunchProcess (
             Module *exe_module,
Index: source/lldb.cpp
===================================================================
--- source/lldb.cpp
+++ source/lldb.cpp
@@ -81,6 +81,7 @@
 
 #if defined (__linux__)
 #include "Plugins/Process/Linux/ProcessLinux.h"
+#include "Plugins/Process/Linux/NativeProcessLinux.h"
 #endif
 
 #if defined (_WIN32)
@@ -191,6 +192,13 @@
         ScriptInterpreterPython::InitializePrivate();
         OperatingSystemPython::Initialize();
 #endif
+
+#if defined (__linux__)
+        //----------------------------------------------------------------------
+        // Linux hosted plugins
+        //----------------------------------------------------------------------
+        NativeProcessLinux::Initialize();
+#endif
     }
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8080.21272.patch
Type: text/x-patch
Size: 2290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150305/c6bbf1e1/attachment.bin>


More information about the lldb-commits mailing list