diff options
Diffstat (limited to 'source/Host')
| -rw-r--r-- | source/Host/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | source/Host/common/File.cpp | 1 | ||||
| -rw-r--r-- | source/Host/common/Host.cpp | 1 | ||||
| -rw-r--r-- | source/Host/common/MainLoop.cpp | 1 | ||||
| -rw-r--r-- | source/Host/common/NativeRegisterContext.cpp | 67 | ||||
| -rw-r--r-- | source/Host/common/NativeThreadProtocol.cpp | 8 | ||||
| -rw-r--r-- | source/Host/common/Socket.cpp | 1 | ||||
| -rw-r--r-- | source/Host/common/SocketAddress.cpp | 7 | ||||
| -rw-r--r-- | source/Host/common/TCPSocket.cpp | 1 | ||||
| -rw-r--r-- | source/Host/linux/Host.cpp | 1 | ||||
| -rw-r--r-- | source/Host/linux/HostInfoLinux.cpp | 1 | ||||
| -rw-r--r-- | source/Host/posix/ConnectionFileDescriptorPosix.cpp | 1 | ||||
| -rw-r--r-- | source/Host/posix/FileSystem.cpp | 1 | ||||
| -rw-r--r-- | source/Host/posix/HostProcessPosix.cpp | 2 | ||||
| -rw-r--r-- | source/Host/posix/LockFilePosix.cpp | 1 | ||||
| -rw-r--r-- | source/Host/posix/ProcessLauncherPosixFork.cpp | 2 |
16 files changed, 56 insertions, 44 deletions
diff --git a/source/Host/CMakeLists.txt b/source/Host/CMakeLists.txt index 73d030e198af..2ee599cf43a2 100644 --- a/source/Host/CMakeLists.txt +++ b/source/Host/CMakeLists.txt @@ -103,6 +103,10 @@ else() macosx/cfcpp/CFCMutableSet.cpp macosx/cfcpp/CFCString.cpp ) + if(IOS) + set_property(SOURCE macosx/Host.mm APPEND PROPERTY + COMPILE_DEFINITIONS "NO_XPC_SERVICES=1") + endif() elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android") diff --git a/source/Host/common/File.cpp b/source/Host/common/File.cpp index 90a4462c6ca9..6ee4e894756b 100644 --- a/source/Host/common/File.cpp +++ b/source/Host/common/File.cpp @@ -21,6 +21,7 @@ #include <sys/ioctl.h> #include <sys/stat.h> #include <termios.h> +#include <unistd.h> #endif #include "llvm/Support/ConvertUTF.h" diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp index 29e5991d31aa..8248aa3c5118 100644 --- a/source/Host/common/Host.cpp +++ b/source/Host/common/Host.cpp @@ -46,6 +46,7 @@ #endif // C++ Includes +#include <csignal> // Other libraries and framework includes // Project includes diff --git a/source/Host/common/MainLoop.cpp b/source/Host/common/MainLoop.cpp index c0c4471e735f..d0e0d00a3151 100644 --- a/source/Host/common/MainLoop.cpp +++ b/source/Host/common/MainLoop.cpp @@ -10,6 +10,7 @@ #include "llvm/Config/llvm-config.h" #include "lldb/Host/MainLoop.h" +#include "lldb/Host/PosixApi.h" #include "lldb/Utility/Status.h" #include <algorithm> #include <cassert> diff --git a/source/Host/common/NativeRegisterContext.cpp b/source/Host/common/NativeRegisterContext.cpp index 2ca95d707963..629b0247422d 100644 --- a/source/Host/common/NativeRegisterContext.cpp +++ b/source/Host/common/NativeRegisterContext.cpp @@ -345,17 +345,12 @@ Status NativeRegisterContext::ReadRegisterValueFromMemory( return error; } - NativeProcessProtocolSP process_sp(m_thread.GetProcess()); - if (!process_sp) { - error.SetErrorString("invalid process"); - return error; - } - + NativeProcessProtocol &process = m_thread.GetProcess(); uint8_t src[RegisterValue::kMaxRegisterByteSize]; // Read the memory size_t bytes_read; - error = process_sp->ReadMemory(src_addr, src, src_len, bytes_read); + error = process.ReadMemory(src_addr, src, src_len, bytes_read); if (error.Fail()) return error; @@ -374,7 +369,7 @@ Status NativeRegisterContext::ReadRegisterValueFromMemory( // order of the memory data doesn't match the process. For now we are assuming // they are the same. lldb::ByteOrder byte_order; - if (!process_sp->GetByteOrder(byte_order)) { + if (process.GetByteOrder(byte_order)) { error.SetErrorString("NativeProcessProtocol::GetByteOrder () failed"); return error; } @@ -392,41 +387,37 @@ Status NativeRegisterContext::WriteRegisterValueToMemory( Status error; - NativeProcessProtocolSP process_sp(m_thread.GetProcess()); - if (process_sp) { + NativeProcessProtocol &process = m_thread.GetProcess(); - // TODO: we might need to add a parameter to this function in case the byte - // order of the memory data doesn't match the process. For now we are - // assuming - // they are the same. - lldb::ByteOrder byte_order; - if (!process_sp->GetByteOrder(byte_order)) - return Status("NativeProcessProtocol::GetByteOrder () failed"); + // TODO: we might need to add a parameter to this function in case the byte + // order of the memory data doesn't match the process. For now we are + // assuming + // they are the same. + lldb::ByteOrder byte_order; + if (!process.GetByteOrder(byte_order)) + return Status("NativeProcessProtocol::GetByteOrder () failed"); - const size_t bytes_copied = - reg_value.GetAsMemoryData(reg_info, dst, dst_len, byte_order, error); + const size_t bytes_copied = + reg_value.GetAsMemoryData(reg_info, dst, dst_len, byte_order, error); - if (error.Success()) { - if (bytes_copied == 0) { - error.SetErrorString("byte copy failed."); - } else { - size_t bytes_written; - error = - process_sp->WriteMemory(dst_addr, dst, bytes_copied, bytes_written); - if (error.Fail()) - return error; - - if (bytes_written != bytes_copied) { - // This might happen if we read _some_ bytes but not all - error.SetErrorStringWithFormat("only wrote %" PRIu64 " of %" PRIu64 - " bytes", - static_cast<uint64_t>(bytes_written), - static_cast<uint64_t>(bytes_copied)); - } + if (error.Success()) { + if (bytes_copied == 0) { + error.SetErrorString("byte copy failed."); + } else { + size_t bytes_written; + error = process.WriteMemory(dst_addr, dst, bytes_copied, bytes_written); + if (error.Fail()) + return error; + + if (bytes_written != bytes_copied) { + // This might happen if we read _some_ bytes but not all + error.SetErrorStringWithFormat("only wrote %" PRIu64 " of %" PRIu64 + " bytes", + static_cast<uint64_t>(bytes_written), + static_cast<uint64_t>(bytes_copied)); } } - } else - error.SetErrorString("invalid process"); + } return error; } diff --git a/source/Host/common/NativeThreadProtocol.cpp b/source/Host/common/NativeThreadProtocol.cpp index 29e25bbc5692..54ac96dd3c6f 100644 --- a/source/Host/common/NativeThreadProtocol.cpp +++ b/source/Host/common/NativeThreadProtocol.cpp @@ -16,9 +16,9 @@ using namespace lldb; using namespace lldb_private; -NativeThreadProtocol::NativeThreadProtocol(NativeProcessProtocol *process, +NativeThreadProtocol::NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid) - : m_process_wp(process->shared_from_this()), m_tid(tid) {} + : m_process(process), m_tid(tid) {} Status NativeThreadProtocol::ReadRegister(uint32_t reg, RegisterValue ®_value) { @@ -62,7 +62,3 @@ Status NativeThreadProtocol::RestoreAllRegisters(lldb::DataBufferSP &data_sp) { return Status("no register context"); return register_context_sp->ReadAllRegisterValues(data_sp); } - -NativeProcessProtocolSP NativeThreadProtocol::GetProcess() { - return m_process_wp.lock(); -} diff --git a/source/Host/common/Socket.cpp b/source/Host/common/Socket.cpp index 0df9dc02c70f..5490e9b30bda 100644 --- a/source/Host/common/Socket.cpp +++ b/source/Host/common/Socket.cpp @@ -29,6 +29,7 @@ #include <netinet/tcp.h> #include <sys/socket.h> #include <sys/un.h> +#include <unistd.h> #endif #ifdef __linux__ diff --git a/source/Host/common/SocketAddress.cpp b/source/Host/common/SocketAddress.cpp index 41150fa7fd74..def3e0359f01 100644 --- a/source/Host/common/SocketAddress.cpp +++ b/source/Host/common/SocketAddress.cpp @@ -317,6 +317,13 @@ bool SocketAddress::IsAnyAddr() const { : 0 == memcmp(&m_socket_addr.sa_ipv6.sin6_addr, &in6addr_any, 16); } +bool SocketAddress::IsLocalhost() const { + return (GetFamily() == AF_INET) + ? m_socket_addr.sa_ipv4.sin_addr.s_addr == htonl(INADDR_LOOPBACK) + : 0 == memcmp(&m_socket_addr.sa_ipv6.sin6_addr, &in6addr_loopback, + 16); +} + bool SocketAddress::operator==(const SocketAddress &rhs) const { if (GetFamily() != rhs.GetFamily()) return false; diff --git a/source/Host/common/TCPSocket.cpp b/source/Host/common/TCPSocket.cpp index c013334ce23a..a7af93f10a7f 100644 --- a/source/Host/common/TCPSocket.cpp +++ b/source/Host/common/TCPSocket.cpp @@ -34,6 +34,7 @@ #define CLOSE_SOCKET closesocket typedef const char *set_socket_option_arg_type; #else +#include <unistd.h> #define CLOSE_SOCKET ::close typedef const void *set_socket_option_arg_type; #endif diff --git a/source/Host/linux/Host.cpp b/source/Host/linux/Host.cpp index 486d4e3f0b81..f43090eadf81 100644 --- a/source/Host/linux/Host.cpp +++ b/source/Host/linux/Host.cpp @@ -16,6 +16,7 @@ #include <sys/stat.h> #include <sys/types.h> #include <sys/utsname.h> +#include <unistd.h> // C++ Includes // Other libraries and framework includes diff --git a/source/Host/linux/HostInfoLinux.cpp b/source/Host/linux/HostInfoLinux.cpp index 3ff722d5c109..8d59cda249e8 100644 --- a/source/Host/linux/HostInfoLinux.cpp +++ b/source/Host/linux/HostInfoLinux.cpp @@ -16,6 +16,7 @@ #include <stdio.h> #include <string.h> #include <sys/utsname.h> +#include <unistd.h> #include <algorithm> #include <mutex> // std::once diff --git a/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/source/Host/posix/ConnectionFileDescriptorPosix.cpp index 105ef0f23d46..3797650105ce 100644 --- a/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -30,6 +30,7 @@ #ifndef LLDB_DISABLE_POSIX #include <termios.h> +#include <unistd.h> #endif // C++ Includes diff --git a/source/Host/posix/FileSystem.cpp b/source/Host/posix/FileSystem.cpp index e5a99e1aa754..3ece0677f991 100644 --- a/source/Host/posix/FileSystem.cpp +++ b/source/Host/posix/FileSystem.cpp @@ -15,6 +15,7 @@ #include <sys/param.h> #include <sys/stat.h> #include <sys/types.h> +#include <unistd.h> #ifdef __linux__ #include <linux/magic.h> #include <sys/mount.h> diff --git a/source/Host/posix/HostProcessPosix.cpp b/source/Host/posix/HostProcessPosix.cpp index b5505dbec65b..3c5273f4bd3f 100644 --- a/source/Host/posix/HostProcessPosix.cpp +++ b/source/Host/posix/HostProcessPosix.cpp @@ -13,7 +13,9 @@ #include "llvm/ADT/STLExtras.h" +#include <csignal> #include <limits.h> +#include <unistd.h> using namespace lldb_private; diff --git a/source/Host/posix/LockFilePosix.cpp b/source/Host/posix/LockFilePosix.cpp index 2b7d548a021c..05423062bd44 100644 --- a/source/Host/posix/LockFilePosix.cpp +++ b/source/Host/posix/LockFilePosix.cpp @@ -10,6 +10,7 @@ #include "lldb/Host/posix/LockFilePosix.h" #include <fcntl.h> +#include <unistd.h> using namespace lldb; using namespace lldb_private; diff --git a/source/Host/posix/ProcessLauncherPosixFork.cpp b/source/Host/posix/ProcessLauncherPosixFork.cpp index 0b40c24256ef..66c0229e0dab 100644 --- a/source/Host/posix/ProcessLauncherPosixFork.cpp +++ b/source/Host/posix/ProcessLauncherPosixFork.cpp @@ -19,8 +19,10 @@ #include <limits.h> #include <sys/ptrace.h> #include <sys/wait.h> +#include <unistd.h> #include <sstream> +#include <csignal> #ifdef __ANDROID__ #include <android/api-level.h> |
