changeset 7814:5960a65b0f54

8069030: support new PTRACE_GETREGSET Summary: use PTRACE_GETREGSET if other options are not available Reviewed-by: sla, dholmes
author dlong
date Mon, 02 Feb 2015 23:26:33 -0500
parents f81627ca8a1c
children a4f200a81135
files agent/src/os/linux/ps_proc.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/os/linux/ps_proc.c	Mon Feb 02 14:35:24 2015 +0000
+++ b/agent/src/os/linux/ps_proc.c	Mon Feb 02 23:26:33 2015 -0500
@@ -27,9 +27,11 @@
 #include <string.h>
 #include <signal.h>
 #include <errno.h>
+#include <elf.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/ptrace.h>
+#include <sys/uio.h>
 #include "libproc_impl.h"
 
 #if defined(x86_64) && !defined(amd64)
@@ -138,6 +140,15 @@
    return false;
  }
  return true;
+#elif defined(PTRACE_GETREGSET)
+ struct iovec iov;
+ iov.iov_base = user;
+ iov.iov_len = sizeof(*user);
+ if (ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, (void*) &iov) < 0) {
+   print_debug("ptrace(PTRACE_GETREGSET, ...) failed for lwp %d\n", pid);
+   return false;
+ }
+ return true;
 #else
  print_debug("ptrace(PTRACE_GETREGS, ...) not supported\n");
  return false;