aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/Platform
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2013-12-03 18:51:59 +0000
committerEd Maste <emaste@FreeBSD.org>2013-12-03 18:51:59 +0000
commit86758c718870f701bc69c1ca05495305ed1c5b85 (patch)
treeb2051e4e4856cc58ac7e2d20242b870b4f355ca1 /source/Plugins/Platform
parentf21a844f60ae6c74fcf1fddca32461acce3c1ee0 (diff)
downloadsrc-86758c718870f701bc69c1ca05495305ed1c5b85.tar.gz
src-86758c718870f701bc69c1ca05495305ed1c5b85.zip
Import lldb as of SVN r196259 (git 3be86e5)vendor/lldb/lldb-r196259
(A number of files not required for the FreeBSD build have been removed.) Sponsored by: DARPA, AFRL
Notes
Notes: svn path=/vendor/lldb/dist/; revision=258882 svn path=/vendor/lldb/lldb-r196259/; revision=258883; tag=vendor/lldb/lldb-r196259
Diffstat (limited to 'source/Plugins/Platform')
-rw-r--r--source/Plugins/Platform/POSIX/PlatformPOSIX.cpp178
-rw-r--r--source/Plugins/Platform/POSIX/PlatformPOSIX.h27
-rw-r--r--source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp192
-rw-r--r--source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h38
4 files changed, 336 insertions, 99 deletions
diff --git a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 34316c484276..b5f92dcc3dcd 100644
--- a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -76,44 +76,56 @@ PlatformPOSIX::RunShellCommand (const char *command, // Shouldn't be N
}
}
-uint32_t
-PlatformPOSIX::MakeDirectory (const std::string &path,
- mode_t mode)
+Error
+PlatformPOSIX::MakeDirectory (const char *path, uint32_t file_permissions)
{
- if (IsHost())
- {
- return Host::MakeDirectory (path.c_str(), mode);
- }
- if (IsRemote() && m_remote_platform_sp)
- return m_remote_platform_sp->MakeDirectory(path, mode);
- return Platform::MakeDirectory(path,mode);
+ if (m_remote_platform_sp)
+ return m_remote_platform_sp->MakeDirectory(path, file_permissions);
+ else
+ return Platform::MakeDirectory(path ,file_permissions);
+}
+
+Error
+PlatformPOSIX::GetFilePermissions (const char *path, uint32_t &file_permissions)
+{
+ if (m_remote_platform_sp)
+ return m_remote_platform_sp->GetFilePermissions(path, file_permissions);
+ else
+ return Platform::GetFilePermissions(path ,file_permissions);
+}
+
+Error
+PlatformPOSIX::SetFilePermissions (const char *path, uint32_t file_permissions)
+{
+ if (m_remote_platform_sp)
+ return m_remote_platform_sp->MakeDirectory(path, file_permissions);
+ else
+ return Platform::SetFilePermissions(path ,file_permissions);
}
lldb::user_id_t
PlatformPOSIX::OpenFile (const FileSpec& file_spec,
uint32_t flags,
- mode_t mode,
+ uint32_t mode,
Error &error)
{
if (IsHost())
- {
return Host::OpenFile(file_spec, flags, mode, error);
- }
- if (IsRemote() && m_remote_platform_sp)
+ else if (m_remote_platform_sp)
return m_remote_platform_sp->OpenFile(file_spec, flags, mode, error);
- return Platform::OpenFile(file_spec, flags, mode, error);
+ else
+ return Platform::OpenFile(file_spec, flags, mode, error);
}
bool
PlatformPOSIX::CloseFile (lldb::user_id_t fd, Error &error)
{
if (IsHost())
- {
return Host::CloseFile(fd, error);
- }
- if (IsRemote() && m_remote_platform_sp)
+ else if (m_remote_platform_sp)
return m_remote_platform_sp->CloseFile(fd, error);
- return Platform::CloseFile(fd, error);
+ else
+ return Platform::CloseFile(fd, error);
}
uint64_t
@@ -124,12 +136,11 @@ PlatformPOSIX::ReadFile (lldb::user_id_t fd,
Error &error)
{
if (IsHost())
- {
return Host::ReadFile(fd, offset, dst, dst_len, error);
- }
- if (IsRemote() && m_remote_platform_sp)
+ else if (m_remote_platform_sp)
return m_remote_platform_sp->ReadFile(fd, offset, dst, dst_len, error);
- return Platform::ReadFile(fd, offset, dst, dst_len, error);
+ else
+ return Platform::ReadFile(fd, offset, dst, dst_len, error);
}
uint64_t
@@ -140,13 +151,11 @@ PlatformPOSIX::WriteFile (lldb::user_id_t fd,
Error &error)
{
if (IsHost())
- {
return Host::WriteFile(fd, offset, src, src_len, error);
- }
- if (IsRemote() && m_remote_platform_sp)
+ else if (m_remote_platform_sp)
return m_remote_platform_sp->WriteFile(fd, offset, src, src_len, error);
-
- return Platform::WriteFile(fd, offset, src, src_len, error);
+ else
+ return Platform::WriteFile(fd, offset, src, src_len, error);
}
static uint32_t
@@ -184,6 +193,8 @@ PlatformPOSIX::PutFile (const lldb_private::FileSpec& source,
uint32_t uid,
uint32_t gid)
{
+ Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
+
if (IsHost())
{
if (FileSpec::Equal(source, destination, true))
@@ -213,7 +224,7 @@ PlatformPOSIX::PutFile (const lldb_private::FileSpec& source,
return Error("unable to perform chown");
return Error();
}
- else if (IsRemote() && m_remote_platform_sp)
+ else if (m_remote_platform_sp)
{
if (GetSupportsRSync())
{
@@ -244,7 +255,6 @@ PlatformPOSIX::PutFile (const lldb_private::FileSpec& source,
src_path.c_str(),
GetHostname(),
dst_path.c_str());
- Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
if (log)
log->Printf("[PutFile] Running command: %s\n", command.GetData());
int retcode;
@@ -263,20 +273,35 @@ PlatformPOSIX::PutFile (const lldb_private::FileSpec& source,
}
// if we are still here rsync has failed - let's try the slow way before giving up
}
+
+ if (log)
+ log->Printf ("PlatformPOSIX::PutFile(src='%s', dst='%s', uid=%u, gid=%u)",
+ source.GetPath().c_str(),
+ destination.GetPath().c_str(),
+ uid,
+ gid); // REMOVE THIS PRINTF PRIOR TO CHECKIN
// open
// read, write, read, write, ...
// close
// chown uid:gid dst
- Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
- if (log)
- log->Printf("[PutFile] Using block by block transfer....\n");
- File source_file(source, File::eOpenOptionRead, File::ePermissionsUserRW);
+ if (log)
+ log->Printf("[PutFile] Using block by block transfer....\n");
+
+ uint32_t source_open_options = File::eOpenOptionRead;
+ if (source.GetFileType() == FileSpec::eFileTypeSymbolicLink)
+ source_open_options |= File::eOpenoptionDontFollowSymlinks;
+
+ File source_file(source, source_open_options, lldb::eFilePermissionsUserRW);
+ Error error;
+ uint32_t permissions = source_file.GetPermissions(error);
+ if (permissions == 0)
+ permissions = lldb::eFilePermissionsFileDefault;
+
if (!source_file.IsValid())
return Error("unable to open source file");
- Error error;
lldb::user_id_t dest_file = OpenFile (destination,
File::eOpenOptionCanCreate | File::eOpenOptionWrite | File::eOpenOptionTruncate,
- File::ePermissionsUserRWX | File::ePermissionsGroupRX | File::ePermissionsWorldRX,
+ permissions,
error);
if (log)
log->Printf ("dest_file = %" PRIu64 "\n", dest_file);
@@ -314,45 +339,52 @@ lldb::user_id_t
PlatformPOSIX::GetFileSize (const FileSpec& file_spec)
{
if (IsHost())
- {
return Host::GetFileSize(file_spec);
- }
- if (IsRemote() && m_remote_platform_sp)
+ else if (m_remote_platform_sp)
return m_remote_platform_sp->GetFileSize(file_spec);
- return Platform::GetFileSize(file_spec);
+ else
+ return Platform::GetFileSize(file_spec);
+}
+
+Error
+PlatformPOSIX::CreateSymlink(const char *src, const char *dst)
+{
+ if (IsHost())
+ return Host::Symlink(src, dst);
+ else if (m_remote_platform_sp)
+ return m_remote_platform_sp->CreateSymlink(src, dst);
+ else
+ return Platform::CreateSymlink(src, dst);
}
bool
PlatformPOSIX::GetFileExists (const FileSpec& file_spec)
{
if (IsHost())
- {
return file_spec.Exists();
- }
- if (IsRemote() && m_remote_platform_sp)
+ else if (m_remote_platform_sp)
return m_remote_platform_sp->GetFileExists(file_spec);
- return Platform::GetFileExists(file_spec);
+ else
+ return Platform::GetFileExists(file_spec);
}
-uint32_t
-PlatformPOSIX::GetFilePermissions (const lldb_private::FileSpec &file_spec,
- lldb_private::Error &error)
+Error
+PlatformPOSIX::Unlink (const char *path)
{
if (IsHost())
- {
- return File::GetPermissions(file_spec.GetPath().c_str(), error);
- }
- if (IsRemote() && m_remote_platform_sp)
- return m_remote_platform_sp->GetFilePermissions(file_spec, error);
- return Platform::GetFilePermissions(file_spec, error);
-
+ return Host::Unlink (path);
+ else if (m_remote_platform_sp)
+ return m_remote_platform_sp->Unlink(path);
+ else
+ return Platform::Unlink(path);
}
-
lldb_private::Error
PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path */,
- const lldb_private::FileSpec& destination /* local file path */)
+ const lldb_private::FileSpec& destination /* local file path */)
{
+ Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
+
// Check the args, first.
std::string src_path (source.GetPath());
if (src_path.empty())
@@ -378,7 +410,7 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path
return Error("unable to perform copy");
return Error();
}
- else if (IsRemote() && m_remote_platform_sp)
+ else if (m_remote_platform_sp)
{
if (GetSupportsRSync())
{
@@ -403,7 +435,6 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path
m_remote_platform_sp->GetHostname(),
src_path.c_str(),
dst_path.c_str());
- Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
if (log)
log->Printf("[GetFile] Running command: %s\n", command.GetData());
int retcode;
@@ -421,22 +452,22 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path
// read/write, read/write, read/write, ...
// close src
// close dst
- Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
- if (log)
- log->Printf("[GetFile] Using block by block transfer....\n");
+ if (log)
+ log->Printf("[GetFile] Using block by block transfer....\n");
Error error;
user_id_t fd_src = OpenFile (source,
File::eOpenOptionRead,
- File::ePermissionsDefault,
+ lldb::eFilePermissionsFileDefault,
error);
if (fd_src == UINT64_MAX)
return Error("unable to open source file");
- uint32_t permissions = GetFilePermissions(source, error);
+ uint32_t permissions = 0;
+ error = GetFilePermissions(source.GetPath().c_str(), permissions);
if (permissions == 0)
- permissions = File::ePermissionsDefault;
+ permissions = lldb::eFilePermissionsFileDefault;
user_id_t fd_dst = Host::OpenFile(destination,
File::eOpenOptionCanCreate | File::eOpenOptionWrite | File::eOpenOptionTruncate,
@@ -539,3 +570,22 @@ PlatformPOSIX::CalculateMD5 (const FileSpec& file_spec,
return m_remote_platform_sp->CalculateMD5(file_spec, low, high);
return false;
}
+
+lldb_private::ConstString
+PlatformPOSIX::GetRemoteWorkingDirectory()
+{
+ if (IsRemote() && m_remote_platform_sp)
+ return m_remote_platform_sp->GetRemoteWorkingDirectory();
+ else
+ return Platform::GetRemoteWorkingDirectory();
+}
+
+bool
+PlatformPOSIX::SetRemoteWorkingDirectory(const lldb_private::ConstString &path)
+{
+ if (IsRemote() && m_remote_platform_sp)
+ return m_remote_platform_sp->SetRemoteWorkingDirectory(path);
+ else
+ return Platform::SetRemoteWorkingDirectory(path);
+}
+
diff --git a/source/Plugins/Platform/POSIX/PlatformPOSIX.h b/source/Plugins/Platform/POSIX/PlatformPOSIX.h
index 4119e452bf7f..336e0f90fcad 100644
--- a/source/Plugins/Platform/POSIX/PlatformPOSIX.h
+++ b/source/Plugins/Platform/POSIX/PlatformPOSIX.h
@@ -43,7 +43,7 @@ public:
virtual lldb::user_id_t
OpenFile (const lldb_private::FileSpec& file_spec,
uint32_t flags,
- mode_t mode,
+ uint32_t mode,
lldb_private::Error &error);
virtual bool
@@ -68,9 +68,18 @@ public:
GetFileSize (const lldb_private::FileSpec& file_spec);
virtual lldb_private::Error
+ CreateSymlink(const char *src, const char *dst);
+
+ virtual lldb_private::Error
GetFile (const lldb_private::FileSpec& source,
const lldb_private::FileSpec& destination);
+ virtual lldb_private::ConstString
+ GetRemoteWorkingDirectory();
+
+ virtual bool
+ SetRemoteWorkingDirectory(const lldb_private::ConstString &path);
+
virtual lldb_private::Error
RunShellCommand (const char *command, // Shouldn't be NULL
const char *working_dir, // Pass NULL to use the current working directory
@@ -79,16 +88,20 @@ public:
std::string *command_output, // Pass NULL if you don't want the command output
uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
- virtual uint32_t
- MakeDirectory (const std::string &path,
- mode_t mode);
+ virtual lldb_private::Error
+ MakeDirectory (const char *path, uint32_t mode);
+ virtual lldb_private::Error
+ GetFilePermissions (const char *path, uint32_t &file_permissions);
+
+ virtual lldb_private::Error
+ SetFilePermissions (const char *path, uint32_t file_permissions);
+
virtual bool
GetFileExists (const lldb_private::FileSpec& file_spec);
- virtual uint32_t
- GetFilePermissions (const lldb_private::FileSpec &file_spec,
- lldb_private::Error &error);
+ virtual lldb_private::Error
+ Unlink (const char *path);
virtual std::string
GetPlatformSpecificConnectionInformation();
diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 4aeec032d712..248abaf6fea7 100644
--- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -194,6 +194,47 @@ PlatformRemoteGDBServer::GetRemoteSystemArchitecture ()
return m_gdb_client.GetSystemArchitecture();
}
+lldb_private::ConstString
+PlatformRemoteGDBServer::GetRemoteWorkingDirectory()
+{
+ if (IsConnected())
+ {
+ Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
+ std::string cwd;
+ if (m_gdb_client.GetWorkingDir(cwd))
+ {
+ ConstString working_dir(cwd.c_str());
+ if (log)
+ log->Printf("PlatformRemoteGDBServer::GetRemoteWorkingDirectory() -> '%s'", working_dir.GetCString());
+ return working_dir;
+ }
+ else
+ {
+ return ConstString();
+ }
+ }
+ else
+ {
+ return Platform::GetRemoteWorkingDirectory();
+ }
+}
+
+bool
+PlatformRemoteGDBServer::SetRemoteWorkingDirectory(const lldb_private::ConstString &path)
+{
+ if (IsConnected())
+ {
+ // Clear the working directory it case it doesn't get set correctly. This will
+ // for use to re-read it
+ Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
+ if (log)
+ log->Printf("PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')", path.GetCString());
+ return m_gdb_client.SetWorkingDir(path.GetCString()) == 0;
+ }
+ else
+ return Platform::SetRemoteWorkingDirectory(path);
+}
+
bool
PlatformRemoteGDBServer::IsConnected () const
{
@@ -220,8 +261,10 @@ PlatformRemoteGDBServer::ConnectRemote (Args& args)
{
if (m_gdb_client.HandshakeWithServer(&error))
{
- m_gdb_client.QueryNoAckModeSupported();
m_gdb_client.GetHostInfo();
+ // If a working directory was set prior to connecting, send it down now
+ if (m_working_dir)
+ m_gdb_client.SetWorkingDir(m_working_dir.GetCString());
#if 0
m_gdb_client.TestPacketSpeed(10000);
#endif
@@ -229,6 +272,8 @@ PlatformRemoteGDBServer::ConnectRemote (Args& args)
else
{
m_gdb_client.Disconnect();
+ if (error.Success())
+ error.SetErrorString("handshake failed");
}
}
}
@@ -237,11 +282,6 @@ PlatformRemoteGDBServer::ConnectRemote (Args& args)
error.SetErrorString ("\"platform connect\" takes a single argument: <connect-url>");
}
}
-
- if (error.Success())
- {
-
- }
return error;
}
@@ -324,7 +364,6 @@ PlatformRemoteGDBServer::LaunchProcess (ProcessLaunchInfo &launch_info)
}
// Send the environment and the program + arguments after we connect
- const char **argv = launch_info.GetArguments().GetConstArgumentVector();
const char **envp = launch_info.GetEnvironmentEntries().GetConstArgumentVector();
if (envp)
@@ -343,7 +382,7 @@ PlatformRemoteGDBServer::LaunchProcess (ProcessLaunchInfo &launch_info)
m_gdb_client.SendLaunchArchPacket(arch_triple);
const uint32_t old_packet_timeout = m_gdb_client.SetPacketTimeout (5);
- int arg_packet_err = m_gdb_client.SendArgumentsPacket (argv);
+ int arg_packet_err = m_gdb_client.SendArgumentsPacket (launch_info);
m_gdb_client.SetPacketTimeout (old_packet_timeout);
if (arg_packet_err == 0)
{
@@ -367,6 +406,80 @@ PlatformRemoteGDBServer::LaunchProcess (ProcessLaunchInfo &launch_info)
}
lldb::ProcessSP
+PlatformRemoteGDBServer::DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
+ lldb_private::Debugger &debugger,
+ lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ lldb_private::Listener &listener,
+ lldb_private::Error &error)
+{
+ lldb::ProcessSP process_sp;
+ if (IsRemote())
+ {
+ if (IsConnected())
+ {
+ lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID;
+ uint16_t port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid);
+
+ if (port == 0)
+ {
+ error.SetErrorStringWithFormat ("unable to launch a GDB server on '%s'", GetHostname ());
+ }
+ else
+ {
+ if (target == NULL)
+ {
+ TargetSP new_target_sp;
+
+ error = debugger.GetTargetList().CreateTarget (debugger,
+ NULL,
+ NULL,
+ false,
+ NULL,
+ new_target_sp);
+ target = new_target_sp.get();
+ }
+ else
+ error.Clear();
+
+ if (target && error.Success())
+ {
+ debugger.GetTargetList().SetSelectedTarget(target);
+
+ // The darwin always currently uses the GDB remote debugger plug-in
+ // so even when debugging locally we are debugging remotely!
+ process_sp = target->CreateProcess (listener, "gdb-remote", NULL);
+
+ if (process_sp)
+ {
+ char connect_url[256];
+ const char *override_hostname = getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_HOSTNAME");
+ const char *port_offset_c_str = getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_PORT_OFFSET");
+ int port_offset = port_offset_c_str ? ::atoi(port_offset_c_str) : 0;
+ const int connect_url_len = ::snprintf (connect_url,
+ sizeof(connect_url),
+ "connect://%s:%u",
+ override_hostname ? override_hostname : GetHostname (),
+ port + port_offset);
+ assert (connect_url_len < (int)sizeof(connect_url));
+ error = process_sp->ConnectRemote (NULL, connect_url);
+ if (error.Success())
+ error = process_sp->Launch(launch_info);
+ else if (debugserver_pid != LLDB_INVALID_PROCESS_ID)
+ m_gdb_client.KillSpawnedProcess(debugserver_pid);
+ }
+ }
+ }
+ }
+ else
+ {
+ error.SetErrorString("not connected to remote gdb server");
+ }
+ }
+ return process_sp;
+
+}
+
+lldb::ProcessSP
PlatformRemoteGDBServer::Attach (lldb_private::ProcessAttachInfo &attach_info,
Debugger &debugger,
Target *target, // Can be NULL, if NULL create a new target, else use existing one
@@ -441,17 +554,42 @@ PlatformRemoteGDBServer::Attach (lldb_private::ProcessAttachInfo &attach_info,
return process_sp;
}
-uint32_t
-PlatformRemoteGDBServer::MakeDirectory (const std::string &path,
- mode_t mode)
+Error
+PlatformRemoteGDBServer::MakeDirectory (const char *path, uint32_t mode)
{
- return m_gdb_client.MakeDirectory(path,mode);
+ Error error = m_gdb_client.MakeDirectory(path,mode);
+ Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
+ if (log)
+ log->Printf ("PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) error = %u (%s)", path, mode, error.GetError(), error.AsCString());
+ return error;
}
+
+Error
+PlatformRemoteGDBServer::GetFilePermissions (const char *path, uint32_t &file_permissions)
+{
+ Error error = m_gdb_client.GetFilePermissions(path, file_permissions);
+ Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
+ if (log)
+ log->Printf ("PlatformRemoteGDBServer::GetFilePermissions(path='%s', file_permissions=%o) error = %u (%s)", path, file_permissions, error.GetError(), error.AsCString());
+ return error;
+}
+
+Error
+PlatformRemoteGDBServer::SetFilePermissions (const char *path, uint32_t file_permissions)
+{
+ Error error = m_gdb_client.SetFilePermissions(path, file_permissions);
+ Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
+ if (log)
+ log->Printf ("PlatformRemoteGDBServer::SetFilePermissions(path='%s', file_permissions=%o) error = %u (%s)", path, file_permissions, error.GetError(), error.AsCString());
+ return error;
+}
+
+
lldb::user_id_t
PlatformRemoteGDBServer::OpenFile (const lldb_private::FileSpec& file_spec,
uint32_t flags,
- mode_t mode,
+ uint32_t mode,
Error &error)
{
return m_gdb_client.OpenFile (file_spec, flags, mode, error);
@@ -469,13 +607,6 @@ PlatformRemoteGDBServer::GetFileSize (const lldb_private::FileSpec& file_spec)
return m_gdb_client.GetFileSize(file_spec);
}
-uint32_t
-PlatformRemoteGDBServer::GetFilePermissions (const lldb_private::FileSpec &file_spec,
- lldb_private::Error &error)
-{
- return m_gdb_client.GetFilePermissions(file_spec, error);
-}
-
uint64_t
PlatformRemoteGDBServer::ReadFile (lldb::user_id_t fd,
uint64_t offset,
@@ -505,6 +636,27 @@ PlatformRemoteGDBServer::PutFile (const lldb_private::FileSpec& source,
return Platform::PutFile(source,destination,uid,gid);
}
+Error
+PlatformRemoteGDBServer::CreateSymlink (const char *src, // The name of the link is in src
+ const char *dst) // The symlink points to dst
+{
+ Error error = m_gdb_client.CreateSymlink (src, dst);
+ Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
+ if (log)
+ log->Printf ("PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') error = %u (%s)", src, dst, error.GetError(), error.AsCString());
+ return error;
+}
+
+Error
+PlatformRemoteGDBServer::Unlink (const char *path)
+{
+ Error error = m_gdb_client.Unlink (path);
+ Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
+ if (log)
+ log->Printf ("PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)", path, error.GetError(), error.AsCString());
+ return error;
+}
+
bool
PlatformRemoteGDBServer::GetFileExists (const lldb_private::FileSpec& file_spec)
{
diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index 70db6bafacd2..808fb5ed61cc 100644
--- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -89,6 +89,13 @@ public:
LaunchProcess (lldb_private::ProcessLaunchInfo &launch_info);
virtual lldb::ProcessSP
+ DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
+ lldb_private::Debugger &debugger,
+ lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ lldb_private::Listener &listener,
+ lldb_private::Error &error);
+
+ virtual lldb::ProcessSP
Attach (lldb_private::ProcessAttachInfo &attach_info,
lldb_private::Debugger &debugger,
lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
@@ -115,6 +122,13 @@ public:
virtual lldb_private::ArchSpec
GetRemoteSystemArchitecture ();
+ virtual lldb_private::ConstString
+ GetRemoteWorkingDirectory();
+
+ virtual bool
+ SetRemoteWorkingDirectory(const lldb_private::ConstString &path);
+
+
// Remote subclasses should override this and return a valid instance
// name if connected.
virtual const char *
@@ -135,14 +149,20 @@ public:
virtual lldb_private::Error
DisconnectRemote ();
- virtual uint32_t
- MakeDirectory (const std::string &path,
- mode_t mode);
+ virtual lldb_private::Error
+ MakeDirectory (const char *path, uint32_t file_permissions);
+
+ virtual lldb_private::Error
+ GetFilePermissions (const char *path, uint32_t &file_permissions);
+
+ virtual lldb_private::Error
+ SetFilePermissions (const char *path, uint32_t file_permissions);
+
virtual lldb::user_id_t
OpenFile (const lldb_private::FileSpec& file_spec,
uint32_t flags,
- mode_t mode,
+ uint32_t mode,
lldb_private::Error &error);
virtual bool
@@ -172,12 +192,14 @@ public:
uint32_t uid = UINT32_MAX,
uint32_t gid = UINT32_MAX);
+ virtual lldb_private::Error
+ CreateSymlink (const char *src, const char *dst);
+
virtual bool
GetFileExists (const lldb_private::FileSpec& file_spec);
-
- virtual uint32_t
- GetFilePermissions (const lldb_private::FileSpec &file_spec,
- lldb_private::Error &error);
+
+ virtual lldb_private::Error
+ Unlink (const char *path);
virtual lldb_private::Error
RunShellCommand (const char *command, // Shouldn't be NULL