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/NativeProcessLinux.cpp | |
| parent | 373863d31e2f45f34206b6255707e2264d54ab45 (diff) | |
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/NativeProcessLinux.cpp')
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 32915d2b4e43..2cd0a1388830 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -20,12 +20,18 @@ #include <linux/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 #include <fstream> #include <string> @@ -662,10 +668,22 @@ namespace void ReadGPROperation::Execute(NativeProcessLinux *monitor) { +#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 if (PTRACE(PTRACE_GETREGS, m_tid, NULL, m_buf, m_buf_size) < 0) m_result = false; else m_result = true; +#endif } //------------------------------------------------------------------------------ @@ -690,10 +708,22 @@ namespace void ReadFPROperation::Execute(NativeProcessLinux *monitor) { +#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 if (PTRACE(PTRACE_GETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0) m_result = false; else m_result = true; +#endif } //------------------------------------------------------------------------------ @@ -747,10 +777,22 @@ namespace void WriteGPROperation::Execute(NativeProcessLinux *monitor) { +#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 if (PTRACE(PTRACE_SETREGS, m_tid, NULL, m_buf, m_buf_size) < 0) m_result = false; else m_result = true; +#endif } //------------------------------------------------------------------------------ @@ -775,10 +817,22 @@ namespace void WriteFPROperation::Execute(NativeProcessLinux *monitor) { +#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 if (PTRACE(PTRACE_SETFPREGS, m_tid, NULL, m_buf, m_buf_size) < 0) m_result = false; else m_result = true; +#endif } //------------------------------------------------------------------------------ |
