x86_64: change getregs_old to forward ptrace return code

* linux/x86_64/getregs_old.c (getregs_old): Change to return ptrace
return code.
* syscall.c (get_regs) [ARCH_REGS_FOR_GETREGSET && X86_64]: Use
getregs_old return code.
This commit is contained in:
2015-11-30 15:30:05 +00:00
parent 5105d4ac96
commit f3e9e61d78
2 changed files with 6 additions and 5 deletions

View File

@ -2,13 +2,13 @@
* 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);
@ -36,4 +36,5 @@ getregs_old(pid_t pid)
} else {
x86_io.iov_len = sizeof(x86_64_regs);
}
return 0;
}

View File

@ -1260,7 +1260,7 @@ get_regs(pid_t pid)
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);