Did a lot more work on abtracting and organizing the platforms.
On Mac OS X we now have 3 platforms:
PlatformDarwin - must be subclassed to fill in the missing pure virtual funcs
but this implements all the common functionality between
remote-macosx and remote-ios. It also allows for another
platform to be used (remote-gdb-server for now) when doing
remote connections. Keeping this pluggable will allow for
flexibility.
PlatformMacOSX - Now implements both local and remote macosx desktop platforms.
PlatformRemoteiOS - Remote only iOS that knows how to locate SDK files in the
cached SDK locations on the host.
A new agnostic platform has been created:
PlatformRemoteGDBServer - this implements the platform using the GDB remote
protocol and uses the built in lldb_private::Host
static functions to implement many queries.
llvm-svn: 128193
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index dc6b4ef..0294d67 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -68,7 +68,7 @@
}
else
{
- result.AppendError ("command not implemented");
+ result.AppendError ("command not implemented\n");
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
@@ -203,7 +203,7 @@
if (idx == 0)
{
- result.AppendError ("no platforms are available");
+ result.AppendError ("no platforms are available\n");
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
@@ -243,7 +243,7 @@
}
else
{
- result.AppendError ("no platform us currently selected");
+ result.AppendError ("no platform us currently selected\n");
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
@@ -274,7 +274,7 @@
virtual bool
Execute (Args& args, CommandReturnObject &result)
{
- result.AppendError ("command not implemented");
+ result.AppendError ("command not implemented\n");
result.SetStatus (eReturnStatusFailed);
return result.Succeeded();
}
@@ -306,27 +306,24 @@
{
Stream &ostrm = result.GetOutputStream();
- // Get rid of the "connect" from the args and leave the rest to the platform
- args.Shift();
PlatformSP selected_platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
if (selected_platform_sp)
{
Error error (selected_platform_sp->ConnectRemote (args));
if (error.Success())
{
- ostrm.Printf ("Connected to \"%s\"\n", selected_platform_sp->GetInstanceName());
selected_platform_sp->GetStatus (ostrm);
result.SetStatus (eReturnStatusSuccessFinishResult);
}
else
{
- result.AppendErrorWithFormat ("connection failed: %s", error.AsCString());
+ result.AppendErrorWithFormat ("%s\n", error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
}
else
{
- result.AppendError ("no platform us currently selected");
+ result.AppendError ("no platform us currently selected\n");
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
@@ -367,31 +364,31 @@
{
// Cache the instance name if there is one since we are
// about to disconnect and the name might go with it.
- const char *instance_name_cstr = selected_platform_sp->GetInstanceName();
- std::string instance_name;
- if (instance_name_cstr)
- instance_name.assign (instance_name_cstr);
+ const char *hostname_cstr = selected_platform_sp->GetHostname();
+ std::string hostname;
+ if (hostname_cstr)
+ hostname.assign (hostname_cstr);
error = selected_platform_sp->DisconnectRemote ();
if (error.Success())
{
Stream &ostrm = result.GetOutputStream();
- if (instance_name.empty())
+ if (hostname.empty())
ostrm.Printf ("Disconnected from \"%s\"\n", selected_platform_sp->GetShortPluginName());
else
- ostrm.Printf ("Disconnected from \"%s\"\n", instance_name.c_str());
+ ostrm.Printf ("Disconnected from \"%s\"\n", hostname.c_str());
result.SetStatus (eReturnStatusSuccessFinishResult);
}
else
{
- result.AppendErrorWithFormat ("disconnect failed: %s", error.AsCString());
+ result.AppendErrorWithFormat ("%s", error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
}
else
{
// Not connected...
- result.AppendError ("not connected.");
+ result.AppendErrorWithFormat ("not connected to '%s'", selected_platform_sp->GetShortPluginName());
result.SetStatus (eReturnStatusFailed);
}
}
@@ -404,7 +401,7 @@
}
else
{
- result.AppendError ("no platform us currently selected");
+ result.AppendError ("no platform is currently selected");
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();