From 6ac1be4b6d2ab53fca96327d89da946b5bec5b41 Mon Sep 17 00:00:00 2001 From: Todd Fiala Date: Thu, 21 Aug 2014 16:34:03 +0000 Subject: Enable more Linux aarch64 PTRACE support for local and remote debugging. See http://reviews.llvm.org/D4803 for more details. Change by Paul Osmialowski. llvm-svn: 216185 --- .../Plugins/Process/Linux/ProcessMonitor.cpp | 66 +++++++++++++++++----- 1 file changed, 51 insertions(+), 15 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp') diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp index 42a0aa51f4c..048a517d4f1 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -17,12 +17,18 @@ #include #include #include +#include #include #include #include #include #include +#if defined (__arm64__) || defined (__aarch64__) +// NT_PRSTATUS and NT_FPREGSET definition +#include +#endif + // C++ Includes // Other libraries and framework includes #include "lldb/Core/Debugger.h" @@ -124,15 +130,13 @@ static void PtraceDisplayBytes(int &req, void *data, size_t data_size) verbose_log->Printf("PTRACE_POKEUSER %s", buf.GetData()); break; } -#ifdef PT_SETREGS +#if !defined (__arm64__) && !defined (__aarch64__) case PTRACE_SETREGS: { DisplayBytes(buf, data, data_size); verbose_log->Printf("PTRACE_SETREGS %s", buf.GetData()); break; } -#endif -#ifdef PT_SETFPREGS case PTRACE_SETFPREGS: { DisplayBytes(buf, data, data_size); @@ -570,13 +574,21 @@ private: void ReadGPROperation::Execute(ProcessMonitor *monitor) { -#ifdef PT_GETREGS - if (PTRACE(PTRACE_GETREGS, m_tid, NULL, m_buf, m_buf_size) < 0) +#if defined (__arm64__) || defined (__aarch64__) + int regset = NT_PRSTATUS; + struct iovec ioVec; + + ioVec.iov_base = m_buf; + ioVec.iov_len = m_buf_size; + if (PTRACE(PTRACE_GETREGSET, m_tid, ®set, &ioVec, m_buf_size) < 0) m_result = false; else m_result = true; #else - m_result = false; + if (PTRACE(PTRACE_GETREGS, m_tid, NULL, m_buf, m_buf_size) < 0) + m_result = false; + else + m_result = true; #endif } @@ -602,13 +614,21 @@ private: void ReadFPROperation::Execute(ProcessMonitor *monitor) { -#ifdef PT_GETFPREGS - if (PTRACE(PTRACE_GETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0) +#if defined (__arm64__) || defined (__aarch64__) + int regset = NT_FPREGSET; + struct iovec ioVec; + + ioVec.iov_base = m_buf; + ioVec.iov_len = m_buf_size; + if (PTRACE(PTRACE_GETREGSET, m_tid, ®set, &ioVec, m_buf_size) < 0) m_result = false; else m_result = true; #else - m_result = false; + if (PTRACE(PTRACE_GETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0) + m_result = false; + else + m_result = true; #endif } @@ -663,13 +683,21 @@ private: void WriteGPROperation::Execute(ProcessMonitor *monitor) { -#ifdef PT_SETREGS - if (PTRACE(PTRACE_SETREGS, m_tid, NULL, m_buf, m_buf_size) < 0) +#if defined (__arm64__) || defined (__aarch64__) + int regset = NT_PRSTATUS; + struct iovec ioVec; + + ioVec.iov_base = m_buf; + ioVec.iov_len = m_buf_size; + if (PTRACE(PTRACE_SETREGSET, m_tid, ®set, &ioVec, m_buf_size) < 0) m_result = false; else m_result = true; #else - m_result = false; + if (PTRACE(PTRACE_SETREGS, m_tid, NULL, m_buf, m_buf_size) < 0) + m_result = false; + else + m_result = true; #endif } @@ -695,13 +723,21 @@ private: void WriteFPROperation::Execute(ProcessMonitor *monitor) { -#ifdef PT_SETFPREGS - if (PTRACE(PTRACE_SETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0) +#if defined (__arm64__) || defined (__aarch64__) + int regset = NT_FPREGSET; + struct iovec ioVec; + + ioVec.iov_base = m_buf; + ioVec.iov_len = m_buf_size; + if (PTRACE(PTRACE_SETREGSET, m_tid, ®set, &ioVec, m_buf_size) < 0) m_result = false; else m_result = true; #else - m_result = false; + if (PTRACE(PTRACE_SETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0) + m_result = false; + else + m_result = true; #endif } -- cgit v1.2.3