diff options
Diffstat (limited to 'lldb/source/Plugins/Process')
6 files changed, 34 insertions, 82 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 4e4bbd8eb29..5491efec43c 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -54,10 +54,8 @@ // System includes - They have to be included after framework includes because they define some // macros which collide with variable names in other modules #include <linux/unistd.h> -#include <sys/personality.h> -#include <sys/ptrace.h> #include <sys/socket.h> -#include <sys/signalfd.h> + #include <sys/types.h> #include <sys/uio.h> #include <sys/user.h> @@ -68,52 +66,10 @@ #include <elf.h> #endif -#ifdef __ANDROID__ -#define __ptrace_request int -#define PT_DETACH PTRACE_DETACH -#endif - -#define DEBUG_PTRACE_MAXBYTES 20 - -// Support ptrace extensions even when compiled without required kernel support -#ifndef PT_GETREGS -#ifndef PTRACE_GETREGS - #define PTRACE_GETREGS 12 -#endif -#endif -#ifndef PT_SETREGS -#ifndef PTRACE_SETREGS - #define PTRACE_SETREGS 13 -#endif -#endif -#ifndef PT_GETFPREGS -#ifndef PTRACE_GETFPREGS - #define PTRACE_GETFPREGS 14 -#endif -#endif -#ifndef PT_SETFPREGS -#ifndef PTRACE_SETFPREGS - #define PTRACE_SETFPREGS 15 -#endif -#endif -#ifndef PTRACE_GETREGSET - #define PTRACE_GETREGSET 0x4204 -#endif -#ifndef PTRACE_SETREGSET - #define PTRACE_SETREGSET 0x4205 -#endif -#ifndef PTRACE_GET_THREAD_AREA - #define PTRACE_GET_THREAD_AREA 25 -#endif -#ifndef PTRACE_ARCH_PRCTL - #define PTRACE_ARCH_PRCTL 30 -#endif -#ifndef ARCH_GET_FS - #define ARCH_SET_GS 0x1001 - #define ARCH_SET_FS 0x1002 - #define ARCH_GET_FS 0x1003 - #define ARCH_GET_GS 0x1004 -#endif +#include "lldb/Host/linux/Personality.h" +#include "lldb/Host/linux/Ptrace.h" +#include "lldb/Host/linux/Signalfd.h" +#include "lldb/Host/android/Android.h" #define LLDB_PERSONALITY_GET_CURRENT_SETTINGS 0xffffffff diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp index 4b29a09ccfc..b8f2a3f0d8b 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -41,8 +41,12 @@ // System includes - They have to be included after framework includes because they define some // macros which collide with variable names in other modules -#include <sys/personality.h> -#include <sys/ptrace.h> + +#include "lldb/Host/linux/Personality.h" +#include "lldb/Host/linux/Ptrace.h" +#include "lldb/Host/linux/Signalfd.h" +#include "lldb/Host/android/Android.h" + #include <sys/socket.h> #include <sys/syscall.h> #include <sys/types.h> @@ -50,37 +54,8 @@ #include <sys/user.h> #include <sys/wait.h> -#ifdef __ANDROID__ -#define __ptrace_request int -#define PT_DETACH PTRACE_DETACH -#endif - -#define DEBUG_PTRACE_MAXBYTES 20 - -// Support ptrace extensions even when compiled without required kernel support -#ifndef PTRACE_GETREGSET - #define PTRACE_GETREGSET 0x4204 -#endif -#ifndef PTRACE_SETREGSET - #define PTRACE_SETREGSET 0x4205 -#endif -#ifndef PTRACE_GET_THREAD_AREA - #define PTRACE_GET_THREAD_AREA 25 -#endif -#ifndef PTRACE_ARCH_PRCTL - #define PTRACE_ARCH_PRCTL 30 -#endif -#ifndef ARCH_GET_FS - #define ARCH_SET_GS 0x1001 - #define ARCH_SET_FS 0x1002 - #define ARCH_GET_FS 0x1003 - #define ARCH_GET_GS 0x1004 -#endif - #define LLDB_PERSONALITY_GET_CURRENT_SETTINGS 0xffffffff -#define LLDB_PTRACE_NT_ARM_TLS 0x401 // ARM TLS register - // Support hardware breakpoints in case it has not been defined #ifndef TRAP_HWBKPT #define TRAP_HWBKPT 4 diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp index 798818b7d11..09f72cbde97 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp @@ -33,6 +33,8 @@ #include "Plugins/Process/Linux/ProcessMonitor.h" #include "POSIXThread.h" +#include "lldb/Host/posix/Fcntl.h" + using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 064b60a238a..89d98760a60 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -259,7 +259,7 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le strm.Printf("<%4" PRIu64 "> send packet: %.*s", (uint64_t)bytes_written, (int)binary_start_offset, packet_data); const uint8_t *p; // Print binary data exactly as sent - for (p = (uint8_t*)packet_data + binary_start_offset; *p != '#'; ++p) + for (p = (const uint8_t*)packet_data + binary_start_offset; *p != '#'; ++p) strm.Printf("\\x%2.2x", *p); // Print the checksum strm.Printf("%*s", (int)3, p); @@ -822,7 +822,11 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname, // connect to us.. error = StartListenThread ("127.0.0.1", 0); if (error.Fail()) + { + if (log) + log->Printf ("GDBRemoteCommunication::%s() unable to start listen thread: %s", __FUNCTION__, error.AsCString()); return error; + } ConnectionFileDescriptor *connection = (ConnectionFileDescriptor *)GetConnection (); // Wait for 10 seconds to resolve the bound port @@ -839,6 +843,8 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname, else { error.SetErrorString ("failed to bind to port 0 on 127.0.0.1"); + if (log) + log->Printf ("GDBRemoteCommunication::%s() failed: %s", __FUNCTION__, error.AsCString()); return error; } } @@ -957,6 +963,13 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname, { error.SetErrorStringWithFormat ("unable to locate " DEBUGSERVER_BASENAME ); } + + if (error.Fail()) + { + if (log) + log->Printf ("GDBRemoteCommunication::%s() failed: %s", __FUNCTION__, error.AsCString()); + } + return error; } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index e8b39eaeb5d..0cc528fb565 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -396,6 +396,10 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerCommon::Handle_qUserName (StringExtractorGDBRemote &packet) { #if !defined(LLDB_DISABLE_POSIX) + Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); + if (log) + log->Printf("GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__); + // Packet format: "qUserName:%i" where %i is the uid packet.SetFilePos(::strlen ("qUserName:")); uint32_t uid = packet.GetU32 (UINT32_MAX); @@ -409,6 +413,8 @@ GDBRemoteCommunicationServerCommon::Handle_qUserName (StringExtractorGDBRemote & return SendPacketNoLock (response.GetData(), response.GetSize()); } } + if (log) + log->Printf("GDBRemoteCommunicationServerCommon::%s end", __FUNCTION__); #endif return SendErrorResponse (5); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index 0ab965853a5..36d64857046 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -117,7 +117,7 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer (StringExtractorGD if (hostname.empty()) hostname = "127.0.0.1"; if (log) - log->Printf("Launching debugserver with: %s:%u...\n", hostname.c_str(), port); + log->Printf("Launching debugserver with: %s:%u...", hostname.c_str(), port); // Do not run in a new session so that it can not linger after the // platform closes. |