Skip to content

Commit 0e94be6

Browse files
zifeihanRealFYang
authored andcommitted
8307955: Prefer to PTRACE_GETREGSET instead of PTRACE_GETREGS in method 'ps_proc.c::process_get_lwp_regs'
Reviewed-by: fyang, gli Backport-of: 2f1c65486b1e584f9c4a2eb7af2414d032a02748
1 parent 2dee6fb commit 0e94be6

File tree

1 file changed

+7
-7
lines changed
  • src/jdk.hotspot.agent/linux/native/libsaproc

1 file changed

+7
-7
lines changed

src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,7 @@ static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct use
142142
#define PTRACE_GETREGS_REQ PT_GETREGS
143143
#endif
144144

145-
#ifdef PTRACE_GETREGS_REQ
146-
if (ptrace_getregs(PTRACE_GETREGS_REQ, pid, user, NULL) < 0) {
147-
print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid);
148-
return false;
149-
}
150-
return true;
151-
#elif defined(PTRACE_GETREGSET)
145+
#if defined(PTRACE_GETREGSET)
152146
struct iovec iov;
153147
iov.iov_base = user;
154148
iov.iov_len = sizeof(*user);
@@ -157,6 +151,12 @@ static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct use
157151
return false;
158152
}
159153
return true;
154+
#elif defined(PTRACE_GETREGS_REQ)
155+
if (ptrace_getregs(PTRACE_GETREGS_REQ, pid, user, NULL) < 0) {
156+
print_debug("ptrace(PTRACE_GETREGS, ...) failed for lwp %d\n", pid);
157+
return false;
158+
}
159+
return true;
160160
#else
161161
print_debug("ptrace(PTRACE_GETREGS, ...) not supported\n");
162162
return false;

0 commit comments

Comments
 (0)