How about removing non-Linux code?

Denys Vlasenko dvlasenk at redhat.com
Sat Feb 25 14:49:03 UTC 2012


On 02/25/2012 02:51 PM, Denys Vlasenko wrote:
> On 02/25/2012 01:41 AM, Dmitry V. Levin wrote:
>> On Wed, Feb 22, 2012 at 05:40:46AM +0400, Dmitry V. Levin wrote:
>>> So, since there were no objections, let's go ahead and kick the dead code out.
>>
>> Here it is, tested on x86 and x86-64, please have a look (6 top commits):
>> http://strace.git.sourceforge.net/git/gitweb.cgi?p=strace/strace;a=shortlog;h=ldv/unifdef
>
> Eh.... I committed the removal just this night :/
> You said:
>
>   >  So, since there were no objections, let's go ahead and kick the dead code out.
>
> and I took it as a green light...
>
> Ok, I am looking at your changes; meanwhile, please look at current git
> and let me know what do you think about mine.

Looks like them biggest difference between our trees is how we dealt with
svr4/ directory. You left it intact, while I copied three files to
sparc/ (errnoent1.h, ioctlent1.h and signalent1.h) and deleted svr4/
altogether.

I am not feeling zealous about it. If you prefer svr4/ to stay, I'm ok with
reverting it to that state.

I cherry-picked a number of good changes from your branch and committed them
to the master.

The remaining diff is below. Apart from trivial differences in ifdef formats,
there is a difference that I dropped LINUX_X86_64, LINUX_ARM and LINUX_AVR32
defines since they are always the same as X86_64, ARM and AVR32.

-- 
vda


diff -dbBw -urp strace.9/defs.h strace.a/defs.h
--- strace.9/defs.h	2012-02-25 15:26:22.000000000 +0100
+++ strace.a/defs.h	2012-02-25 15:01:07.000000000 +0100
@@ -48,7 +48,7 @@

  /* Configuration section */
  #ifndef MAX_QUALS
-# if defined(MIPS)
+#ifdef MIPS
  #  define MAX_QUALS	7000	/* maximum number of syscalls, signals, etc. */
  # else
  #  define MAX_QUALS	2048	/* maximum number of syscalls, signals, etc. */
@@ -100,6 +100,9 @@
  #if defined(SPARC) || defined(SPARC64)
  # define LINUXSPARC
  #endif
+#  if defined(X86_64)
+#     define LINUX_X86_64
+#  endif
  #if defined(MIPS) && _MIPS_SIM == _MIPS_SIM_ABI32
  # define LINUX_MIPSO32
  #endif
@@ -111,8 +114,14 @@
  # define LINUX_MIPSN64
  # define LINUX_MIPS64
  #endif
+#  if defined(ARM)
+#     define LINUX_ARM
+#  endif
+#  if defined(AVR32)
+#     define LINUX_AVR32
+#  endif

-#if (defined(LINUXSPARC) || defined(X86_64) || defined(ARM) || defined(AVR32)) && defined(__GLIBC__)
+# if (defined(LINUXSPARC) || defined(LINUX_X86_64) || defined(LINUX_ARM) || defined(LINUX_AVR32)) && defined(__GLIBC__)
  # include <sys/ptrace.h>
  #else
  /* Work around awkward prototype in ptrace.h. */
@@ -418,7 +425,7 @@ extern const struct xlat open_access_mod
  #ifndef offsetof
  # define offsetof(type, member)	(((char *) &(((type *) NULL)->member)) - \
  				 ((char *) (type *) NULL))
-#endif
+#endif /* !offsetof */

  /* get offset of member within a user struct */
  #define uoff(member)	offsetof(struct user, member)
diff -dbBw -urp strace.9/desc.c strace.a/desc.c
--- strace.9/desc.c	2012-02-25 15:05:08.000000000 +0100
+++ strace.a/desc.c	2012-02-25 15:01:07.000000000 +0100
@@ -471,7 +471,7 @@ sys_getdtablesize(struct tcb *tcp)
  {
  	return 0;
  }
-#endif
+#endif /* ALPHA */

  static int
  decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
