Linux MIPS Architecture development
 help / color / mirror / Atom feed
* strace on Linux/MIPS?
@ 2000-07-27 23:05 Jun Sun
  2000-07-27 23:12 ` Keith M Wesolowski
  0 siblings, 1 reply; 10+ messages in thread
From: Jun Sun @ 2000-07-27 23:05 UTC (permalink / raw)
  To: linux-mips, linux


Has anybody been successful in trying to get strace running on
Linux/MIPS?  I managed to get 4.2, with a little from CVS tree, compiled
and run.  However, it does not quite right.  It only prints the first
system. See below.  Verified that this is the same behavior on both
2.3.99-pre3 and 2.4.0-test2.

sh-2.03# strace ls
execve("/bin/ls", ["ls"], [/* 14 vars */]) = 0
bin  boot  dev  etc  lib  mnt  opt  proc  sbin  share  tmp  var

Any idea?

Jun

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-27 23:05 strace on Linux/MIPS? Jun Sun
@ 2000-07-27 23:12 ` Keith M Wesolowski
  2000-07-27 23:46   ` Jun Sun
  0 siblings, 1 reply; 10+ messages in thread
From: Keith M Wesolowski @ 2000-07-27 23:12 UTC (permalink / raw)
  To: Jun Sun; +Cc: linux-mips, linux

On Thu, Jul 27, 2000 at 04:05:08PM -0700, Jun Sun wrote:

> Has anybody been successful in trying to get strace running on
> Linux/MIPS?  I managed to get 4.2, with a little from CVS tree, compiled
> and run.  However, it does not quite right.  It only prints the first
> system. See below.  Verified that this is the same behavior on both
> 2.3.99-pre3 and 2.4.0-test2.

Your kernel is too old. Ralf fixed some things in ptrace a few days
ago. Also, I would be interested in hearing if you can get 4.2 to
work. I found that, even after adjusting several places for
__NR_Linux, it segfaulted. I do have 3.1 from oss.sgi.com CVS (with a
couple minor glibc 2.2 patches) working properly with a current
kernel.

-- 
Keith M Wesolowski			wesolows@chem.unr.edu
University of Nevada			http://www.chem.unr.edu
Chemistry Department Systems and Network Administrator

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-27 23:12 ` Keith M Wesolowski
@ 2000-07-27 23:46   ` Jun Sun
  2000-07-28  0:11     ` Ralf Baechle
  2000-07-28 10:22     ` Maciej W. Rozycki
  0 siblings, 2 replies; 10+ messages in thread
From: Jun Sun @ 2000-07-27 23:46 UTC (permalink / raw)
  To: Keith M Wesolowski; +Cc: linux-mips, linux

Keith M Wesolowski wrote:
> 
> On Thu, Jul 27, 2000 at 04:05:08PM -0700, Jun Sun wrote:
> 
> > Has anybody been successful in trying to get strace running on
> > Linux/MIPS?  I managed to get 4.2, with a little from CVS tree, compiled
> > and run.  However, it does not quite right.  It only prints the first
> > system. See below.  Verified that this is the same behavior on both
> > 2.3.99-pre3 and 2.4.0-test2.
> 
> Your kernel is too old.

Wow, a couple days is "too old".  I guest that is Linux speed.

> Ralf fixed some things in ptrace a few days
> ago. 

Great!  Can you pinpoint the related files?  I took a snapshot of CVS on
6/27 and hacked heavily to get it work on my NEC board.  It would be
very difficult for me to move to the new kernel.  It would be better if
I can just reverse-merge with the related changes.

Jun

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-27 23:46   ` Jun Sun
@ 2000-07-28  0:11     ` Ralf Baechle
  2000-07-28  2:12       ` Jun Sun
  2000-07-28 10:22     ` Maciej W. Rozycki
  1 sibling, 1 reply; 10+ messages in thread
From: Ralf Baechle @ 2000-07-28  0:11 UTC (permalink / raw)
  To: Jun Sun; +Cc: Keith M Wesolowski, linux-mips, linux

On Thu, Jul 27, 2000 at 04:46:56PM -0700, Jun Sun wrote:

> > > Has anybody been successful in trying to get strace running on
> > > Linux/MIPS?  I managed to get 4.2, with a little from CVS tree, compiled
> > > and run.  However, it does not quite right.  It only prints the first
> > > system. See below.  Verified that this is the same behavior on both
> > > 2.3.99-pre3 and 2.4.0-test2.
> > 
> > Your kernel is too old.
> 
> Wow, a couple days is "too old".  I guest that is Linux speed.

Software is like fish, it starts to smell soon :-)

> > Ralf fixed some things in ptrace a few days
> > ago. 
> 
> Great!  Can you pinpoint the related files?  I took a snapshot of CVS on
> 6/27 and hacked heavily to get it work on my NEC board.  It would be
> very difficult for me to move to the new kernel.  It would be better if
> I can just reverse-merge with the related changes.

arch/mips/kernel/scall_o32.S
arch/mips/tools/offset.c
arch/mips64/kernel/scall_64.S
arch/mips64/kernel/scall_o32.S
arch/mips64/tools/offset.c

  Ralf

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-28  0:11     ` Ralf Baechle
@ 2000-07-28  2:12       ` Jun Sun
  2000-07-28  2:21         ` Ralf Baechle
  0 siblings, 1 reply; 10+ messages in thread
