]> granicus.if.org Git - strace/commitdiff
x86_64: change getregs_old to forward ptrace return code
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 30 Nov 2015 15:30:05 +0000 (15:30 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 30 Nov 2015 15:30:05 +0000 (15:30 +0000)
* 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.

linux/x86_64/getregs_old.c
syscall.c

index 6911eeea66bf5af5fbb34633676b0efe6089bad3..0ad340fc2a82c81945ad50ebb2b30ea488ce9827 100644 (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;
 }
index 99bc731f22ddccce37390a3a3e419950a48fe8ed..a6981d2a232bf1535ddb86b20af139e455e122b9 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -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);