diff options
Diffstat (limited to 'source/Plugins/Platform')
| -rw-r--r-- | source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp | 66 | ||||
| -rw-r--r-- | source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h | 2 | ||||
| -rw-r--r-- | source/Plugins/Platform/POSIX/PlatformPOSIX.cpp | 216 | ||||
| -rw-r--r-- | source/Plugins/Platform/POSIX/PlatformPOSIX.h | 41 | ||||
| -rw-r--r-- | source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp | 33 |
5 files changed, 297 insertions, 61 deletions
diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 7eca67ac7f57..7aa940a530b4 100644 --- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -1,4 +1,4 @@ -//===-- PlatformFreeBSD.cpp ---------------------------------------*- C++ -*-===// +//===-- PlatformFreeBSD.cpp -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -27,6 +27,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Host/Host.h" +#include "lldb/Host/HostInfo.h" using namespace lldb; using namespace lldb_private; @@ -47,10 +48,10 @@ PlatformFreeBSD::CreateInstance (bool force, const lldb_private::ArchSpec *arch) case llvm::Triple::PC: create = true; break; - + #if defined(__FreeBSD__) || defined(__OpenBSD__) // Only accept "unknown" for the vendor if the host is BSD and - // it "unknown" wasn't specified (it was just returned becasue it + // it "unknown" wasn't specified (it was just returned because it // was NOT specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); @@ -59,7 +60,7 @@ PlatformFreeBSD::CreateInstance (bool force, const lldb_private::ArchSpec *arch) default: break; } - + if (create) { switch (triple.getOS()) @@ -67,10 +68,10 @@ PlatformFreeBSD::CreateInstance (bool force, const lldb_private::ArchSpec *arch) case llvm::Triple::FreeBSD: case llvm::Triple::KFreeBSD: break; - + #if defined(__FreeBSD__) || defined(__OpenBSD__) // Only accept "unknown" for the OS if the host is BSD and - // it "unknown" wasn't specified (it was just returned becasue it + // it "unknown" wasn't specified (it was just returned because it // was NOT specified) case llvm::Triple::UnknownOS: create = arch->TripleOSWasSpecified(); @@ -122,7 +123,7 @@ PlatformFreeBSD::Initialize () #if defined (__FreeBSD__) // Force a host flag to true for the default platform object. PlatformSP default_platform_sp (new PlatformFreeBSD(true)); - default_platform_sp->SetSystemArchitecture (Host::GetArchitecture()); + default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture()); Platform::SetDefaultPlatform (default_platform_sp); #endif PluginManager::RegisterPlugin(PlatformFreeBSD::GetPluginNameStatic(false), @@ -186,10 +187,10 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, { Error error; // Nothing special to do here, just use the actual file and architecture - + char exe_path[PATH_MAX]; FileSpec resolved_exe_file (exe_file); - + if (IsHost()) { // If we have "ls" as the exe_file, resolve the executable location based on @@ -199,10 +200,10 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, exe_file.GetPath(exe_path, sizeof(exe_path)); resolved_exe_file.SetFile(exe_path, true); } - + if (!resolved_exe_file.Exists()) resolved_exe_file.ResolveExecutableLocation (); - + if (resolved_exe_file.Exists()) error.Clear(); else @@ -223,10 +224,10 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, else { // We may connect to a process and use the provided executable (Don't use local $PATH). - + // Resolve any executable within a bundle on MacOSX Host::ResolveExecutableInBundle (resolved_exe_file); - + if (resolved_exe_file.Exists()) { error.Clear(); } @@ -248,7 +249,7 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, module_search_paths_ptr, NULL, NULL); - + if (!exe_module_sp || exe_module_sp->GetObjectFile() == NULL) { exe_module_sp.reset(); @@ -279,18 +280,25 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file, else error.SetErrorToGenericError(); } - + if (idx > 0) arch_names.PutCString (", "); arch_names.PutCString (platform_arch.GetArchitectureName()); } - + if (error.Fail() || !exe_module_sp) { - error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", - exe_file.GetPath().c_str(), - GetPluginName().GetCString(), - arch_names.GetString().c_str()); + if (exe_file.Readable()) + { + error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s", + exe_file.GetPath().c_str(), + GetPluginName().GetCString(), + arch_names.GetString().c_str()); + } + else + { + error.SetErrorStringWithFormat("'%s' is not readable", exe_file.GetPath().c_str()); + } } } } @@ -305,15 +313,13 @@ PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite const uint8_t *trap_opcode = NULL; size_t trap_opcode_size = 0; - switch (arch.GetCore()) + switch (arch.GetMachine()) { default: assert(false && "Unhandled architecture in PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode()"); break; - - case ArchSpec::eCore_x86_32_i386: - case ArchSpec::eCore_x86_64_x86_64: - case ArchSpec::eCore_x86_64_x86_64h: + case llvm::Triple::x86: + case llvm::Triple::x86_64: { static const uint8_t g_i386_opcode[] = { 0xCC }; trap_opcode = g_i386_opcode; @@ -451,7 +457,7 @@ PlatformFreeBSD::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &process_i { success = Platform::GetProcessInfo (pid, process_info); } - else if (m_remote_platform_sp) + else if (m_remote_platform_sp) { success = m_remote_platform_sp->GetProcessInfo (pid, process_info); } @@ -633,19 +639,19 @@ PlatformFreeBSD::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch) // From macosx;s plugin code. For FreeBSD we may want to support more archs. if (idx == 0) { - arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture); + arch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); return arch.IsValid(); } else if (idx == 1) { - ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture)); - ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64)); + ArchSpec platform_arch(HostInfo::GetArchitecture(HostInfo::eArchKindDefault)); + ArchSpec platform_arch64(HostInfo::GetArchitecture(HostInfo::eArchKind64)); if (platform_arch.IsExactMatch(platform_arch64)) { // This freebsd platform supports both 32 and 64 bit. Since we already // returned the 64 bit arch for idx == 0, return the 32 bit arch // for idx == 1 - arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32); + arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); return arch.IsValid(); } } diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h index 0682eacc5a43..62958a08a9e0 100644 --- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@ -1,4 +1,4 @@ -//===-- PlatformFreeBSD.h -----------------------------------------*- C++ -*-===// +//===-- PlatformFreeBSD.h ---------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // diff --git a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index bb07d999c4c2..cc4c693e1b43 100644 --- a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -18,8 +18,11 @@ #include "lldb/Core/Log.h" #include "lldb/Core/StreamString.h" #include "lldb/Host/File.h" +#include "lldb/Host/FileCache.h" #include "lldb/Host/FileSpec.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" +#include "lldb/Target/ProcessLaunchInfo.h" using namespace lldb; using namespace lldb_private; @@ -57,6 +60,16 @@ PlatformPOSIX::GetConnectionOptions (lldb_private::CommandInterpreter& interpret return m_options.get(); } +bool +PlatformPOSIX::IsConnected () const +{ + if (IsHost()) + return true; + else if (m_remote_platform_sp) + return m_remote_platform_sp->IsConnected(); + return false; +} + lldb_private::Error PlatformPOSIX::RunShellCommand (const char *command, // Shouldn't be NULL const char *working_dir, // Pass NULL to use the current working directory @@ -98,7 +111,7 @@ Error PlatformPOSIX::SetFilePermissions (const char *path, uint32_t file_permissions) { if (m_remote_platform_sp) - return m_remote_platform_sp->MakeDirectory(path, file_permissions); + return m_remote_platform_sp->SetFilePermissions(path, file_permissions); else return Platform::SetFilePermissions(path ,file_permissions); } @@ -110,7 +123,7 @@ PlatformPOSIX::OpenFile (const FileSpec& file_spec, Error &error) { if (IsHost()) - return Host::OpenFile(file_spec, flags, mode, error); + return FileCache::GetInstance().OpenFile(file_spec, flags, mode, error); else if (m_remote_platform_sp) return m_remote_platform_sp->OpenFile(file_spec, flags, mode, error); else @@ -121,7 +134,7 @@ bool PlatformPOSIX::CloseFile (lldb::user_id_t fd, Error &error) { if (IsHost()) - return Host::CloseFile(fd, error); + return FileCache::GetInstance().CloseFile(fd, error); else if (m_remote_platform_sp) return m_remote_platform_sp->CloseFile(fd, error); else @@ -136,7 +149,7 @@ PlatformPOSIX::ReadFile (lldb::user_id_t fd, Error &error) { if (IsHost()) - return Host::ReadFile(fd, offset, dst, dst_len, error); + return FileCache::GetInstance().ReadFile(fd, offset, dst, dst_len, error); else if (m_remote_platform_sp) return m_remote_platform_sp->ReadFile(fd, offset, dst, dst_len, error); else @@ -151,7 +164,7 @@ PlatformPOSIX::WriteFile (lldb::user_id_t fd, Error &error) { if (IsHost()) - return Host::WriteFile(fd, offset, src, src_len, error); + return FileCache::GetInstance().WriteFile(fd, offset, src, src_len, error); else if (m_remote_platform_sp) return m_remote_platform_sp->WriteFile(fd, offset, src, src_len, error); else @@ -339,7 +352,7 @@ lldb::user_id_t PlatformPOSIX::GetFileSize (const FileSpec& file_spec) { if (IsHost()) - return Host::GetFileSize(file_spec); + return FileSystem::GetFileSize(file_spec); else if (m_remote_platform_sp) return m_remote_platform_sp->GetFileSize(file_spec); else @@ -350,7 +363,7 @@ Error PlatformPOSIX::CreateSymlink(const char *src, const char *dst) { if (IsHost()) - return Host::Symlink(src, dst); + return FileSystem::Symlink(src, dst); else if (m_remote_platform_sp) return m_remote_platform_sp->CreateSymlink(src, dst); else @@ -372,7 +385,7 @@ Error PlatformPOSIX::Unlink (const char *path) { if (IsHost()) - return Host::Unlink (path); + return FileSystem::Unlink(path); else if (m_remote_platform_sp) return m_remote_platform_sp->Unlink(path); else @@ -469,10 +482,9 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path if (permissions == 0) permissions = lldb::eFilePermissionsFileDefault; - user_id_t fd_dst = Host::OpenFile(destination, - File::eOpenOptionCanCreate | File::eOpenOptionWrite | File::eOpenOptionTruncate, - permissions, - error); + user_id_t fd_dst = FileCache::GetInstance().OpenFile( + destination, File::eOpenOptionCanCreate | File::eOpenOptionWrite | File::eOpenOptionTruncate, permissions, + error); if (fd_dst == UINT64_MAX) { @@ -496,15 +508,11 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path break; if (n_read == 0) break; - if (Host::WriteFile(fd_dst, - offset, - buffer_sp->GetBytes(), - n_read, - error) != n_read) + if (FileCache::GetInstance().WriteFile(fd_dst, offset, buffer_sp->GetBytes(), n_read, error) != n_read) { if (!error.Fail()) error.SetErrorString("unable to write to destination file"); - break; + break; } offset += n_read; } @@ -513,7 +521,7 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path if (fd_src != UINT64_MAX) CloseFile(fd_src, error); // And close the dst file descriptot. - if (fd_dst != UINT64_MAX && !Host::CloseFile(fd_dst, error)) + if (fd_dst != UINT64_MAX && !FileCache::GetInstance().CloseFile(fd_dst, error)) { if (!error.Fail()) error.SetErrorString("unable to close destination file"); @@ -589,6 +597,176 @@ PlatformPOSIX::SetRemoteWorkingDirectory(const lldb_private::ConstString &path) return Platform::SetRemoteWorkingDirectory(path); } +bool +PlatformPOSIX::GetRemoteOSVersion () +{ + if (m_remote_platform_sp) + return m_remote_platform_sp->GetOSVersion (m_major_os_version, + m_minor_os_version, + m_update_os_version); + return false; +} + +bool +PlatformPOSIX::GetRemoteOSBuildString (std::string &s) +{ + if (m_remote_platform_sp) + return m_remote_platform_sp->GetRemoteOSBuildString (s); + s.clear(); + return false; +} + +bool +PlatformPOSIX::GetRemoteOSKernelDescription (std::string &s) +{ + if (m_remote_platform_sp) + return m_remote_platform_sp->GetRemoteOSKernelDescription (s); + s.clear(); + return false; +} + +// Remote Platform subclasses need to override this function +ArchSpec +PlatformPOSIX::GetRemoteSystemArchitecture () +{ + if (m_remote_platform_sp) + return m_remote_platform_sp->GetRemoteSystemArchitecture (); + return ArchSpec(); +} + +const char * +PlatformPOSIX::GetHostname () +{ + if (IsHost()) + return Platform::GetHostname(); + + if (m_remote_platform_sp) + return m_remote_platform_sp->GetHostname (); + return NULL; +} + +const char * +PlatformPOSIX::GetUserName (uint32_t uid) +{ + // Check the cache in Platform in case we have already looked this uid up + const char *user_name = Platform::GetUserName(uid); + if (user_name) + return user_name; + + if (IsRemote() && m_remote_platform_sp) + return m_remote_platform_sp->GetUserName(uid); + return NULL; +} + +const char * +PlatformPOSIX::GetGroupName (uint32_t gid) +{ + const char *group_name = Platform::GetGroupName(gid); + if (group_name) + return group_name; + + if (IsRemote() && m_remote_platform_sp) + return m_remote_platform_sp->GetGroupName(gid); + return NULL; +} + +Error +PlatformPOSIX::ConnectRemote (Args& args) +{ + Error error; + if (IsHost()) + { + error.SetErrorStringWithFormat ("can't connect to the host platform '%s', always connected", GetPluginName().GetCString()); + } + else + { + if (!m_remote_platform_sp) + m_remote_platform_sp = Platform::Create ("remote-gdb-server", error); + + if (m_remote_platform_sp && error.Success()) + error = m_remote_platform_sp->ConnectRemote (args); + else + error.SetErrorString ("failed to create a 'remote-gdb-server' platform"); + + if (error.Fail()) + m_remote_platform_sp.reset(); + } + + if (error.Success() && m_remote_platform_sp) + { + if (m_options.get()) + { + OptionGroupOptions* options = m_options.get(); + OptionGroupPlatformRSync* m_rsync_options = (OptionGroupPlatformRSync*)options->GetGroupWithOption('r'); + OptionGroupPlatformSSH* m_ssh_options = (OptionGroupPlatformSSH*)options->GetGroupWithOption('s'); + OptionGroupPlatformCaching* m_cache_options = (OptionGroupPlatformCaching*)options->GetGroupWithOption('c'); + + if (m_rsync_options->m_rsync) + { + SetSupportsRSync(true); + SetRSyncOpts(m_rsync_options->m_rsync_opts.c_str()); + SetRSyncPrefix(m_rsync_options->m_rsync_prefix.c_str()); + SetIgnoresRemoteHostname(m_rsync_options->m_ignores_remote_hostname); + } + if (m_ssh_options->m_ssh) + { + SetSupportsSSH(true); + SetSSHOpts(m_ssh_options->m_ssh_opts.c_str()); + } + SetLocalCacheDirectory(m_cache_options->m_cache_dir.c_str()); + } + } + + return error; +} + +Error +PlatformPOSIX::DisconnectRemote () +{ + Error error; + + if (IsHost()) + { + error.SetErrorStringWithFormat ("can't disconnect from the host platform '%s', always connected", GetPluginName().GetCString()); + } + else + { + if (m_remote_platform_sp) + error = m_remote_platform_sp->DisconnectRemote (); + else + error.SetErrorString ("the platform is not currently connected"); + } + return error; +} + +lldb::ProcessSP +PlatformPOSIX::DebugProcess (ProcessLaunchInfo &launch_info, + Debugger &debugger, + Target *target, // Can be NULL, if NULL create a new target, else use existing one + Listener &listener, + Error &error) +{ + ProcessSP process_sp; + + if (IsHost()) + { + // We are going to hand this process off to debugserver which will be in charge of setting the exit status. + // We still need to reap it from lldb but if we let the monitor thread also set the exit status, we set up a + // race between debugserver & us for who will find out about the debugged process's death. + launch_info.GetFlags().Set(eLaunchFlagDontSetExitStatus); + process_sp = Platform::DebugProcess (launch_info, debugger, target, listener, error); + } + else + { + if (m_remote_platform_sp) + process_sp = m_remote_platform_sp->DebugProcess (launch_info, debugger, target, listener, error); + else + error.SetErrorString ("the platform is not currently connected"); + } + return process_sp; + +} + void PlatformPOSIX::CalculateTrapHandlerSymbolNames () { diff --git a/source/Plugins/Platform/POSIX/PlatformPOSIX.h b/source/Plugins/Platform/POSIX/PlatformPOSIX.h index 130c84bdface..374e36495d88 100644 --- a/source/Plugins/Platform/POSIX/PlatformPOSIX.h +++ b/source/Plugins/Platform/POSIX/PlatformPOSIX.h @@ -33,7 +33,16 @@ public: //------------------------------------------------------------ virtual lldb_private::OptionGroupOptions* GetConnectionOptions (lldb_private::CommandInterpreter& interpreter); - + + const char * + GetHostname () override; + + const char * + GetUserName (uint32_t uid) override; + + const char * + GetGroupName (uint32_t gid) override; + virtual lldb_private::Error PutFile (const lldb_private::FileSpec& source, const lldb_private::FileSpec& destination, @@ -79,7 +88,22 @@ public: virtual bool SetRemoteWorkingDirectory(const lldb_private::ConstString &path); - + + bool + GetRemoteOSVersion () override; + + bool + GetRemoteOSBuildString (std::string &s) override; + + bool + GetRemoteOSKernelDescription (std::string &s) override; + + lldb_private::ArchSpec + GetRemoteSystemArchitecture () override; + + bool + IsConnected () const override; + virtual lldb_private::Error RunShellCommand (const char *command, // Shouldn't be NULL const char *working_dir, // Pass NULL to use the current working directory @@ -103,6 +127,13 @@ public: virtual lldb_private::Error Unlink (const char *path); + 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) override; + virtual std::string GetPlatformSpecificConnectionInformation(); @@ -114,6 +145,12 @@ public: virtual void CalculateTrapHandlerSymbolNames (); + lldb_private::Error + ConnectRemote (lldb_private::Args& args) override; + + lldb_private::Error + DisconnectRemote () override; + protected: std::unique_ptr<lldb_private::OptionGroupOptions> m_options; diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 3832265638db..05fbc5101278 100644 --- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -12,11 +12,6 @@ #include "PlatformRemoteGDBServer.h" #include "lldb/Host/Config.h" -// C Includes -#ifndef LLDB_DISABLE_POSIX -#include <sys/sysctl.h> -#endif - // C++ Includes // Other libraries and framework includes // Project includes @@ -24,6 +19,7 @@ #include "lldb/Core/ConnectionFileDescriptor.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Error.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/PluginManager.h" @@ -346,13 +342,18 @@ PlatformRemoteGDBServer::GetProcessInfo (lldb::pid_t pid, ProcessInstanceInfo &p Error PlatformRemoteGDBServer::LaunchProcess (ProcessLaunchInfo &launch_info) { + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM)); Error error; lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; - + + if (log) + log->Printf ("PlatformRemoteGDBServer::%s() called", __FUNCTION__); + m_gdb_client.SetSTDIN ("/dev/null"); m_gdb_client.SetSTDOUT ("/dev/null"); m_gdb_client.SetSTDERR ("/dev/null"); m_gdb_client.SetDisableASLR (launch_info.GetFlags().Test (eLaunchFlagDisableASLR)); + m_gdb_client.SetDetachOnError (launch_info.GetFlags().Test (eLaunchFlagDetachOnError)); const char *working_dir = launch_info.GetWorkingDirectory(); if (working_dir && working_dir[0]) @@ -377,7 +378,9 @@ PlatformRemoteGDBServer::LaunchProcess (ProcessLaunchInfo &launch_info) const char *arch_triple = arch_spec.GetTriple().str().c_str(); m_gdb_client.SendLaunchArchPacket(arch_triple); - + if (log) + log->Printf ("PlatformRemoteGDBServer::%s() set launch architecture triple to '%s'", __FUNCTION__, arch_triple ? arch_triple : "<NULL>"); + const uint32_t old_packet_timeout = m_gdb_client.SetPacketTimeout (5); int arg_packet_err = m_gdb_client.SendArgumentsPacket (launch_info); m_gdb_client.SetPacketTimeout (old_packet_timeout); @@ -388,11 +391,23 @@ PlatformRemoteGDBServer::LaunchProcess (ProcessLaunchInfo &launch_info) { pid = m_gdb_client.GetCurrentProcessID (); if (pid != LLDB_INVALID_PROCESS_ID) + { launch_info.SetProcessID (pid); + if (log) + log->Printf ("PlatformRemoteGDBServer::%s() pid %" PRIu64 " launched successfully", __FUNCTION__, pid); + } + else + { + if (log) + log->Printf ("PlatformRemoteGDBServer::%s() launch succeeded but we didn't get a valid process id back!", __FUNCTION__); + // FIXME isn't this an error condition? Do we need to set an error here? Check with Greg. + } } else { error.SetErrorString (error_str.c_str()); + if (log) + log->Printf ("PlatformRemoteGDBServer::%s() launch failed: %s", __FUNCTION__, error.AsCString ()); } } else @@ -423,7 +438,7 @@ PlatformRemoteGDBServer::DebugProcess (lldb_private::ProcessLaunchInfo &launch_i // When remote debugging to iOS, we use a USB mux that always talks // to localhost, so we will need the remote debugserver to accept connections // only from localhost, no matter what our current hostname is - port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "localhost"); + port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "127.0.0.1"); } else { @@ -511,7 +526,7 @@ PlatformRemoteGDBServer::Attach (lldb_private::ProcessAttachInfo &attach_info, // When remote debugging to iOS, we use a USB mux that always talks // to localhost, so we will need the remote debugserver to accept connections // only from localhost, no matter what our current hostname is - port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "localhost"); + port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, "127.0.0.1"); } else { |