From: Jun Sun @ 2000-07-28  2:12 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Keith M Wesolowski, linux-mips, linux

Ralf Baechle wrote:
> 
> > > Ralf fixed some things in ptrace a few days
> > > ago.
> >
> > Great!  Can you pinpoint the related files?  I took a snapshot of CVS on
> > 6/27 and hacked heavily to get it work on my NEC board.  It would be
> > very difficult for me to move to the new kernel.  It would be better if
> > I can just reverse-merge with the related changes.
> 
> arch/mips/kernel/scall_o32.S
> arch/mips/tools/offset.c
> arch/mips64/kernel/scall_64.S
> arch/mips64/kernel/scall_o32.S
> arch/mips64/tools/offset.c
> 
>   Ralf

I just updated offset.c and scall_o32.S.  After a trial change ("nice"
-> "priority") in offset.c, strace seems to work fine now.

However, I did notice an error message for mmap(...).

mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error
)                                  = 717291520

Keith, if you want the patch for strace 4.2, I can send it to you.  

Jun

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-28  2:12       ` Jun Sun
@ 2000-07-28  2:21         ` Ralf Baechle
  2000-07-28 11:51           ` Wichert Akkerman
  0 siblings, 1 reply; 10+ messages in thread
From: Ralf Baechle @ 2000-07-28  2:21 UTC (permalink / raw)
  To: Jun Sun; +Cc: Keith M Wesolowski, linux-mips, linux

On Thu, Jul 27, 2000 at 07:12:44PM -0700, Jun Sun wrote:

> I just updated offset.c and scall_o32.S.  After a trial change ("nice"
> -> "priority") in offset.c, strace seems to work fine now.
> 
> However, I did notice an error message for mmap(...).
> 
> mmap(ptrace: umoven: Input/output error
> ptrace: umoven: Input/output error
> )                                  = 717291520

Looks like strace is still tryping to copy mmap_arg_struct like on Intel
but on MIPS we don't use that?

> Keith, if you want the patch for strace 4.2, I can send it to you.  

  Ralf

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-27 23:46   ` Jun Sun
  2000-07-28  0:11     ` Ralf Baechle
@ 2000-07-28 10:22     ` Maciej W. Rozycki
  1 sibling, 0 replies; 10+ messages in thread
From: Maciej W. Rozycki @ 2000-07-28 10:22 UTC (permalink / raw)
  To: Jun Sun; +Cc: Keith M Wesolowski, linux-mips, linux

