Expose SBPlatform through the public API.
Example code:
remote_platform = lldb.SBPlatform("remote-macosx");
remote_platform.SetWorkingDirectory("/private/tmp")
debugger.SetSelectedPlatform(remote_platform)
connect_options = lldb.SBPlatformConnectOptions("connect://localhost:1111");
err = remote_platform.ConnectRemote(connect_options)
if err.Success():
print >> result, 'Connected to remote platform:'
print >> result, 'hostname: %s' % (remote_platform.GetHostname())
src = lldb.SBFileSpec("/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework", False)
dst = lldb.SBFileSpec()
# copy src to platform working directory since "dst" is empty
err = remote_platform.Install(src, dst);
if err.Success():
print >> result, '%s installed successfully' % (src)
else:
print >> result, 'error: failed to install "%s": %s' % (src, err)
Implemented many calls needed in lldb-platform to be able to install a directory that contains symlinks, file and directories.
The remote lldb-platform can now launch GDB servers on the remote system so that remote debugging can be spawned through the remote platform when connected to a remote platform.
The API in SBPlatform is subject to change and will be getting many new functions.
llvm-svn: 195273
diff --git a/lldb/tools/lldb-platform/lldb-platform.cpp b/lldb/tools/lldb-platform/lldb-platform.cpp
index 007e69c..21063f9 100644
--- a/lldb/tools/lldb-platform/lldb-platform.cpp
+++ b/lldb/tools/lldb-platform/lldb-platform.cpp
@@ -21,6 +21,7 @@
// C++ Includes
// Other libraries and framework includes
+#include "lldb/lldb-private-log.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/ConnectionMachPort.h"
@@ -96,44 +97,9 @@
int ch;
Debugger::Initialize();
-// ConnectionMachPort a;
-// ConnectionMachPort b;
-//
-// lldb::ConnectionStatus status;
-// const char *bootstrap_service_name = "HelloWorld";
-// status = a.BootstrapCheckIn(bootstrap_service_name, &error);
-//
-// if (status != eConnectionStatusSuccess)
-// {
-// fprintf(stderr, "%s", error.AsCString());
-// return 1;
-// }
-// status = b.BootstrapLookup (bootstrap_service_name, &error);
-// if (status != eConnectionStatusSuccess)
-// {
-// fprintf(stderr, "%s", error.AsCString());
-// return 2;
-// }
-//
-// if (a.Write ("hello", 5, status, &error) == 5)
-// {
-// char buf[32];
-// memset(buf, 0, sizeof(buf));
-// if (b.Read (buf, 5, status, &error))
-// {
-// printf("read returned bytes: %s", buf);
-// }
-// else
-// {
-// fprintf(stderr, "%s", error.AsCString());
-// return 4;
-// }
-// }
-// else
-// {
-// fprintf(stderr, "%s", error.AsCString());
-// return 3;
-// }
+// StreamSP stream_sp (new StreamFile(stdout, false));
+// const char *log_channels[] = { "host", "process", NULL };
+// EnableLog (stream_sp, 0, log_channels, NULL);
while ((ch = getopt_long_only(argc, argv, "l:f:L:", g_long_options, &long_option_index)) != -1)
{