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

llvm-svn: 231482
This commit is contained in:
Tamas Berghammer 2015-03-06 15:47:23 +00:00
parent 5b75f4a356
commit 6ad63744b3
3 changed files with 43 additions and 5 deletions

View File

@ -1125,6 +1125,27 @@ NativeProcessLinux::AttachArgs::~AttachArgs()
// 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,

View File

@ -48,6 +48,9 @@ namespace lldb_private
// ---------------------------------------------------------------------
// Public Static Methods
// ---------------------------------------------------------------------
static void
Initialize();
static lldb_private::Error
LaunchProcess (
Module *exe_module,

View File

@ -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 (GDBRemoteCommunicationServerLLGS &gdb_server, bool reverse_conn
}
}
//----------------------------------------------------------------------
// 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--;