* PTRACE_GETREGSET was added to the kernel in v2.6.25,
* a PTRACE_GETREGS based fallback is provided for old kernels.
*/
-static void
+static int
getregs_old(pid_t pid)
{
/* Use old method, with unreliable heuristical detection of 32-bitness. */
- get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &x86_64_regs);
- if (get_regs_error)
- return;
+ long r = ptrace(PTRACE_GETREGS, pid, NULL, &x86_64_regs);
+ if (r)
+ return r;
if (x86_64_regs.cs == 0x23) {
x86_io.iov_len = sizeof(i386_regs);
} else {
x86_io.iov_len = sizeof(x86_64_regs);
}
+ return 0;
}
return;
getregset_support = -1;
}
- getregs_old(pid);
+ get_regs_error = getregs_old(pid);
# else /* !X86_64 */
/* Assume that PTRACE_GETREGSET works. */
get_regs_error = get_regset(pid);