Mercurial > hg > graal-jvmci-8
comparison agent/src/os/linux/ps_proc.c @ 22838:7e2e246df4e9
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 | f2512d89ad0c |
children | d06b64fc150f |
comparison
equal
deleted
inserted
replaced
22837:134cdf5e0b8a | 22838:7e2e246df4e9 |
---|---|
25 #include <stdio.h> | 25 #include <stdio.h> |
26 #include <stdlib.h> | 26 #include <stdlib.h> |
27 #include <string.h> | 27 #include <string.h> |
28 #include <signal.h> | 28 #include <signal.h> |
29 #include <errno.h> | 29 #include <errno.h> |
30 #include <elf.h> | |
30 #include <sys/types.h> | 31 #include <sys/types.h> |
31 #include <sys/wait.h> | 32 #include <sys/wait.h> |
32 #include <sys/ptrace.h> | 33 #include <sys/ptrace.h> |
34 #include <sys/uio.h> | |
33 #include "libproc_impl.h" | 35 #include "libproc_impl.h" |
34 | 36 |
35 #if defined(x86_64) && !defined(amd64) | 37 #if defined(x86_64) && !defined(amd64) |
36 #define amd64 1 | 38 #define amd64 1 |
37 #endif | 39 #endif |
133 #endif | 135 #endif |
134 | 136 |
135 #ifdef PTRACE_GETREGS_REQ | 137 #ifdef PTRACE_GETREGS_REQ |
136 if (ptrace_getregs(PTRACE_GETREGS_REQ, pid, user, NULL) < 0) { | 138 if (ptrace_getregs(PTRACE_GETREGS_REQ, pid, user, NULL) < 0) { |
137 print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid); | 139 print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid); |
140 return false; | |
141 } | |
142 return true; | |
143 #elif defined(PTRACE_GETREGSET) | |
144 struct iovec iov; | |
145 iov.iov_base = user; | |
146 iov.iov_len = sizeof(*user); | |
147 if (ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, (void*) &iov) < 0) { | |
148 print_debug("ptrace(PTRACE_GETREGSET, ...) failed for lwp %d\n", pid); | |
138 return false; | 149 return false; |
139 } | 150 } |
140 return true; | 151 return true; |
141 #else | 152 #else |
142 print_debug("ptrace(PTRACE_GETREGS, ...) not supported\n"); | 153 print_debug("ptrace(PTRACE_GETREGS, ...) not supported\n"); |