linux-mips-fnet
[Top] [All Lists]

Re: strace on Linux/MIPS?

To: Jun Sun <jsun@mvista.com>, Keith M Wesolowski <wesolows@chem.unr.edu>, linux-mips@fnet.fr, linux@cthulhu.engr.sgi.com
Subject: Re: strace on Linux/MIPS?
From: Ralf Baechle <ralf@oss.sgi.com>
Date: Fri, 28 Jul 2000 23:46:04 +0200
In-reply-to: <20000728135139.A4903@cistron.nl>; from wichert@cistron.nl on Fri, Jul 28, 2000 at 01:51:39PM +0200
References: <3980C024.8DCCA084@mvista.com> <20000727161212.B12897@chem.unr.edu> <3980C9F0.96B48253@mvista.com> <20000728021137.B1328@bacchus.dhis.org> <3980EC1C.AEF173D2@mvista.com> <20000728042109.C1981@bacchus.dhis.org> <20000728135139.A4903@cistron.nl>
On Fri, Jul 28, 2000 at 01:51:39PM +0200, Wichert Akkerman wrote:

> Previously Ralf Baechle wrote:
> > Looks like strace is still tryping to copy mmap_arg_struct like on Intel
> > but on MIPS we don't use that?
> 
> Could be, I think MIPS and i386 use the same codepath there. Patches
> are appreciated so I can include them in strace 4.3 (eta 3 weeks from
> now)

Here's the second strace patch, please apply.

I noticed that process.c:change_syscall() can't work as is - the all kernels
would change the v0 register - and happily use the old value that is take
the wrong syscall.  A kernel buglet which also hits the usermode kernel
and which I'll fix asap.

  Ralf

--- strace/process.c.orig       Fri Jul 28 23:37:14 2000
+++ strace/process.c    Fri Jul 28 23:33:43 2000
@@ -502,6 +502,24 @@
                if (errno)
                        return -1;
        }
+#elif defined(MIPS)
+       {
+               errno = 0;
+               if (argnum < 4)
+                       ptrace(PTRACE_POKEUSER, tcp->pid,
+                              (char*)(REG_A0 + argnum), tcp->u_arg[argnum]);
+               else {
+                       unsigned long *sp;
+
+                       if (upeek(tcp->pid, REG_SP, (long *) &sp) , 0)
+                               return -1;
+
+                       ptrace(PTRACE_POKEDATA, tcp->pid,
+                              (char*)(sp + argnum - 4), tcp->u_arg[argnum]);
+               }
+               if (errno)
+                       return -1;
+       }
 #else
 # warning Sorry, setargs not implemented for this architecture.
 #endif

<Prev in Thread] Current Thread [Next in Thread>