Skip to content

Commit

Permalink
Move several plugin to its own namespace
Browse files Browse the repository at this point in the history
Affected paths:
* Plugins/Platform/Android/*
* Plugins/Platform/Linux/*
* Plugins/Platform/gdb-server/*
* Plugins/Process/Linux/*
* Plugins/Process/gdb-remote/*

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

llvm-svn: 233679
  • Loading branch information
Tamas Berghammer committed Mar 31, 2015
1 parent 96d1779 commit db264a6
Show file tree
Hide file tree
Showing 58 changed files with 772 additions and 631 deletions.
12 changes: 6 additions & 6 deletions lldb/source/Host/linux/Host.cpp
Expand Up @@ -64,7 +64,7 @@ static bool
ReadProcPseudoFileStat (lldb::pid_t pid, ProcessStatInfo& stat_info)
{
// Read the /proc/$PID/stat file.
lldb::DataBufferSP buf_sp = ProcFileReader::ReadIntoDataBuffer (pid, "stat");
lldb::DataBufferSP buf_sp = process_linux::ProcFileReader::ReadIntoDataBuffer (pid, "stat");

// The filename of the executable is stored in parenthesis right after the pid. We look for the closing
// parenthesis for the filename and work from there in case the name has something funky like ')' in it.
Expand Down Expand Up @@ -117,7 +117,7 @@ GetLinuxProcessUserAndGroup (lldb::pid_t pid, ProcessInstanceInfo &process_info,
uint32_t eGid = UINT32_MAX; // Effective Group ID

// Read the /proc/$PID/status file and parse the Uid:, Gid:, and TracerPid: fields.
lldb::DataBufferSP buf_sp = ProcFileReader::ReadIntoDataBuffer (pid, "status");
lldb::DataBufferSP buf_sp = process_linux::ProcFileReader::ReadIntoDataBuffer (pid, "status");

static const char uid_token[] = "Uid:";
char *buf_uid = strstr ((char *)buf_sp->GetBytes(), uid_token);
Expand Down Expand Up @@ -157,13 +157,13 @@ GetLinuxProcessUserAndGroup (lldb::pid_t pid, ProcessInstanceInfo &process_info,
lldb::DataBufferSP
Host::GetAuxvData(lldb_private::Process *process)
{
return ProcFileReader::ReadIntoDataBuffer (process->GetID(), "auxv");
return process_linux::ProcFileReader::ReadIntoDataBuffer (process->GetID(), "auxv");
}

lldb::DataBufferSP
Host::GetAuxvData (lldb::pid_t pid)
{
return ProcFileReader::ReadIntoDataBuffer (pid, "auxv");
return process_linux::ProcFileReader::ReadIntoDataBuffer (pid, "auxv");
}

static bool
Expand Down Expand Up @@ -328,7 +328,7 @@ GetProcessAndStatInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info, Proce
lldb::DataBufferSP buf_sp;

// Get the process environment.
buf_sp = ProcFileReader::ReadIntoDataBuffer(pid, "environ");
buf_sp = process_linux::ProcFileReader::ReadIntoDataBuffer(pid, "environ");
Args &info_env = process_info.GetEnvironmentEntries();
char *next_var = (char *)buf_sp->GetBytes();
char *end_buf = next_var + buf_sp->GetByteSize();
Expand All @@ -339,7 +339,7 @@ GetProcessAndStatInfo (lldb::pid_t pid, ProcessInstanceInfo &process_info, Proce
}

// Get the command line used to start the process.
buf_sp = ProcFileReader::ReadIntoDataBuffer(pid, "cmdline");
buf_sp = process_linux::ProcFileReader::ReadIntoDataBuffer(pid, "cmdline");

// Grab Arg0 first, if there is one.
char *cmd = (char *)buf_sp->GetBytes();
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Host/linux/HostThreadLinux.cpp
Expand Up @@ -37,7 +37,7 @@ void
HostThreadLinux::GetName(lldb::thread_t thread, llvm::SmallVectorImpl<char> &name)
{
// Read /proc/$TID/comm file.
lldb::DataBufferSP buf_sp = ProcFileReader::ReadIntoDataBuffer(thread, "comm");
lldb::DataBufferSP buf_sp = process_linux::ProcFileReader::ReadIntoDataBuffer(thread, "comm");
const char *comm_str = (const char *)buf_sp->GetBytes();
const char *cr_str = ::strchr(comm_str, '\n');
size_t length = cr_str ? (cr_str - comm_str) : strlen(comm_str);
Expand Down
22 changes: 11 additions & 11 deletions lldb/source/Initialization/InitializeLLDB.cpp
Expand Up @@ -130,18 +130,18 @@ InitializeForLLGSPrivate()

llvm::install_fatal_error_handler(fatal_error_handler, 0);

ProcessGDBRemoteLog::Initialize();
process_gdb_remote::ProcessGDBRemoteLog::Initialize();

// Initialize plug-ins
ObjectContainerBSDArchive::Initialize();
ObjectFileELF::Initialize();
ObjectFilePECOFF::Initialize();
DynamicLoaderPOSIXDYLD::Initialize();
PlatformFreeBSD::Initialize();
PlatformLinux::Initialize();
platform_linux::PlatformLinux::Initialize();
PlatformWindows::Initialize();
PlatformKalimba::Initialize();
PlatformAndroid::Initialize();
platform_android::PlatformAndroid::Initialize();

//----------------------------------------------------------------------
// Apple/Darwin hosted plugins
Expand Down Expand Up @@ -215,7 +215,7 @@ InitializePrivate()
//----------------------------------------------------------------------
// Linux hosted plugins
//----------------------------------------------------------------------
ProcessLinux::Initialize();
process_linux::ProcessLinux::Initialize();
#endif
#if defined(_MSC_VER)
DynamicLoaderWindows::Initialize();
Expand All @@ -232,9 +232,9 @@ InitializePrivate()
//----------------------------------------------------------------------
// Platform agnostic plugins
//----------------------------------------------------------------------
PlatformRemoteGDBServer::Initialize();
platform_gdb_server::PlatformRemoteGDBServer::Initialize();

ProcessGDBRemote::Initialize();
process_gdb_remote::ProcessGDBRemote::Initialize();
DynamicLoaderStatic::Initialize();

// Scan for any system or user LLDB plug-ins
Expand All @@ -259,10 +259,10 @@ TerminateForLLGSPrivate()
ObjectFilePECOFF::Terminate();
DynamicLoaderPOSIXDYLD::Terminate();
PlatformFreeBSD::Terminate();
PlatformLinux::Terminate();
platform_linux::PlatformLinux::Terminate();
PlatformWindows::Terminate();
PlatformKalimba::Terminate();
PlatformAndroid::Terminate();
platform_android::PlatformAndroid::Terminate();
DynamicLoaderMacOSXDYLD::Terminate();
ObjectContainerUniversalMachO::Terminate();
PlatformMacOSX::Terminate();
Expand Down Expand Up @@ -329,16 +329,16 @@ TerminatePrivate()
#endif

#if defined(__linux__)
ProcessLinux::Terminate();
process_linux::ProcessLinux::Terminate();
#endif

#if defined(__FreeBSD__)
ProcessFreeBSD::Terminate();
#endif
Debugger::SettingsTerminate();

PlatformRemoteGDBServer::Terminate();
ProcessGDBRemote::Terminate();
platform_gdb_server::PlatformRemoteGDBServer::Terminate();
process_gdb_remote::ProcessGDBRemote::Terminate();
DynamicLoaderStatic::Terminate();

TerminateForLLGSPrivate();
Expand Down
1 change: 1 addition & 0 deletions lldb/source/Plugins/Platform/Android/AdbClient.cpp
Expand Up @@ -20,6 +20,7 @@

using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::platform_android;

namespace {

Expand Down
2 changes: 2 additions & 0 deletions lldb/source/Plugins/Platform/Android/AdbClient.h
Expand Up @@ -24,6 +24,7 @@
#include "lldb/Host/ConnectionFileDescriptor.h"

namespace lldb_private {
namespace platform_android {

class AdbClient
{
Expand Down Expand Up @@ -71,6 +72,7 @@ class AdbClient
ConnectionFileDescriptor m_conn;
};

} // namespace platform_android
} // namespace lldb_private

#endif // liblldb_AdbClient_h_
7 changes: 4 additions & 3 deletions lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
Expand Up @@ -21,6 +21,7 @@

using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::platform_android;

static uint32_t g_initialize_count = 0;

Expand Down Expand Up @@ -59,7 +60,7 @@ PlatformAndroid::Terminate ()
PlatformSP
PlatformAndroid::CreateInstance (bool force, const ArchSpec *arch)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
if (log)
{
const char *arch_name;
Expand Down Expand Up @@ -139,7 +140,7 @@ PlatformAndroid::~PlatformAndroid()
{
}

lldb_private::ConstString
ConstString
PlatformAndroid::GetPluginNameStatic (bool is_host)
{
if (is_host)
Expand All @@ -163,7 +164,7 @@ PlatformAndroid::GetPluginDescriptionStatic (bool is_host)
return "Remote Android user platform plug-in.";
}

lldb_private::ConstString
ConstString
PlatformAndroid::GetPluginName()
{
return GetPluginNameStatic(IsHost());
Expand Down
15 changes: 9 additions & 6 deletions lldb/source/Plugins/Platform/Android/PlatformAndroid.h
Expand Up @@ -20,8 +20,9 @@
#include "Plugins/Platform/Linux/PlatformLinux.h"

namespace lldb_private {
namespace platform_android {

class PlatformAndroid : public PlatformLinux
class PlatformAndroid : public platform_linux::PlatformLinux
{
public:
static void
Expand All @@ -39,15 +40,15 @@ namespace lldb_private {
// lldb_private::PluginInterface functions
//------------------------------------------------------------
static lldb::PlatformSP
CreateInstance (bool force, const lldb_private::ArchSpec *arch);
CreateInstance (bool force, const ArchSpec *arch);

static lldb_private::ConstString
static ConstString
GetPluginNameStatic (bool is_host);

static const char *
GetPluginDescriptionStatic (bool is_host);

lldb_private::ConstString
ConstString
GetPluginName() override;

uint32_t
Expand All @@ -60,8 +61,8 @@ namespace lldb_private {
// lldb_private::Platform functions
//------------------------------------------------------------

lldb_private::Error
ConnectRemote (lldb_private::Args& args) override;
Error
ConnectRemote (Args& args) override;

protected:
const char *
Expand All @@ -71,6 +72,8 @@ namespace lldb_private {
std::string m_device_id;
DISALLOW_COPY_AND_ASSIGN (PlatformAndroid);
};

} // namespace platofor_android
} // namespace lldb_private

#endif // liblldb_PlatformAndroid_h_
Expand Up @@ -18,13 +18,14 @@

using namespace lldb;
using namespace lldb_private;
using namespace platform_android;

static const lldb::pid_t g_remote_platform_pid = 0; // Alias for the process id of lldb-platform

static Error
ForwardPortWithAdb (uint16_t port, std::string& device_id)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));

// Fetch the device list from ADB and if only 1 device found then use that device
// TODO: Handle the case when more device is available
Expand Down
Expand Up @@ -19,18 +19,21 @@
// Project includes
#include "Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h"

class PlatformAndroidRemoteGDBServer : public PlatformRemoteGDBServer
namespace lldb_private {
namespace platform_android {

class PlatformAndroidRemoteGDBServer : public platform_gdb_server::PlatformRemoteGDBServer
{
public:
PlatformAndroidRemoteGDBServer ();

virtual
~PlatformAndroidRemoteGDBServer ();

lldb_private::Error
ConnectRemote (lldb_private::Args& args) override;
Error
ConnectRemote (Args& args) override;

lldb_private::Error
Error
DisconnectRemote () override;

protected:
Expand All @@ -47,4 +50,7 @@ class PlatformAndroidRemoteGDBServer : public PlatformRemoteGDBServer

};

} // namespace platform_android
} // namespace lldb_private

#endif // liblldb_PlatformAndroidRemoteGDBServer_h_

0 comments on commit db264a6

Please sign in to comment.