[Lldb-commits] [lldb] r138761 - in /lldb/trunk/source/Plugins/Platform/FreeBSD: PlatformFreeBSD.cpp PlatformFreeBSD.h
Johnny Chen
johnny.chen at apple.com
Mon Aug 29 13:43:14 PDT 2011
Author: johnny
Date: Mon Aug 29 15:43:14 2011
New Revision: 138761
URL: http://llvm.org/viewvc/llvm-project?rev=138761&view=rev
Log:
Patch by Filipe for FreeBSD platform plugin!
Modified:
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=138761&r1=138760&r2=138761&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Mon Aug 29 15:43:14 2011
@@ -32,19 +32,34 @@
Platform *
PlatformFreeBSD::CreateInstance ()
{
- return new PlatformFreeBSD();
+ // The only time we create an instance is when we are creating a remote
+ // freebsd platform
+ const bool is_host = false;
+ return new PlatformFreeBSD (is_host);
}
const char *
PlatformFreeBSD::GetPluginNameStatic()
{
- return "plugin.platform.FreeBSD";
+ return "PlatformFreeBSD";
}
const char *
-PlatformFreeBSD::GetPluginDescriptionStatic()
+PlatformFreeBSD::GetShortPluginNameStatic (bool is_host)
{
- return "Default platform plugin for FreeBSD";
+ if (is_host)
+ return Platform::GetHostPlatformName ();
+ else
+ return "remote-freebsd";
+}
+
+const char *
+PlatformFreeBSD::GetDescriptionStatic (bool is_host)
+{
+ if (is_host)
+ return "Local FreeBSD user platform plug-in.";
+ else
+ return "Remote FreeBSD user platform plug-in.";
}
void
@@ -54,11 +69,14 @@
if (!g_initialized)
{
+#if defined (__FreeBSD__)
PlatformSP default_platform_sp (CreateInstance());
+ //default_platform_sp->SetSystemArchitecture (Host::GetArchitecture());
Platform::SetDefaultPlatform (default_platform_sp);
- PluginManager::RegisterPlugin(GetPluginNameStatic(),
- GetPluginDescriptionStatic(),
- CreateInstance);
+#endif
+ PluginManager::RegisterPlugin(PlatformFreeBSD::GetShortPluginNameStatic(false),
+ PlatformFreeBSD::GetDescriptionStatic(false),
+ PlatformFreeBSD::CreateInstance);
g_initialized = true;
}
}
@@ -177,8 +195,8 @@
//------------------------------------------------------------------
/// Default Constructor
//------------------------------------------------------------------
-PlatformFreeBSD::PlatformFreeBSD () :
- Platform(true)
+PlatformFreeBSD::PlatformFreeBSD (bool is_host) :
+ Platform(is_host)
{
}
@@ -219,7 +237,8 @@
return;
}
- strm << un.sysname << ' ' << un.release << ' ' << un.version << '\n';
+ strm << "Host: " << un.sysname << ' ' << un.release << ' ' << un.version << '\n';
+ Platform::GetStatus(strm);
}
size_t
Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h?rev=138761&r1=138760&r2=138761&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Mon Aug 29 15:43:14 2011
@@ -28,7 +28,7 @@
static void
Terminate ();
- PlatformFreeBSD ();
+ PlatformFreeBSD (bool is_host);
virtual
~PlatformFreeBSD();
@@ -43,7 +43,10 @@
GetPluginNameStatic();
static const char *
- GetPluginDescriptionStatic();
+ GetShortPluginNameStatic(bool is_host);
+
+ static const char *
+ GetDescriptionStatic(bool is_host);
virtual const char *
GetPluginName()
@@ -54,9 +57,9 @@
virtual const char *
GetShortPluginName()
{
- return "PlatformFreeBSD";
+ return GetShortPluginNameStatic (IsHost());
}
-
+
virtual uint32_t
GetPluginVersion()
{
@@ -74,7 +77,7 @@
virtual const char *
GetDescription ()
{
- return GetPluginDescriptionStatic();
+ return GetDescriptionStatic(IsHost());
}
virtual void
More information about the lldb-commits
mailing list