diff -urN strace-4.3.org/process.c strace-4.3/process.c --- strace-4.3.org/process.c Wed Apr 4 19:25:52 2001 +++ strace-4.3/process.c Wed Apr 4 21:07:52 2001 @@ -75,7 +75,7 @@ #ifndef PTRACE_POKEUSR # define PTRACE_POKEUSR PTRACE_POKEUSER #endif -#elif defined(HAVE_LINUX_PTRACE_H) +#elif defined(HAVE_LINUX_PTRACE_H) && !defined(SPARC) #undef PTRACE_SYSCALL #include #endif diff -urN strace-4.3.org/signal.c strace-4.3/signal.c --- strace-4.3.org/signal.c Wed Apr 4 19:25:52 2001 +++ strace-4.3/signal.c Wed Apr 4 21:07:52 2001 @@ -51,7 +51,7 @@ #ifndef PTRACE_POKEUSR # define PTRACE_POKEUSR PTRACE_POKEUSER #endif -#elif defined(HAVE_LINUX_PTRACE_H) +#elif defined(HAVE_LINUX_PTRACE_H) && !defined(SPARC) #undef PTRACE_SYSCALL #include #endif @@ -80,7 +80,7 @@ #ifdef HAVE_ASM_SIGCONTEXT_H #ifdef SPARC typedef struct { - struct regs si_regs; + gregset_t si_regs; int si_mask; } m_siginfo_t; #else @@ -899,16 +899,16 @@ #else #ifdef SPARC long i1; - struct regs regs; + gregset_t regs; m_siginfo_t si; - if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) { + if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)regs, 0) < 0) { perror("sigreturn: PTRACE_GETREGS "); return 0; } if(entering(tcp)) { tcp->u_arg[0] = 0; - i1 = regs.r_o1; + i1 = regs[REG_O6] + 24 * 4; if(umove(tcp, i1, &si) < 0) { perror("sigreturn: umove "); return 0; diff -urN strace-4.3.org/syscall.c strace-4.3/syscall.c --- strace-4.3.org/syscall.c Wed Apr 4 19:25:52 2001 +++ strace-4.3/syscall.c Wed Apr 4 21:08:28 2001 @@ -62,9 +62,11 @@ # define PTRACE_PEEKUSR PTRACE_PEEKUSER #endif #elif defined(HAVE_LINUX_PTRACE_H) +#ifndef __sparc__ #undef PTRACE_SYSCALL #include #endif +#endif #if defined(LINUX) && defined(IA64) # include @@ -635,7 +637,7 @@ static long r0; static long a3; #elif defined (SPARC) - static struct regs regs; + static gregset_t regs; static unsigned long trap; #elif defined(MIPS) static long a3; @@ -761,14 +763,14 @@ } #elif defined (SPARC) /* Everything we need is in the current register set. */ - if (ptrace(PTRACE_GETREGS,pid,(char *)®s,0) < 0) + if (ptrace(PTRACE_GETREGS,pid,(char *)regs,0) < 0) return -1; /* If we are entering, then disassemble the syscall trap. */ if (!(tcp->flags & TCB_INSYSCALL)) { /* Retrieve the syscall trap instruction. */ errno = 0; - trap = ptrace(PTRACE_PEEKTEXT,pid,(char *)regs.r_pc,0); + trap = ptrace(PTRACE_PEEKTEXT,pid,(char *)regs[REG_PC],0); if (errno) return -1; @@ -804,7 +806,7 @@ tcp->flags &= ~TCB_WAITEXECVE; return 0; } - fprintf(stderr,"syscall: unknown syscall trap %08x %08x\n", trap, regs.r_pc); + fprintf(stderr,"syscall: unknown syscall trap %08x %08x\n", trap, regs[REG_PC]); return -1; } @@ -812,10 +814,10 @@ if (trap == 0x91d02027) scno = 156; else - scno = regs.r_g1; + scno = regs[REG_G1]; if (scno == 0) { - scno = regs.r_o0; - memmove (®s.r_o0, ®s.r_o1, 7*sizeof(regs.r_o0)); + scno = regs[REG_O0]; + memmove (®s[REG_O0], ®s[REG_O1], 7*sizeof(regs[REG_O0])); } } #elif defined(HPPA) @@ -1067,12 +1069,12 @@ } #else /* !ALPHA */ #ifdef SPARC - if (regs.r_psr & PSR_C) { + if (regs[REG_PSR] & PSR_C) { tcp->u_rval = -1; - u_error = regs.r_o0; + u_error = regs[REG_O0]; } else { - tcp->u_rval = regs.r_o0; + tcp->u_rval = regs[REG_O0]; u_error = 0; } #else /* !SPARC */ @@ -1109,12 +1111,12 @@ #ifdef SVR4 #ifdef SPARC /* Judicious guessing goes a long way. */ - if (tcp->status.pr_reg[R_PSR] & 0x100000) { + if (tcp->status.pr_reg[REG_PSR] & 0x100000) { tcp->u_rval = -1; - u_error = tcp->status.pr_reg[R_O0]; + u_error = tcp->status.pr_reg[REG_O0]; } else { - tcp->u_rval = tcp->status.pr_reg[R_O0]; + tcp->u_rval = tcp->status.pr_reg[REG_O0]; u_error = 0; } #endif /* SPARC */ @@ -1262,7 +1264,7 @@ else tcp->u_nargs = MAX_ARGS; for (i = 0; i < tcp->u_nargs; i++) - tcp->u_arg[i] = *((®s.r_o0) + i); + tcp->u_arg[i] = *((®s[REG_O0]) + i); } #elif defined (HPPA) { @@ -1715,10 +1717,10 @@ #ifdef LINUX #ifdef SPARC - struct regs regs; - if (ptrace(PTRACE_GETREGS,tcp->pid,(char *)®s,0) < 0) + gregset_t regs; + if (ptrace(PTRACE_GETREGS,tcp->pid,(char *)regs,0) < 0) return -1; - val = regs.r_o1; + val = regs[REG_O1]; #endif /* SPARC */ #endif /* LINUX */ diff -urN strace-4.3.org/util.c strace-4.3/util.c --- strace-4.3.org/util.c Wed Apr 4 19:25:52 2001 +++ strace-4.3/util.c Wed Apr 4 21:07:52 2001 @@ -44,7 +44,7 @@ #include #endif /* SUNOS4 */ -#if defined(linux) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)) +#if defined(linux) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)) && !defined(SPARC) #include #endif