On Thu, 27 Jul 2000, Jun Sun wrote:

> Great!  Can you pinpoint the related files?  I took a snapshot of CVS on
> 6/27 and hacked heavily to get it work on my NEC board.  It would be
> very difficult for me to move to the new kernel.  It would be better if
> I can just reverse-merge with the related changes.

 Well, you can always take a unified diff of your own changes and try to
apply it to a new snapshot.  Depending on the amount of changes you might
need to apply certain hunks manually but the overall process is usually
quite easy. 

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-28  2:21         ` Ralf Baechle
@ 2000-07-28 11:51           ` Wichert Akkerman
  2000-07-28 17:52             ` Ralf Baechle
  2000-07-28 21:46             ` Ralf Baechle
  0 siblings, 2 replies; 10+ messages in thread
From: Wichert Akkerman @ 2000-07-28 11:51 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Jun Sun, Keith M Wesolowski, linux-mips, linux

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

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)

Wichert.

-- 
  _________________________________________________________________
 / Generally uninteresting signature - ignore at your convenience  \
| wichert@wiggy.net                   http://www.liacs.nl/~wichert/ |
| 1024D/2FA3BC2D 576E 100B 518D 2F16 36B0  2805 3CB8 9250 2FA3 BC2D |

[-- Attachment #2: Type: application/pgp-signature, Size: 240 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-28 11:51           ` Wichert Akkerman
@ 2000-07-28 17:52             ` Ralf Baechle
  2000-07-28 21:46             ` Ralf Baechle
  1 sibling, 0 replies; 10+ messages in thread
From: Ralf Baechle @ 2000-07-28 17:52 UTC (permalink / raw)
  To: Jun Sun, Keith M Wesolowski, linux-mips, linux-mips, linux-mips

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)

Well, they shouldn't use the same code ...

Bananaware patch below.

  Ralf

--- strace/linux/mips/syscallent.orig	Mon May  1 03:09:31 2000
+++ strace/linux/mips/syscallent.h	Fri Jul 28 19:50:13 2000
@@ -4088,7 +4088,7 @@
 	{ 1,	TF,	sys_swapon,		"swapon"	}, /* 4087 */
 	{ 3,	0,	sys_reboot,		"reboot"	}, /* 4088 */
 	{ 3,	0,	sys_readdir,		"readdir"	}, /* 4089 */
-	{ 6,	0,	sys_old_mmap,		"mmap"		}, /* 4090 */
+	{ 6,	0,	sys_mmap,		"mmap"		}, /* 4090 */
 	{ 2,	0,	sys_munmap,		"munmap"	}, /* 4091 */
 	{ 2,	TF,	sys_truncate,		"truncate"	}, /* 4092 */
 	{ 2,	0,	sys_ftruncate,		"ftruncate"	}, /* 4093 */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: strace on Linux/MIPS?
  2000-07-28 11:51           ` Wichert Akkerman
  2000-07-28 17:52             ` Ralf Baechle
@ 2000-07-28 21:46             ` Ralf Baechle
  1 sibling, 0 replies; 10+ messages in thread
From: Ralf Baechle @ 2000-07-28 21:46 UTC (permalink / raw)
  To: Jun Sun, Keith M Wesolowski, linux-mips, linux

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2000-07-31  0:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-07-27 23:05 strace on Linux/MIPS? Jun Sun
2000-07-27 23:12 ` Keith M Wesolowski
2000-07-27 23:46   ` Jun Sun
2000-07-28  0:11     ` Ralf Baechle
2000-07-28  2:12       ` Jun Sun
2000-07-28  2:21         ` Ralf Baechle
2000-07-28 11:51           ` Wichert Akkerman
2000-07-28 17:52             ` Ralf Baechle
2000-07-28 21:46             ` Ralf Baechle
2000-07-28 10:22     ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox