diff options
Diffstat (limited to 'source/Plugins/Platform')
6 files changed, 72 insertions, 16 deletions
diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index da29c16ac3abd..7eca67ac7f576 100644 --- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -142,7 +142,8 @@ PlatformFreeBSD::Terminate ()  /// Default Constructor  //------------------------------------------------------------------  PlatformFreeBSD::PlatformFreeBSD (bool is_host) : -Platform(is_host) +Platform(is_host), +m_remote_platform_sp()  {  } @@ -312,6 +313,7 @@ PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite      case ArchSpec::eCore_x86_32_i386:      case ArchSpec::eCore_x86_64_x86_64: +    case ArchSpec::eCore_x86_64_x86_64h:          {              static const uint8_t g_i386_opcode[] = { 0xCC };              trap_opcode = g_i386_opcode; @@ -571,14 +573,14 @@ PlatformFreeBSD::GetGroupName (uint32_t gid)  // From PlatformMacOSX only  Error -PlatformFreeBSD::GetFile (const FileSpec &platform_file, -                          const UUID *uuid_ptr, -                          FileSpec &local_file) +PlatformFreeBSD::GetFileWithUUID (const FileSpec &platform_file, +                                  const UUID *uuid_ptr, +                                  FileSpec &local_file)  {      if (IsRemote())      {          if (m_remote_platform_sp) -            return m_remote_platform_sp->GetFile (platform_file, uuid_ptr, local_file); +            return m_remote_platform_sp->GetFileWithUUID (platform_file, uuid_ptr, local_file);      }      // Default to the local case @@ -673,3 +675,9 @@ PlatformFreeBSD::GetStatus (Stream &strm)      Platform::GetStatus(strm);  } + +void +PlatformFreeBSD::CalculateTrapHandlerSymbolNames () +{ +    m_trap_handlers.push_back (ConstString ("_sigtramp")); +} diff --git a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h index 11d1cd6097793..0682eacc5a43a 100644 --- a/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@ -144,8 +144,8 @@ public:      // Only on PlatformMacOSX:      virtual lldb_private::Error -    GetFile (const lldb_private::FileSpec &platform_file, -             const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file); +    GetFileWithUUID (const lldb_private::FileSpec &platform_file, +                     const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file);      lldb_private::Error      GetSharedModule (const lldb_private::ModuleSpec &module_spec, @@ -160,6 +160,9 @@ public:      virtual void      GetStatus (lldb_private::Stream &strm); +    virtual void +    CalculateTrapHandlerSymbolNames (); +  protected:      lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote freebsd OS diff --git a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index b5f92dcc3dcd4..bb07d999c4c23 100644 --- a/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -589,3 +589,8 @@ PlatformPOSIX::SetRemoteWorkingDirectory(const lldb_private::ConstString &path)          return Platform::SetRemoteWorkingDirectory(path);  } +void +PlatformPOSIX::CalculateTrapHandlerSymbolNames () +{    +    m_trap_handlers.push_back (ConstString ("_sigtramp")); +}    diff --git a/source/Plugins/Platform/POSIX/PlatformPOSIX.h b/source/Plugins/Platform/POSIX/PlatformPOSIX.h index 336e0f90fcada..130c84bdfaced 100644 --- a/source/Plugins/Platform/POSIX/PlatformPOSIX.h +++ b/source/Plugins/Platform/POSIX/PlatformPOSIX.h @@ -111,8 +111,11 @@ public:                    uint64_t &low,                    uint64_t &high); +    virtual void +    CalculateTrapHandlerSymbolNames (); +  protected: -    std::auto_ptr<lldb_private::OptionGroupOptions> m_options; +    std::unique_ptr<lldb_private::OptionGroupOptions> m_options;      lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote POSIX-compliant OS diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 248abaf6fea77..ce5645ea74fe3 100644 --- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -119,9 +119,9 @@ PlatformRemoteGDBServer::ResolveExecutable (const FileSpec &exe_file,  }  Error -PlatformRemoteGDBServer::GetFile (const FileSpec &platform_file,  -                                  const UUID *uuid_ptr, -                                  FileSpec &local_file) +PlatformRemoteGDBServer::GetFileWithUUID (const FileSpec &platform_file,  +                                          const UUID *uuid_ptr, +                                          FileSpec &local_file)  {      // Default to the local case      local_file = platform_file; @@ -418,7 +418,21 @@ PlatformRemoteGDBServer::DebugProcess (lldb_private::ProcessLaunchInfo &launch_i          if (IsConnected())          {              lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID; -            uint16_t port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid); +            ArchSpec remote_arch = GetRemoteSystemArchitecture(); +            llvm::Triple &remote_triple = remote_arch.GetTriple(); +            uint16_t port = 0; +            if (remote_triple.getVendor() == llvm::Triple::Apple && remote_triple.getOS() == llvm::Triple::IOS) +            { +                // 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"); +            } +            else +            { +                // All other hosts should use their actual hostname +                port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, NULL); +            }              if (port == 0)              { @@ -492,7 +506,21 @@ PlatformRemoteGDBServer::Attach (lldb_private::ProcessAttachInfo &attach_info,          if (IsConnected())          {              lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID; -            uint16_t port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid); +            ArchSpec remote_arch = GetRemoteSystemArchitecture(); +            llvm::Triple &remote_triple = remote_arch.GetTriple(); +            uint16_t port = 0; +            if (remote_triple.getVendor() == llvm::Triple::Apple && remote_triple.getOS() == llvm::Triple::IOS) +            { +                // 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"); +            } +            else +            { +                // All other hosts should use their actual hostname +                port = m_gdb_client.LaunchGDBserverAndGetPort(debugserver_pid, NULL); +            }              if (port == 0)              { @@ -673,3 +701,9 @@ PlatformRemoteGDBServer::RunShellCommand (const char *command,           // Shou  {      return m_gdb_client.RunShellCommand (command, working_dir, status_ptr, signo_ptr, command_output, timeout_sec);  } + +void +PlatformRemoteGDBServer::CalculateTrapHandlerSymbolNames () +{    +    m_trap_handlers.push_back (ConstString ("_sigtramp")); +}    diff --git a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h index 808fb5ed61cc2..e236e97c8bb3b 100644 --- a/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h +++ b/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h @@ -73,9 +73,9 @@ public:      GetDescription ();      virtual lldb_private::Error -    GetFile (const lldb_private::FileSpec &platform_file,  -             const lldb_private::UUID *uuid_ptr, -             lldb_private::FileSpec &local_file); +    GetFileWithUUID (const lldb_private::FileSpec &platform_file,  +                     const lldb_private::UUID *uuid_ptr, +                     lldb_private::FileSpec &local_file);      virtual bool      GetProcessInfo (lldb::pid_t pid,  @@ -209,6 +209,9 @@ 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 void +    CalculateTrapHandlerSymbolNames (); +  protected:      GDBRemoteCommunicationClient m_gdb_client;      std::string m_platform_description; // After we connect we can get a more complete description of what we are connected to  | 