diff -dbBw -urp strace.9/file.c strace.a/file.c
--- strace.9/file.c	2012-02-25 15:26:22.000000000 +0100
+++ strace.a/file.c	2012-02-25 15:01:07.000000000 +0100
@@ -831,7 +826,7 @@ printstat_sparc64(struct tcb *tcp, long
  #endif /* SPARC64 */
  #endif /* LINUXSPARC */

-#if defined POWERPC64
+#ifdef POWERPC64
  struct stat_powerpc32 {
  	unsigned int	st_dev;
  	unsigned int	st_ino;
@@ -995,7 +989,7 @@ printstat(struct tcb *tcp, long addr)
  #endif
  #endif /* LINUXSPARC */

-#if defined POWERPC64
+#ifdef POWERPC64
  	if (current_personality == 1) {
  		printstat_powerpc32(tcp, addr);
  		return;
@@ -1011,7 +1005,7 @@ printstat(struct tcb *tcp, long addr)
  }
  #endif	/* !HAVE_LONG_LONG_OFF_T */

-#if !defined HAVE_STAT64 && defined X86_64
+#if !defined(HAVE_STAT64) && defined(X86_64)
  /*
   * Linux x86_64 has unified `struct stat' but its i386 biarch needs
   * `struct stat64'.  Its <asm-i386/stat.h> definition expects 32-bit `long'.
@@ -1075,7 +1069,7 @@ printstat64(struct tcb *tcp, long addr)
  # endif
  #endif /* LINUXSPARC */

-#if defined X86_64
+#ifdef X86_64
  	if (current_personality == 0) {
  		printstat(tcp, addr);
  		return;
@@ -1163,7 +1157,8 @@ printstat64(struct tcb *tcp, long addr)
  }
  #endif /* HAVE_STAT64 */

-#if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
+#if defined(HAVE_STRUCT___OLD_KERNEL_STAT) \
+    && !defined(HAVE_LONG_LONG_OFF_T)
  static void
  convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
  {
@@ -1203,7 +1198,7 @@ printoldstat(struct tcb *tcp, long addr)
  		printstatsol(tcp, addr);
  		return;
  	}
-# endif
+#endif /* LINUXSPARC */

  	if (umove(tcp, addr, &statbuf) < 0) {
  		tprints("{...}");
@@ -1213,7 +1208,7 @@ printoldstat(struct tcb *tcp, long addr)
  	convertoldstat(&statbuf, &newstatbuf);
  	realprintstat(tcp, &newstatbuf);
  }
-#endif
+#endif /* !IA64 && !HPPA && !X86_64 && !S390 && !S390X */

  #ifndef HAVE_LONG_LONG_OFF_T
  int
@@ -1278,7 +1273,8 @@ sys_newfstatat(struct tcb *tcp)
  	return 0;
  }

-#if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
+#if defined(HAVE_STRUCT___OLD_KERNEL_STAT) \
+    && !defined(HAVE_LONG_LONG_OFF_T)
  int
  sys_oldstat(struct tcb *tcp)
  {
@@ -1290,7 +1286,7 @@ sys_oldstat(struct tcb *tcp)
  	}
  	return 0;
  }
-#endif
+#endif /* HAVE_STRUCT___OLD_KERNEL_STAT */

  #ifndef HAVE_LONG_LONG_OFF_T
  int
@@ -1322,7 +1318,8 @@ sys_fstat64(struct tcb *tcp)
  #endif
  }

-#if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
+#if defined(HAVE_STRUCT___OLD_KERNEL_STAT) \
+    && !defined(HAVE_LONG_LONG_OFF_T)
  int
  sys_oldfstat(struct tcb *tcp)
  {
@@ -1334,7 +1331,7 @@ sys_oldfstat(struct tcb *tcp)
  	}
  	return 0;
  }
-#endif
+#endif /* HAVE_STRUCT___OLD_KERNEL_STAT */

  #ifndef HAVE_LONG_LONG_OFF_T
  int
@@ -1366,7 +1363,8 @@ sys_lstat64(struct tcb *tcp)
  #endif
  }

-#if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
+#if defined(HAVE_STRUCT___OLD_KERNEL_STAT) \
+    && !defined(HAVE_LONG_LONG_OFF_T)
  int
  sys_oldlstat(struct tcb *tcp)
  {
@@ -1378,7 +1376,7 @@ sys_oldlstat(struct tcb *tcp)
  	}
  	return 0;
  }
-#endif
+#endif /* HAVE_STRUCT___OLD_KERNEL_STAT */


  #if defined(LINUXSPARC)
@@ -1446,9 +1444,15 @@ sys_xmknod(struct tcb *tcp)
  		tprintf(", %s", sprintmode(mode));
  		switch (mode & S_IFMT) {
  		case S_IFCHR: case S_IFBLK:
+#ifdef LINUXSPARC
  			tprintf(", makedev(%lu, %lu)",
  				(unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
  				(unsigned long) (tcp->u_arg[3] & 0x3ffff));
+#else
+			tprintf(", makedev(%lu, %lu)",
+				(unsigned long) major(tcp->u_arg[3]),
+				(unsigned long) minor(tcp->u_arg[3]));
+#endif
  			break;
  		default:
  			break;
@@ -1678,7 +1679,7 @@ sys_fstatfs(struct tcb *tcp)
  	return 0;
  }

-#if defined HAVE_STATFS64
+#ifdef HAVE_STATFS64
  static void
  printstatfs64(struct tcb *tcp, long addr)
  {
@@ -1795,7 +1796,8 @@ sys_fstatfs64(struct tcb *tcp)
  }
  #endif

-#if defined(ALPHA)
+#ifdef __alpha
+
  int
  osf_statfs(struct tcb *tcp)
  {
@@ -1820,7 +1822,7 @@ osf_fstatfs(struct tcb *tcp)
  	}
  	return 0;
  }
-#endif
+#endif /* __alpha */

  /* directory */
  int
diff -dbBw -urp strace.9/ipc.c strace.a/ipc.c
--- strace.9/ipc.c	2012-02-25 15:05:08.000000000 +0100
+++ strace.a/ipc.c	2012-02-25 15:01:07.000000000 +0100
@@ -62,7 +61,7 @@
  #define SEM_INFO 19
  #endif

-#if !defined IPC_64
+#ifndef IPC_64
  # define IPC_64 0x100
  #endif

@@ -421,7 +420,7 @@ int sys_shmat(struct tcb *tcp)
  		if (syserror(tcp))
  			return 0;
  /* HPPA does not use an IPC multiplexer on Linux.  */
-#if !defined(HPPA)
+#ifndef HPPA
  		if (umove(tcp, tcp->u_arg[2], &raddr) < 0)
  			return RVAL_NONE;
  		tcp->u_rval = raddr;
diff -dbBw -urp strace.9/mem.c strace.a/mem.c
--- strace.9/mem.c	2012-02-25 15:05:08.000000000 +0100
+++ strace.a/mem.c	2012-02-25 15:01:07.000000000 +0100
@@ -37,13 +37,13 @@
  #include <asm/mman.h>
  #include <sys/mman.h>

-#if defined(I386)
+#ifdef I386
  # include <asm/ldt.h>
  # ifdef HAVE_STRUCT_USER_DESC
  #  define modify_ldt_ldt_s user_desc
  # endif
  #endif
-#if defined(SH64)
+#ifdef SH64
  # include <asm/page.h>	    /* for PAGE_SHIFT */
  #endif

@@ -299,7 +298,7 @@ sys_mmap(struct tcb *tcp)
  	 * from pages to bytes. See test/mmap_offset_decode.c
  	 * Why SH64 and i386 are handled differently?
  	 */
-#if defined(SH64)
+#ifdef SH64
  	/*
  	 * Old mmap differs from new mmap in specifying the
  	 * offset in units of bytes rather than pages.  We
@@ -325,7 +324,7 @@ int
  sys_mmap64(struct tcb *tcp)
  {
  	if (entering(tcp)) {
-#if defined(ALPHA)
+#ifdef ALPHA
  		long *u_arg = tcp->u_arg;
  #else
  		long u_arg[7];
@@ -354,7 +353,7 @@ sys_mmap64(struct tcb *tcp)
  		tprints(", ");
  		printfd(tcp, u_arg[4]);
  		/* offset */
-#if defined(ALPHA)
+#ifdef ALPHA
  		printllval(tcp, ", %#llx", 5);
  #else
  		/* NOTE: not verified that [5] and [6] should be used.
@@ -582,9 +579,9 @@ sys_getpagesize(struct tcb *tcp)
  		return RVAL_HEX;
  	return 0;
  }
-#endif
+#endif /* ALPHA || IA64 || SPARC || SPARC64 */

-#if defined(I386)
+#ifdef __i386__
  void
  print_ldt_entry(struct modify_ldt_ldt_s *ldt_entry)
  {
@@ -676,9 +673,10 @@ sys_get_thread_area(struct tcb *tcp)
  	return 0;

  }
-#endif /* I386 */
+#endif /* __i386__ */
+
+#ifdef M68K

-#if defined(M68K)
  int
  sys_set_thread_area(struct tcb *tcp)
  {
@@ -909,7 +907,7 @@ sys_move_pages(struct tcb *tcp)
  	return 0;
  }

-#if defined(POWERPC)
+#ifdef POWERPC
  int
  sys_subpage_prot(struct tcb *tcp)
  {
diff -dbBw -urp strace.9/net.c strace.a/net.c
--- strace.9/net.c	2012-02-25 15:05:08.000000000 +0100
+++ strace.a/net.c	2012-02-25 15:01:07.000000000 +0100
@@ -1218,7 +1217,7 @@ printsock(struct tcb *tcp, long addr, in
  #ifdef HAVE_INET_NTOP
  		struct sockaddr_in6 sa6;
  #endif
-#if defined(AF_IPX)
+#ifdef AF_IPX
  		struct sockaddr_ipx sipx;
  #endif
  #ifdef AF_PACKET
@@ -1297,7 +1296,7 @@ printsock(struct tcb *tcp, long addr, in
  #endif
  		break;
  #endif
-#if defined(AF_IPX)
+#ifdef AF_IPX
  	case AF_IPX:
  		{
  			int i;
@@ -1332,7 +1331,7 @@ printsock(struct tcb *tcp, long addr, in
  		}
  		break;

-#endif /* AF_PACKET */
+#endif /* AF_APACKET */
  #ifdef AF_NETLINK
  	case AF_NETLINK:
  		tprintf("pid=%d, groups=%08x", addrbuf.nl.nl_pid, addrbuf.nl.nl_groups);
@@ -1800,17 +1798,15 @@ do_pipe(struct tcb *tcp, int flags_arg)
  		if (syserror(tcp)) {
  			tprintf("%#lx", tcp->u_arg[0]);
  		} else {
-#if !defined(SPARC) && !defined(SPARC64) && !defined(SH) && !defined(IA64)
+#if defined(SPARC) || defined(SPARC64) || defined(SH) || defined(IA64)
+			tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp));
+#else
  			int fds[2];

  			if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
  				tprints("[...]");
  			else
  				tprintf("[%u, %u]", fds[0], fds[1]);
-#elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(IA64)
-			tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp));
-#else
-			tprintf("%#lx", tcp->u_arg[0]);
  #endif
  		}
  		if (flags_arg >= 0) {
diff -dbBw -urp strace.9/process.c strace.a/process.c
--- strace.9/process.c	2012-02-25 15:05:08.000000000 +0100
+++ strace.a/process.c	2012-02-25 15:01:07.000000000 +0100
@@ -73,13 +72,13 @@
  # undef pt_all_user_regs
  #endif

-#if defined(SPARC64)
+#ifdef SPARC64
  # define r_pc r_tpc
  # undef PTRACE_GETREGS
  # define PTRACE_GETREGS PTRACE_GETREGS64
  # undef PTRACE_SETREGS
  # define PTRACE_SETREGS PTRACE_SETREGS64
-#endif
+#endif /* SPARC64 */

  #ifdef HAVE_LINUX_FUTEX_H
  # include <linux/futex.h>
@@ -104,7 +103,7 @@
  #undef GETGROUPS32_T
  #define GETGROUPS32_T __kernel_gid32_t

-#if defined(IA64)
+#ifdef IA64
  # include <asm/ptrace_offsets.h>
  # include <asm/rse.h>
  #endif
@@ -373,7 +371,7 @@ sys_gethostname(struct tcb *tcp)
  	}
  	return 0;
  }
-#endif
+#endif /* ALPHA */

  int
  sys_setdomainname(struct tcb *tcp)
@@ -1077,7 +1063,7 @@ sys_setpgrp(struct tcb *tcp)
  	}
  	return 0;
  }
-#endif
+#endif /* ALPHA */

  int
  sys_getpgrp(struct tcb *tcp)
@@ -1181,7 +1166,7 @@ sys_execv(struct tcb *tcp)
  	}
  	return 0;
  }
-#endif
+#endif /* SPARC || SPARC64 */

  int
  sys_execve(struct tcb *tcp)
@@ -1208,8 +1193,7 @@ sys_execve(struct tcb *tcp)
  	return 0;
  }

-
-#if defined(TCB_WAITEXECVE)
+#ifdef TCB_WAITEXECVE
  int
  internal_exec(struct tcb *tcp)
  {
diff -dbBw -urp strace.9/signal.c strace.a/signal.c
--- strace.9/signal.c	2012-02-25 15:26:22.000000000 +0100
+++ strace.a/signal.c	2012-02-25 15:01:07.000000000 +0100
@@ -68,12 +66,12 @@
  # include <asm/ptrace_offsets.h>
  #endif

-#if defined(SPARC64)
+#ifdef SPARC64
  # undef PTRACE_GETREGS
  # define PTRACE_GETREGS PTRACE_GETREGS64
  # undef PTRACE_SETREGS
  # define PTRACE_SETREGS PTRACE_SETREGS64
-#endif
+#endif /* SPARC64 */

  #if defined(SPARC) || defined(SPARC64) || defined(MIPS)
  typedef struct {
@@ -1137,7 +1125,7 @@ sys_sigsuspend(struct tcb *tcp)
  	return 0;
  }

-#if !defined SS_ONSTACK
+#ifndef SS_ONSTACK
  #define SS_ONSTACK      1
  #define SS_DISABLE      2
  #if __GLIBC_MINOR__ == 0
diff -dbBw -urp strace.9/strace.1 strace.a/strace.1
--- strace.9/strace.1	2012-02-25 15:32:59.000000000 +0100
+++ strace.a/strace.1	2012-02-25 15:01:07.000000000 +0100
@@ -294,6 +294,10 @@ for a child that is currently
  being traced, it is suspended until an appropriate child process either
  terminates or incurs a signal that would cause it to terminate (as
  determined from the child's current signal disposition).
+.IP
+On SunOS 4.x the tracing of
+.BR vfork s
+is accomplished with some dynamic linking trickery.
  .TP
  .B \-ff
  If the
diff -dbBw -urp strace.9/strace.c strace.a/strace.c
--- strace.9/strace.c	2012-02-25 15:05:08.000000000 +0100
+++ strace.a/strace.c	2012-02-25 15:01:07.000000000 +0100
@@ -58,7 +58,7 @@
  #  define my_tkill(tid, sig) kill((tid), (sig))
  # endif

-#if defined(IA64)
+#ifdef IA64
  # include <asm/ptrace_offsets.h>
  #endif

diff -dbBw -urp strace.9/stream.c strace.a/stream.c
--- strace.9/stream.c	2012-02-25 15:26:22.000000000 +0100
+++ strace.a/stream.c	2012-02-25 15:01:07.000000000 +0100
@@ -153,7 +153,7 @@ sys_getmsg(struct tcb *tcp)
  	}
  	return RVAL_HEX | RVAL_STR;
  }
-#endif
+#endif /* SPARC || SPARC64 */

  #if defined SYS_putpmsg || defined SYS_getpmsg
  static const struct xlat pmsgflags[] = {
diff -dbBw -urp strace.9/syscall.c strace.a/syscall.c
--- strace.9/syscall.c	2012-02-25 15:05:08.000000000 +0100
+++ strace.a/syscall.c	2012-02-25 15:01:07.000000000 +0100
@@ -60,14 +60,14 @@
  # undef pt_all_user_regs
  #endif

-#if defined(SPARC64)
+#ifdef SPARC64
  # undef PTRACE_GETREGS
  # define PTRACE_GETREGS PTRACE_GETREGS64
  # undef PTRACE_SETREGS
  # define PTRACE_SETREGS PTRACE_SETREGS64
-#endif
+#endif /* SPARC64 */

-#if defined(IA64)
+#ifdef IA64
  # include <asm/ptrace_offsets.h>
  # include <asm/rse.h>
  #endif
@@ -339,7 +338,7 @@ qualify_one(int n, int bitflag, int not,
  		else
  			qual_flags1[n] |= bitflag;
  	}
-#endif
+#endif /* SUPPORTED_PERSONALITIES >= 2 */

  #if SUPPORTED_PERSONALITIES >= 3
  	if (pers == 2 || pers < 0) {
@@ -348,7 +347,7 @@ qualify_one(int n, int bitflag, int not,
  		else
  			qual_flags2[n] |= bitflag;
  	}
-#endif
+#endif /* SUPPORTED_PERSONALITIES >= 3 */
  }

  static int
@@ -376,7 +375,7 @@ qual_syscall(const char *s, int bitflag,
  			qualify_one(i, bitflag, not, 1);
  			rc = 0;
  		}
-#endif
+#endif /* SUPPORTED_PERSONALITIES >= 2 */

  #if SUPPORTED_PERSONALITIES >= 3
  	for (i = 0; i < nsyscalls2; i++)
@@ -384,7 +383,7 @@ qual_syscall(const char *s, int bitflag,
  			qualify_one(i, bitflag, not, 2);
  			rc = 0;
  		}
-#endif
+#endif /* SUPPORTED_PERSONALITIES >= 3 */

  	return rc;
  }
@@ -502,13 +501,13 @@ qualify(const char *s)
  			for (i = 0; i < nsyscalls1; i++)
  				if (sysent1[i].sys_flags & n)
  					qualify_one(i, opt->bitflag, not, 1);
-#endif
+#endif /* SUPPORTED_PERSONALITIES >= 2 */

  #if SUPPORTED_PERSONALITIES >= 3
  			for (i = 0; i < nsyscalls2; i++)
  				if (sysent2[i].sys_flags & n)
  					qualify_one(i, opt->bitflag, not, 2);
-#endif
+#endif /* SUPPORTED_PERSONALITIES >= 3 */

  			continue;
  		}
@@ -1201,7 +1201,7 @@ internal_syscall(struct tcb *tcp)
  	   )
  		return internal_fork(tcp);

-#if defined(TCB_WAITEXECVE)
+#ifdef TCB_WAITEXECVE
  	if (   sys_execve == func
  # if defined(SPARC) || defined(SPARC64)
  	    || sys_execv == func
diff -dbBw -urp strace.9/util.c strace.a/util.c
--- strace.9/util.c	2012-02-25 15:26:22.000000000 +0100
+++ strace.a/util.c	2012-02-25 15:01:07.000000000 +0100
@@ -44,11 +44,11 @@
  # include <sys/uio.h>
  #endif

-#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
+#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
  #include <linux/ptrace.h>
  #endif

-#if defined(IA64)
+#ifdef IA64
  # include <asm/ptrace_offsets.h>
  # include <asm/rse.h>
  #endif
@@ -69,8 +69,7 @@
  # undef pt_all_user_regs
  #endif

-
-#if defined(SPARC64)
+#if defined(LINUXSPARC) && defined (SPARC64)
  # undef PTRACE_GETREGS
  # define PTRACE_GETREGS PTRACE_GETREGS64
  # undef PTRACE_SETREGS
@@ -1035,7 +1031,7 @@ printcall(struct tcb *tcp)
  			   sizeof(long) == 8 ? "[????????????????] " : \
  			   NULL /* crash */)

-#if defined(I386)
+# ifdef I386
  	long eip;

  	if (upeek(tcp, 4*EIP, &eip) < 0) {
@@ -1184,8 +1180,8 @@ printcall(struct tcb *tcp)
  	}
  	tprintf("[%08lx] ", pc);
  #endif /* architecture */
-}

+}

  /*
   * These #if's are huge, please indent them correctly.
@@ -1311,9 +1306,9 @@ set_arg1(struct tcb *tcp, arg_setup_stat
  typedef struct pt_regs arg_setup_state;

  # define arg_setup(tcp, state) \
-    (ptrace(PTRACE_GETREGS, (tcp)->pid, (char *) (state), 0))
+    (ptrace(PTRACE_GETREGS, tcp->pid, (char *) (state), 0))
  # define arg_finish_change(tcp, state) \
-    (ptrace(PTRACE_SETREGS, (tcp)->pid, (char *) (state), 0))
+    (ptrace(PTRACE_SETREGS, tcp->pid, (char *) (state), 0))

  # define get_arg0(tcp, state, valp) (*(valp) = (state)->u_regs[U_REG_O0], 0)
  # define get_arg1(tcp, state, valp) (*(valp) = (state)->u_regs[U_REG_O1], 0)
@@ -1377,8 +1372,10 @@ typedef int arg_setup_state;

  # define arg_setup(tcp, state)         (0)
  # define arg_finish_change(tcp, state) 0
-# define get_arg0(tcp, cookie, valp)   (upeek((tcp), arg0_offset, (valp)))
-# define get_arg1(tcp, cookie, valp)   (upeek((tcp), arg1_offset, (valp)))
+#   define get_arg0(tcp, cookie, valp) \
+    (upeek((tcp), arg0_offset, (valp)))
+#   define get_arg1(tcp, cookie, valp) \
+    (upeek((tcp), arg1_offset, (valp)))

  static int
  set_arg0(struct tcb *tcp, void *cookie, long val)





More information about the Strace-devel mailing list