diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2014-08-21 16:34:03 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2014-08-21 16:34:03 +0000 |
commit | 6ac1be4b6d2ab53fca96327d89da946b5bec5b41 (patch) | |
tree | a93085ce3a0b2d51b6ef48a60fa7124530abbf56 /lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp | |
parent | 373863d31e2f45f34206b6255707e2264d54ab45 (diff) | |
download | bcm5719-llvm-6ac1be4b6d2ab53fca96327d89da946b5bec5b41.tar.gz bcm5719-llvm-6ac1be4b6d2ab53fca96327d89da946b5bec5b41.zip |
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
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp | 66 |
1 files changed, 51 insertions, 15 deletions
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 <unistd.h> #include <sys/personality.h> #include <sys/ptrace.h> +#include <sys/uio.h> #include <sys/socket.h> #include <sys/syscall.h> #include <sys/types.h> #include <sys/user.h> #include <sys/wait.h> +#if defined (__arm64__) || defined (__aarch64__) +// NT_PRSTATUS and NT_FPREGSET definition +#include <elf.h> +#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 } |