]> granicus.if.org Git - strace/commitdiff
Change argument of getregs_old from pid to tcp
authorEugene Syromiatnikov <esyr@redhat.com>
Mon, 25 Dec 2017 22:49:40 +0000 (23:49 +0100)
committerEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 3 Jan 2018 23:17:24 +0000 (00:17 +0100)
* linux/powerpc/getregs_old.c (getregs_old): Change the first argument
from pid_t pid to struct tcb *tcp. Replace all instances of pid with
tcp->pid.
* linux/x86_64/getregs_old.c (getregs_old): Likewise.
* linux/x86_64/getregs_old.h (getregs_old): Update declaration.
* syscall.c (get_regs) [HAVE_GETREGS_OLD]: Pass tcp to the getregs_old
call instead of tcp->pid.

linux/powerpc/getregs_old.c
linux/x86_64/getregs_old.c
linux/x86_64/getregs_old.h
syscall.c

index 1730f033f53a01fcc12dc5cfcac1ed3a6e03c7ba..61c4189812fbf7cad40d57786e9a03c825ca633d 100644 (file)
@@ -3,29 +3,29 @@
  * we provide a slow fallback for old kernels.
  */
 static int
-getregs_old(pid_t pid)
+getregs_old(struct tcb *tcp)
 {
        int i;
        long r;
 
        if (iflag) {
-               r = upeek(pid, sizeof(long) * PT_NIP, &ppc_regs.nip);
+               r = upeek(tcp->pid, sizeof(long) * PT_NIP, &ppc_regs.nip);
                if (r)
                        goto out;
        }
 #ifdef POWERPC64 /* else we never use it */
-       r = upeek(pid, sizeof(long) * PT_MSR, &ppc_regs.msr);
+       r = upeek(tcp->pid, sizeof(long) * PT_MSR, &ppc_regs.msr);
        if (r)
                goto out;
 #endif
-       r = upeek(pid, sizeof(long) * PT_CCR, &ppc_regs.ccr);
+       r = upeek(tcp->pid, sizeof(long) * PT_CCR, &ppc_regs.ccr);
        if (r)
                goto out;
-       r = upeek(pid, sizeof(long) * PT_ORIG_R3, &ppc_regs.orig_gpr3);
+       r = upeek(tcp->pid, sizeof(long) * PT_ORIG_R3, &ppc_regs.orig_gpr3);
        if (r)
                goto out;
        for (i = 0; i <= 8; i++) {
-               r = upeek(pid, sizeof(long) * (PT_R0 + i),
+               r = upeek(tcp->pid, sizeof(long) * (PT_R0 + i),
                          &ppc_regs.gpr[i]);
                if (r)
                        goto out;
index 9f7c24892b8678aa93f285ba1514a43729d78585..0aa05c4e2ccfdccf69e33ec04a87c4cd1f10896f 100644 (file)
  * a PTRACE_GETREGS based fallback is provided for old kernels.
  */
 static int
-getregs_old(pid_t pid)
+getregs_old(struct tcb *tcp)
 {
        /* Use old method, with unreliable heuristical detection of 32-bitness. */
-       long r = ptrace(PTRACE_GETREGS, pid, NULL, &x86_64_regs);
+       long r = ptrace(PTRACE_GETREGS, tcp->pid, NULL, &x86_64_regs);
        if (r)
                return r;
 
index 80303016d8ae98ca14cc58bd1c2d34b6955c33d2..f13fe24f23cd9c6d81c0ec4a61f6f1a41c81bb05 100644 (file)
@@ -1,2 +1,2 @@
 #define HAVE_GETREGS_OLD
-static int getregs_old(pid_t);
+static int getregs_old(struct tcb *);
index dfeaec17ec9b49c752ef44fb3e18327c013e72a5..b0a4fe825baa585a32838826a2412dbc7e881dc9 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -1136,7 +1136,7 @@ get_regs(struct tcb *const tcp)
                        return get_regs_error;
                use_getregs_old = 1;
        }
-       return get_regs_error = getregs_old(tcp->pid);
+       return get_regs_error = getregs_old(tcp);
 # else /* !HAVE_GETREGS_OLD */
        /* Assume that PTRACE_GETREGSET/PTRACE_GETREGS works. */
        return get_regs_error = ptrace_getregset_or_getregs(tcp->pid);