[Lldb-commits] [lldb] r229371 - Enable process launching on android from lldb-gdbserver
Tamas Berghammer
tberghammer at google.com
Mon Feb 16 02:34:30 PST 2015
Author: tberghammer
Date: Mon Feb 16 04:34:30 2015
New Revision: 229371
URL: http://llvm.org/viewvc/llvm-project?rev=229371&view=rev
Log:
Enable process launching on android from lldb-gdbserver
Currently it is uses the same code used on linux. Will be replaced with
android specific code if needed.
Differential Revision: http://reviews.llvm.org/D7613
Modified:
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=229371&r1=229370&r2=229371&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Mon Feb 16 04:34:30 2015
@@ -12,6 +12,7 @@
// Other libraries and framework includes
#include "lldb/Core/Log.h"
#include "lldb/Core/PluginManager.h"
+#include "lldb/Host/HostInfo.h"
// Project includes
#include "PlatformAndroid.h"
@@ -29,8 +30,13 @@ PlatformAndroid::Initialize ()
if (g_initialize_count++ == 0)
{
- PluginManager::RegisterPlugin (PlatformAndroid::GetPluginNameStatic(),
- PlatformAndroid::GetPluginDescriptionStatic(),
+#if defined(__ANDROID__)
+ PlatformSP default_platform_sp (new PlatformAndroid(true));
+ default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
+ Platform::SetHostPlatform (default_platform_sp);
+#endif
+ PluginManager::RegisterPlugin (PlatformAndroid::GetPluginNameStatic(false),
+ PlatformAndroid::GetPluginDescriptionStatic(false),
PlatformAndroid::CreateInstance);
}
}
@@ -92,9 +98,9 @@ PlatformAndroid::CreateInstance (bool fo
{
switch (triple.getOS())
{
- case llvm::Triple::Linux:
+ case llvm::Triple::Android:
break;
-
+
#if defined(__ANDROID__)
// Only accept "unknown" for the OS if the host is android and
// it "unknown" wasn't specified (it was just returned because it
@@ -114,7 +120,7 @@ PlatformAndroid::CreateInstance (bool fo
{
if (log)
log->Printf ("PlatformAndroid::%s() creating remote-android platform", __FUNCTION__);
- return PlatformSP(new PlatformAndroid());
+ return PlatformSP(new PlatformAndroid(false));
}
if (log)
@@ -123,8 +129,8 @@ PlatformAndroid::CreateInstance (bool fo
return PlatformSP();
}
-PlatformAndroid::PlatformAndroid () :
- PlatformLinux(false) // Platform android is always a remote target
+PlatformAndroid::PlatformAndroid (bool is_host) :
+ PlatformLinux(is_host)
{
}
@@ -133,27 +139,43 @@ PlatformAndroid::~PlatformAndroid()
}
lldb_private::ConstString
-PlatformAndroid::GetPluginNameStatic ()
+PlatformAndroid::GetPluginNameStatic (bool is_host)
{
- static ConstString g_remote_name("remote-android");
- return g_remote_name;
+ if (is_host)
+ {
+ static ConstString g_host_name(Platform::GetHostPlatformName ());
+ return g_host_name;
+ }
+ else
+ {
+ static ConstString g_remote_name("remote-android");
+ return g_remote_name;
+ }
}
const char *
-PlatformAndroid::GetPluginDescriptionStatic ()
+PlatformAndroid::GetPluginDescriptionStatic (bool is_host)
{
- return "Remote Android user platform plug-in.";
+ if (is_host)
+ return "Local Android user platform plug-in.";
+ else
+ return "Remote Android user platform plug-in.";
}
lldb_private::ConstString
PlatformAndroid::GetPluginName()
{
- return GetPluginNameStatic();
+ return GetPluginNameStatic(IsHost());
}
Error
PlatformAndroid::ConnectRemote (Args& args)
{
+ if (IsHost())
+ {
+ return Error ("can't connect to the host platform '%s', always connected", GetPluginName().GetCString());
+ }
+
if (!m_remote_platform_sp)
m_remote_platform_sp = PlatformSP(new PlatformAndroidRemoteGDBServer());
return PlatformLinux::ConnectRemote (args);
Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h?rev=229371&r1=229370&r2=229371&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h (original)
+++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h Mon Feb 16 04:34:30 2015
@@ -26,8 +26,8 @@ namespace lldb_private {
static void
Terminate ();
-
- PlatformAndroid ();
+
+ PlatformAndroid (bool is_host);
virtual
~PlatformAndroid();
@@ -39,10 +39,10 @@ namespace lldb_private {
CreateInstance (bool force, const lldb_private::ArchSpec *arch);
static lldb_private::ConstString
- GetPluginNameStatic ();
+ GetPluginNameStatic (bool is_host);
static const char *
- GetPluginDescriptionStatic ();
+ GetPluginDescriptionStatic (bool is_host);
lldb_private::ConstString
GetPluginName() override;
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=229371&r1=229370&r2=229371&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Mon Feb 16 04:34:30 2015
@@ -246,7 +246,7 @@ PlatformLinux::Initialize ()
if (g_initialize_count++ == 0)
{
-#if defined(__linux__)
+#if defined(__linux__) && !defined(__ANDROID__)
PlatformSP default_platform_sp (new PlatformLinux(true));
default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture());
Platform::SetHostPlatform (default_platform_sp);
@@ -853,9 +853,6 @@ PlatformLinux::LaunchNativeProcess (
lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
NativeProcessProtocolSP &process_sp)
{
-#if !defined(__linux__) || defined(__ANDROID_NDK__)
- return Error("only implemented on Linux hosts");
-#else
if (!IsHost ())
return Error("PlatformLinux::%s (): cannot launch a debug process when not the host", __FUNCTION__);
@@ -882,7 +879,6 @@ PlatformLinux::LaunchNativeProcess (
process_sp);
return error;
-#endif
}
Error
@@ -890,13 +886,9 @@ PlatformLinux::AttachNativeProcess (lldb
lldb_private::NativeProcessProtocol::NativeDelegate &native_delegate,
NativeProcessProtocolSP &process_sp)
{
-#if !defined(__linux__) || defined(__ANDROID_NDK__)
- return Error("only implemented on Linux hosts");
-#else
if (!IsHost ())
return Error("PlatformLinux::%s (): cannot attach to a debug process when not the host", __FUNCTION__);
// Launch it for debugging
return NativeProcessLinux::AttachToProcess (pid, native_delegate, process_sp);
-#endif
}
Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=229371&r1=229370&r2=229371&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp Mon Feb 16 04:34:30 2015
@@ -198,9 +198,8 @@ NativeThreadLinux::GetRegisterContext ()
break;
}
#endif
-#if 0
+
case llvm::Triple::x86:
-#endif
case llvm::Triple::x86_64:
{
const uint32_t concrete_frame_idx = 0;
More information about the lldb-commits
mailing list