Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: axp-list@redhat.com
Subject: Re: at least two bugs in strace-3.1-5
Date: Tue, 22 Sep 1998 01:35:31 +0200	[thread overview]
Message-ID: <19980922013531.28943@alpha.franken.de> (raw)
In-Reply-To: <9809211441.AA14164@bathurst>; from Richard Black on Mon, Sep 21, 1998 at 03:41:07PM +0100

On Mon, Sep 21, 1998 at 03:41:07PM +0100, Richard Black wrote:
> The following program, when run under strace on alpha linux shows that strace 
> on alpha linux does not record the mmap call correctly.  It is recorded 
> correctly on intel linux.

below is my current patchset for strace. It fixes the mmap bug and some
other oddities.

> - Also the strace source rpm (even with the supplied patches) does not
> compile 

strace-3.1-7 (RedHat 5.1) compiled at least on my Alpha. The patch is
on top of it.

Thomas.

diff -ru strace-3.1-orig/defs.h strace-3.1/defs.h
--- strace-3.1-orig/defs.h	Tue Sep 22 01:22:02 1998
+++ strace-3.1/defs.h	Sun Jun 29 15:06:34 1997
@@ -113,6 +113,7 @@
 	short flags;		/* See below for TCB_ values */
 	int pid;		/* Process Id of this entry */
 	long scno;		/* System call number */
+        long oscno;             /* old System call for handling signals */
 	int u_nargs;		/* System call arguments */
 	long u_arg[MAX_ARGS];	/* System call arguments */
 	int u_error;		/* Error code */
diff -ru strace-3.1-orig/file.c strace-3.1/file.c
--- strace-3.1-orig/file.c	Tue Sep 22 01:22:03 1998
+++ strace-3.1/file.c	Sun Jun 29 14:38:46 1997
@@ -297,7 +297,7 @@
 static void
 printstat(tcp, addr)
 struct tcb *tcp;
-int addr;
+long addr;
 {
 	struct stat statbuf;
 
@@ -306,7 +306,7 @@
 		return;
 	}
 	if (syserror(tcp) || !verbose(tcp)) {
-		tprintf("%#x", addr);
+		tprintf("%#lx", addr);
 		return;
 	}
 	if (umove(tcp, addr, &statbuf) < 0) {
diff -ru strace-3.1-orig/linux/alpha/syscallent.h strace-3.1/linux/alpha/syscallent.h
--- strace-3.1-orig/linux/alpha/syscallent.h	Fri May 17 04:38:46 1996
+++ strace-3.1/linux/alpha/syscallent.h	Tue Sep 22 01:06:09 1998
@@ -99,7 +99,7 @@
 	{ 2,	TF,	sys_lstat,		"lstat"		}, /* 68 */
 	{ 5,	0,	printargs,		"SYS_69"	}, /* 69 */
 	{ 5,	0,	printargs,		"SYS_70"	}, /* 70 */
-	{ 1,	0,	sys_mmap,		"mmap"		}, /* 71 */
+	{ 6,	0,	sys_mmap,		"mmap"		}, /* 71 */
 	{ 5,	0,	printargs,		"SYS_72"	}, /* 72 */
 	{ 2,	0,	sys_munmap,		"munmap"	}, /* 73 */
 	{ 3,	0,	sys_mprotect,		"mprotect"	}, /* 74 */
diff -ru strace-3.1-orig/process.c strace-3.1/process.c
--- strace-3.1-orig/process.c	Tue Sep 22 01:22:03 1998
+++ strace-3.1/process.c	Sun May 19 08:40:36 1996
@@ -1143,6 +1143,11 @@
 			tprintf("release=\"%s\", version=\"%s\", ",
 				uname.release, uname.version);
 			tprintf("machine=\"%s\"", uname.machine);
+#ifdef LINUX
+#ifndef ALPHA
+			tprintf(", domainname=\"%s\"", uname.domainname);
+#endif /* ALPHA */
+#endif /* LINUX */
 			tprintf("}");
 		}
 		else
diff -ru strace-3.1-orig/strace.c strace-3.1/strace.c
--- strace-3.1-orig/strace.c	Sun May 19 08:40:37 1996
+++ strace-3.1/strace.c	Sun Jun 29 15:08:17 1997
@@ -1311,6 +1311,7 @@
 			break;
 		case PR_SIGNALLED:
 			if (!cflag && (qual_flags[what] & QUAL_SIGNAL)) {
+			        tcp->oscno = tcp->scno;
 				printleader(tcp);
 				tprintf("--- %s (%s) ---",
 					signalent[what], strsignal(what));
diff -ru strace-3.1-orig/syscall.c strace-3.1/syscall.c
--- strace-3.1-orig/syscall.c	Tue Sep 22 01:22:03 1998
+++ strace-3.1/syscall.c	Tue Sep 22 01:05:07 1998
@@ -720,6 +720,7 @@
 		}
 
 		if (tcp->flags & TCB_REPRINT) {
+		    tcp->scno = tcp->oscno;
 			printleader(tcp);
 			tprintf("<... ");
 			if (tcp->scno >= nsyscalls)
@@ -848,7 +849,10 @@
 #ifdef ALPHA
 	{
 		int i;
-		tcp->u_nargs = sysent[tcp->scno].nargs;
+		if (scno < 400)
+			tcp->u_nargs = sysent[tcp->scno].nargs;
+		else
+			tcp->u_nargs = 5;
 		for (i = 0; i < tcp->u_nargs; i++) {
 			if (upeek(pid, REG_A0+i, &tcp->u_arg[i]) < 0)
 				return -1;

-- 
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
                   [Linus Torvalds in <4rikft$7g5@linux.cs.Helsinki.FI>]


  reply	other threads:[~1998-09-21 23:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-21 14:41 at least two bugs in strace-3.1-5 Richard Black
1998-09-21 23:35 ` Thomas Bogendoerfer [this message]
1998-09-23 17:48   ` Another bug in strace-3.1 Richard Black
1998-09-24 19:10     ` Thomas Bogendoerfer
read-only archive

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