Fixing many instances of broken indentation with spaces instead of tabs.

No code changes.
This commit is contained in:
Denys Vlasenko
2008-12-30 18:47:55 +00:00
parent 8ba1cd7d12
commit adedb51019
12 changed files with 265 additions and 268 deletions

2
desc.c
View File

@@ -658,7 +658,7 @@ struct tcb *tcp;
{ {
if (entering(tcp)) { if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]); tprintf("%ld, ", tcp->u_arg[0]);
printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???"); printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
tprintf(", %ld, ", tcp->u_arg[2]); tprintf(", %ld, ", tcp->u_arg[2]);
if (tcp->u_arg[3] == 0) if (tcp->u_arg[3] == 0)
tprintf("NULL"); tprintf("NULL");

40
file.c
View File

@@ -722,29 +722,29 @@ sprinttime(time_t t)
#ifdef LINUXSPARC #ifdef LINUXSPARC
typedef struct { typedef struct {
int tv_sec; int tv_sec;
int tv_nsec; int tv_nsec;
} timestruct_t; } timestruct_t;
struct solstat { struct solstat {
unsigned st_dev; unsigned st_dev;
int st_pad1[3]; /* network id */ int st_pad1[3]; /* network id */
unsigned st_ino; unsigned st_ino;
unsigned st_mode; unsigned st_mode;
unsigned st_nlink; unsigned st_nlink;
unsigned st_uid; unsigned st_uid;
unsigned st_gid; unsigned st_gid;
unsigned st_rdev; unsigned st_rdev;
int st_pad2[2]; int st_pad2[2];
int st_size; int st_size;
int st_pad3; /* st_size, off_t expansion */ int st_pad3; /* st_size, off_t expansion */
timestruct_t st_atime; timestruct_t st_atime;
timestruct_t st_mtime; timestruct_t st_mtime;
timestruct_t st_ctime; timestruct_t st_ctime;
int st_blksize; int st_blksize;
int st_blocks; int st_blocks;
char st_fstype[16]; char st_fstype[16];
int st_pad4[8]; /* expansion area */ int st_pad4[8]; /* expansion area */
}; };
static void static void

View File

@@ -233,7 +233,7 @@
{ 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 225 */ { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 225 */
{ 4, TD, sys_epoll_wait, "epoll_wait" }, /* 226 */ { 4, TD, sys_epoll_wait, "epoll_wait" }, /* 226 */
{ 5, 0, printargs, "remap_file_pages" }, /* 227 */ { 5, 0, printargs, "remap_file_pages" }, /* 227 */
{ 5, TI, sys_semtimedop, "semtimedop" }, /* 228 */ { 5, TI, sys_semtimedop, "semtimedop" }, /* 228 */
{ 5, 0, printargs, "mq_open" }, /* 229 */ { 5, 0, printargs, "mq_open" }, /* 229 */
{ 5, 0, printargs, "mq_unlink" }, /* 230 */ { 5, 0, printargs, "mq_unlink" }, /* 230 */
{ 5, 0, printargs, "mq_timedsend" }, /* 231 */ { 5, 0, printargs, "mq_timedsend" }, /* 231 */

View File

@@ -245,7 +245,7 @@
{ 1, 0, sys_setgid, "setgid" }, /* 214 */ { 1, 0, sys_setgid, "setgid" }, /* 214 */
{ 1, 0, sys_setfsuid, "setfsuid" }, /* 215 */ { 1, 0, sys_setfsuid, "setfsuid" }, /* 215 */
{ 1, 0, sys_setfsgid, "setfsgid" }, /* 216 */ { 1, 0, sys_setfsgid, "setfsgid" }, /* 216 */
{ 2, TF, sys_pivotroot, "pivot_root" }, /* 217 */ { 2, TF, sys_pivotroot, "pivot_root" }, /* 217 */
{ 3, 0, sys_mincore, "mincore" }, /* 218 */ { 3, 0, sys_mincore, "mincore" }, /* 218 */
{ 3, 0, sys_madvise, "madvise" }, /* 219 */ { 3, 0, sys_madvise, "madvise" }, /* 219 */
{ 3, TD, sys_getdents64, "getdents64" }, /* 220 */ { 3, TD, sys_getdents64, "getdents64" }, /* 220 */

View File

@@ -244,7 +244,7 @@
{ 1, 0, sys_setgid, "setgid" }, /* 214 */ { 1, 0, sys_setgid, "setgid" }, /* 214 */
{ 1, 0, sys_setfsuid, "setfsuid" }, /* 215 */ { 1, 0, sys_setfsuid, "setfsuid" }, /* 215 */
{ 1, 0, sys_setfsgid, "setfsgid" }, /* 216 */ { 1, 0, sys_setfsgid, "setfsgid" }, /* 216 */
{ 2, TF, sys_pivotroot, "pivot_root" }, /* 217 */ { 2, TF, sys_pivotroot, "pivot_root" }, /* 217 */
{ 3, 0, sys_mincore, "mincore" }, /* 218 */ { 3, 0, sys_mincore, "mincore" }, /* 218 */
{ 3, 0, sys_madvise, "madvise" }, /* 219 */ { 3, 0, sys_madvise, "madvise" }, /* 219 */
{ 3, TD, sys_getdents64, "getdents64" }, /* 220 */ { 3, TD, sys_getdents64, "getdents64" }, /* 220 */

View File

@@ -11,7 +11,7 @@
{ 1, TF, sys_unlink, "unlink" }, /* 10 */ { 1, TF, sys_unlink, "unlink" }, /* 10 */
{ 2, TF|TP, sys_execv, "execv" }, /* 11 */ { 2, TF|TP, sys_execv, "execv" }, /* 11 */
{ 1, TF, sys_chdir, "chdir" }, /* 12 */ { 1, TF, sys_chdir, "chdir" }, /* 12 */
{ 3, TF, sys_chown, "chown"}, /* 13 */ { 3, TF, sys_chown, "chown"}, /* 13 */
{ 3, TF, sys_mknod, "mknod" }, /* 14 */ { 3, TF, sys_mknod, "mknod" }, /* 14 */
{ 2, TF, sys_chmod, "chmod" }, /* 15 */ { 2, TF, sys_chmod, "chmod" }, /* 15 */
{ 3, TF, sys_chown, "lchown" }, /* 16 */ { 3, TF, sys_chown, "lchown" }, /* 16 */

89
mem.c
View File

@@ -229,48 +229,47 @@ long long offset;
int sys_old_mmap(tcp) int sys_old_mmap(tcp)
struct tcb *tcp; struct tcb *tcp;
{ {
long u_arg[6]; long u_arg[6];
#if defined(IA64) #if defined(IA64)
int i, v; int i, v;
/* /*
* IA64 processes never call this routine, they only use the * IA64 processes never call this routine, they only use the
* new `sys_mmap' interface. This code converts the integer * new `sys_mmap' interface. This code converts the integer
* arguments that the IA32 process pushed onto the stack into * arguments that the IA32 process pushed onto the stack into
* longs. * longs.
* *
* Note that addresses with bit 31 set will be sign extended. * Note that addresses with bit 31 set will be sign extended.
* Fortunately, those addresses are not currently being generated * Fortunately, those addresses are not currently being generated
* for IA32 processes so it's not a problem. * for IA32 processes so it's not a problem.
*/ */
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
if (umove(tcp, tcp->u_arg[0] + (i * sizeof(int)), &v) == -1) if (umove(tcp, tcp->u_arg[0] + (i * sizeof(int)), &v) == -1)
return 0; return 0;
else else
u_arg[i] = v; u_arg[i] = v;
#elif defined(SH) || defined(SH64) #elif defined(SH) || defined(SH64)
/* SH has always passed the args in registers */ /* SH has always passed the args in registers */
int i; int i;
for (i=0; i<6; i++) for (i=0; i<6; i++)
u_arg[i] = tcp->u_arg[i]; u_arg[i] = tcp->u_arg[i];
#else #else
# if defined(X86_64) # if defined(X86_64)
if (current_personality == 1) { if (current_personality == 1) {
int i; int i;
for (i = 0; i < 6; ++i) { for (i = 0; i < 6; ++i) {
unsigned int val; unsigned int val;
if (umove(tcp, tcp->u_arg[0] + i * 4, &val) == -1) if (umove(tcp, tcp->u_arg[0] + i * 4, &val) == -1)
return 0; return 0;
u_arg[i] = val; u_arg[i] = val;
} }
} }
else else
# endif # endif
if (umoven(tcp, tcp->u_arg[0], sizeof u_arg, (char *) u_arg) == -1) if (umoven(tcp, tcp->u_arg[0], sizeof u_arg, (char *) u_arg) == -1)
return 0; return 0;
#endif // defined(IA64) #endif // defined(IA64)
return print_mmap(tcp, u_arg, u_arg[5]); return print_mmap(tcp, u_arg, u_arg[5]);
} }
#endif #endif
@@ -278,21 +277,21 @@ int
sys_mmap(tcp) sys_mmap(tcp)
struct tcb *tcp; struct tcb *tcp;
{ {
long long offset = tcp->u_arg[5]; long long offset = tcp->u_arg[5];
#if defined(LINUX) && defined(SH64) #if defined(LINUX) && defined(SH64)
/* /*
* Old mmap differs from new mmap in specifying the * Old mmap differs from new mmap in specifying the
* offset in units of bytes rather than pages. We * offset in units of bytes rather than pages. We
* pretend it's in byte units so the user only ever * pretend it's in byte units so the user only ever
* sees bytes in the printout. * sees bytes in the printout.
*/ */
offset <<= PAGE_SHIFT; offset <<= PAGE_SHIFT;
#endif #endif
#if defined(LINUX_MIPSN32) #if defined(LINUX_MIPSN32)
offset = tcp->ext_arg[5]; offset = tcp->ext_arg[5];
#endif #endif
return print_mmap(tcp, tcp->u_arg, offset); return print_mmap(tcp, tcp->u_arg, offset);
} }
#endif /* !HAVE_LONG_LONG_OFF_T */ #endif /* !HAVE_LONG_LONG_OFF_T */

132
process.c
View File

@@ -725,7 +725,7 @@ int new;
if (ptrace(PTRACE_POKEUSER, tcp->pid, if (ptrace(PTRACE_POKEUSER, tcp->pid,
(char*)(sizeof(unsigned long)*PT_R0), new) < 0) (char*)(sizeof(unsigned long)*PT_R0), new) < 0)
return -1; return -1;
return 0; return 0;
#elif defined(S390) || defined(S390X) #elif defined(S390) || defined(S390X)
/* s390 linux after 2.4.7 has a hook in entry.S to allow this */ /* s390 linux after 2.4.7 has a hook in entry.S to allow this */
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR2), new)<0) if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR2), new)<0)
@@ -775,26 +775,26 @@ int new;
return -1; return -1;
return 0; return 0;
#elif defined(SH) #elif defined(SH)
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*(REG_REG0+3)), new)<0) if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*(REG_REG0+3)), new)<0)
return -1; return -1;
return 0; return 0;
#elif defined(SH64) #elif defined(SH64)
/* Top half of reg encodes the no. of args n as 0x1n. /* Top half of reg encodes the no. of args n as 0x1n.
Assume 0 args as kernel never actually checks... */ Assume 0 args as kernel never actually checks... */
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_SYSCALL), if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_SYSCALL),
0x100000 | new) < 0) 0x100000 | new) < 0)
return -1; return -1;
return 0; return 0;
#elif defined(ARM) #elif defined(ARM)
/* Some kernels support this, some (pre-2.6.16 or so) don't. */ /* Some kernels support this, some (pre-2.6.16 or so) don't. */
# ifndef PTRACE_SET_SYSCALL # ifndef PTRACE_SET_SYSCALL
# define PTRACE_SET_SYSCALL 23 # define PTRACE_SET_SYSCALL 23
# endif # endif
if (ptrace (PTRACE_SET_SYSCALL, tcp->pid, 0, new) != 0) if (ptrace (PTRACE_SET_SYSCALL, tcp->pid, 0, new) != 0)
return -1; return -1;
return 0; return 0;
#else #else
#warning Do not know how to handle change_syscall for this architecture #warning Do not know how to handle change_syscall for this architecture
#endif /* architecture */ #endif /* architecture */
@@ -864,7 +864,7 @@ setarg(tcp, argnum)
return -1; return -1;
} }
#elif defined(S390) || defined(S390X) #elif defined(S390) || defined(S390X)
{ {
if(argnum <= 5) if(argnum <= 5)
ptrace(PTRACE_POKEUSER, tcp->pid, ptrace(PTRACE_POKEUSER, tcp->pid,
(char *) (argnum==0 ? PT_ORIGGPR2 : (char *) (argnum==0 ? PT_ORIGGPR2 :
@@ -874,7 +874,7 @@ setarg(tcp, argnum)
return -E2BIG; return -E2BIG;
if (errno) if (errno)
return -1; return -1;
} }
#else #else
# warning Sorry, setargs not implemented for this architecture. # warning Sorry, setargs not implemented for this architecture.
#endif #endif
@@ -2747,57 +2747,57 @@ const struct xlat struct_user_offsets[] = {
#endif /* M68K */ #endif /* M68K */
#endif /* !I386 */ #endif /* !I386 */
#ifdef SH #ifdef SH
{ 4*REG_REG0, "4*REG_REG0" }, { 4*REG_REG0, "4*REG_REG0" },
{ 4*(REG_REG0+1), "4*REG_REG1" }, { 4*(REG_REG0+1), "4*REG_REG1" },
{ 4*(REG_REG0+2), "4*REG_REG2" }, { 4*(REG_REG0+2), "4*REG_REG2" },
{ 4*(REG_REG0+3), "4*REG_REG3" }, { 4*(REG_REG0+3), "4*REG_REG3" },
{ 4*(REG_REG0+4), "4*REG_REG4" }, { 4*(REG_REG0+4), "4*REG_REG4" },
{ 4*(REG_REG0+5), "4*REG_REG5" }, { 4*(REG_REG0+5), "4*REG_REG5" },
{ 4*(REG_REG0+6), "4*REG_REG6" }, { 4*(REG_REG0+6), "4*REG_REG6" },
{ 4*(REG_REG0+7), "4*REG_REG7" }, { 4*(REG_REG0+7), "4*REG_REG7" },
{ 4*(REG_REG0+8), "4*REG_REG8" }, { 4*(REG_REG0+8), "4*REG_REG8" },
{ 4*(REG_REG0+9), "4*REG_REG9" }, { 4*(REG_REG0+9), "4*REG_REG9" },
{ 4*(REG_REG0+10), "4*REG_REG10" }, { 4*(REG_REG0+10), "4*REG_REG10" },
{ 4*(REG_REG0+11), "4*REG_REG11" }, { 4*(REG_REG0+11), "4*REG_REG11" },
{ 4*(REG_REG0+12), "4*REG_REG12" }, { 4*(REG_REG0+12), "4*REG_REG12" },
{ 4*(REG_REG0+13), "4*REG_REG13" }, { 4*(REG_REG0+13), "4*REG_REG13" },
{ 4*(REG_REG0+14), "4*REG_REG14" }, { 4*(REG_REG0+14), "4*REG_REG14" },
{ 4*REG_REG15, "4*REG_REG15" }, { 4*REG_REG15, "4*REG_REG15" },
{ 4*REG_PC, "4*REG_PC" }, { 4*REG_PC, "4*REG_PC" },
{ 4*REG_PR, "4*REG_PR" }, { 4*REG_PR, "4*REG_PR" },
{ 4*REG_SR, "4*REG_SR" }, { 4*REG_SR, "4*REG_SR" },
{ 4*REG_GBR, "4*REG_GBR" }, { 4*REG_GBR, "4*REG_GBR" },
{ 4*REG_MACH, "4*REG_MACH" }, { 4*REG_MACH, "4*REG_MACH" },
{ 4*REG_MACL, "4*REG_MACL" }, { 4*REG_MACL, "4*REG_MACL" },
{ 4*REG_SYSCALL, "4*REG_SYSCALL" }, { 4*REG_SYSCALL, "4*REG_SYSCALL" },
{ 4*REG_FPUL, "4*REG_FPUL" }, { 4*REG_FPUL, "4*REG_FPUL" },
{ 4*REG_FPREG0, "4*REG_FPREG0" }, { 4*REG_FPREG0, "4*REG_FPREG0" },
{ 4*(REG_FPREG0+1), "4*REG_FPREG1" }, { 4*(REG_FPREG0+1), "4*REG_FPREG1" },
{ 4*(REG_FPREG0+2), "4*REG_FPREG2" }, { 4*(REG_FPREG0+2), "4*REG_FPREG2" },
{ 4*(REG_FPREG0+3), "4*REG_FPREG3" }, { 4*(REG_FPREG0+3), "4*REG_FPREG3" },
{ 4*(REG_FPREG0+4), "4*REG_FPREG4" }, { 4*(REG_FPREG0+4), "4*REG_FPREG4" },
{ 4*(REG_FPREG0+5), "4*REG_FPREG5" }, { 4*(REG_FPREG0+5), "4*REG_FPREG5" },
{ 4*(REG_FPREG0+6), "4*REG_FPREG6" }, { 4*(REG_FPREG0+6), "4*REG_FPREG6" },
{ 4*(REG_FPREG0+7), "4*REG_FPREG7" }, { 4*(REG_FPREG0+7), "4*REG_FPREG7" },
{ 4*(REG_FPREG0+8), "4*REG_FPREG8" }, { 4*(REG_FPREG0+8), "4*REG_FPREG8" },
{ 4*(REG_FPREG0+9), "4*REG_FPREG9" }, { 4*(REG_FPREG0+9), "4*REG_FPREG9" },
{ 4*(REG_FPREG0+10), "4*REG_FPREG10" }, { 4*(REG_FPREG0+10), "4*REG_FPREG10" },
{ 4*(REG_FPREG0+11), "4*REG_FPREG11" }, { 4*(REG_FPREG0+11), "4*REG_FPREG11" },
{ 4*(REG_FPREG0+12), "4*REG_FPREG12" }, { 4*(REG_FPREG0+12), "4*REG_FPREG12" },
{ 4*(REG_FPREG0+13), "4*REG_FPREG13" }, { 4*(REG_FPREG0+13), "4*REG_FPREG13" },
{ 4*(REG_FPREG0+14), "4*REG_FPREG14" }, { 4*(REG_FPREG0+14), "4*REG_FPREG14" },
{ 4*REG_FPREG15, "4*REG_FPREG15" }, { 4*REG_FPREG15, "4*REG_FPREG15" },
#ifdef REG_XDREG0 #ifdef REG_XDREG0
{ 4*REG_XDREG0, "4*REG_XDREG0" }, { 4*REG_XDREG0, "4*REG_XDREG0" },
{ 4*(REG_XDREG0+2), "4*REG_XDREG2" }, { 4*(REG_XDREG0+2), "4*REG_XDREG2" },
{ 4*(REG_XDREG0+4), "4*REG_XDREG4" }, { 4*(REG_XDREG0+4), "4*REG_XDREG4" },
{ 4*(REG_XDREG0+6), "4*REG_XDREG6" }, { 4*(REG_XDREG0+6), "4*REG_XDREG6" },
{ 4*(REG_XDREG0+8), "4*REG_XDREG8" }, { 4*(REG_XDREG0+8), "4*REG_XDREG8" },
{ 4*(REG_XDREG0+10), "4*REG_XDREG10" }, { 4*(REG_XDREG0+10), "4*REG_XDREG10" },
{ 4*(REG_XDREG0+12), "4*REG_XDREG12" }, { 4*(REG_XDREG0+12), "4*REG_XDREG12" },
{ 4*REG_XDREG14, "4*REG_XDREG14" }, { 4*REG_XDREG14, "4*REG_XDREG14" },
#endif #endif
{ 4*REG_FPSCR, "4*REG_FPSCR" }, { 4*REG_FPSCR, "4*REG_FPSCR" },
#endif /* SH */ #endif /* SH */
#ifdef SH64 #ifdef SH64
{ 0, "PC(L)" }, { 0, "PC(L)" },
@@ -2948,8 +2948,8 @@ const struct xlat struct_user_offsets[] = {
{ 580, "TR6(U)" }, { 580, "TR6(U)" },
{ 584, "TR7(L)" }, { 584, "TR7(L)" },
{ 588, "TR7(U)" }, { 588, "TR7(U)" },
/* This entry is in case pt_regs contains dregs (depends on /* This entry is in case pt_regs contains dregs (depends on
the kernel build options). */ the kernel build options). */
{ uoff(regs), "offsetof(struct user, regs)" }, { uoff(regs), "offsetof(struct user, regs)" },
{ uoff(fpu), "offsetof(struct user, fpu)" }, { uoff(fpu), "offsetof(struct user, fpu)" },
#endif #endif

4
sock.c
View File

@@ -192,7 +192,7 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
tprintf("%s={", str); tprintf("%s={", str);
printxval(addrfams, printxval(addrfams,
ifr.ifr_addr.sa_family, ifr.ifr_addr.sa_family,
"AF_???"); "AF_???");
tprintf(", "); tprintf(", ");
print_addr(tcp, ((long) tcp->u_arg[2] print_addr(tcp, ((long) tcp->u_arg[2]
+ offsetof (struct ifreq, + offsetof (struct ifreq,
@@ -252,7 +252,7 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
return 1; return 1;
} }
tprintf("%d, ", ifc.ifc_len); tprintf("%d, ", ifc.ifc_len);
if (syserror(tcp)) { if (syserror(tcp)) {
tprintf("%lx", (unsigned long) ifc.ifc_buf); tprintf("%lx", (unsigned long) ifc.ifc_buf);
} else if (ifc.ifc_buf == NULL) { } else if (ifc.ifc_buf == NULL) {
tprintf("NULL"); tprintf("NULL");

View File

@@ -55,9 +55,9 @@
#ifndef HAVE_STROPTS_H #ifndef HAVE_STROPTS_H
#define RS_HIPRI 1 #define RS_HIPRI 1
struct strbuf { struct strbuf {
int maxlen; /* no. of bytes in buffer */ int maxlen; /* no. of bytes in buffer */
int len; /* no. of bytes returned */ int len; /* no. of bytes returned */
char *buf; /* pointer to data */ char *buf; /* pointer to data */
}; };
#define MORECTL 1 #define MORECTL 1
#define MOREDATA 2 #define MOREDATA 2
@@ -350,7 +350,7 @@ decode_poll(struct tcb *tcp, long pts)
} else { } else {
static char outstr[1024]; static char outstr[1024];
char str[64]; char str[64];
const char *flagstr; const char *flagstr;
unsigned int cumlen; unsigned int cumlen;
if (syserror(tcp)) if (syserror(tcp))

176
syscall.c
View File

@@ -545,17 +545,16 @@ struct tcb *tcp;
dumpstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); dumpstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
break; break;
#ifdef SYS_readv #ifdef SYS_readv
case SYS_readv: case SYS_readv:
if (qual_flags[tcp->u_arg[0]] & QUAL_READ) if (qual_flags[tcp->u_arg[0]] & QUAL_READ)
dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
break; break;
#endif #endif
#ifdef SYS_writev #ifdef SYS_writev
case SYS_writev: case SYS_writev:
if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE)
if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE) dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); break;
break;
#endif #endif
} }
} }
@@ -769,11 +768,11 @@ internal_syscall(struct tcb *tcp)
#elif defined(HPPA) #elif defined(HPPA)
static long r28; static long r28;
#elif defined(SH) #elif defined(SH)
static long r0; static long r0;
#elif defined(SH64) #elif defined(SH64)
static long r9; static long r9;
#elif defined(X86_64) #elif defined(X86_64)
static long rax; static long rax;
#endif #endif
#endif /* LINUX */ #endif /* LINUX */
#ifdef FREEBSD #ifdef FREEBSD
@@ -1169,7 +1168,7 @@ struct tcb *tcp;
if (ptrace(PTRACE_GETREGS,pid,(char *)&regs,0) < 0) if (ptrace(PTRACE_GETREGS,pid,(char *)&regs,0) < 0)
return -1; return -1;
/* If we are entering, then disassemble the syscall trap. */ /* If we are entering, then disassemble the syscall trap. */
if (!(tcp->flags & TCB_INSYSCALL)) { if (!(tcp->flags & TCB_INSYSCALL)) {
/* Retrieve the syscall trap instruction. */ /* Retrieve the syscall trap instruction. */
errno = 0; errno = 0;
@@ -1241,38 +1240,37 @@ struct tcb *tcp;
} }
} }
#elif defined(SH) #elif defined(SH)
/* /*
* In the new syscall ABI, the system call number is in R3. * In the new syscall ABI, the system call number is in R3.
*/ */
if (upeek(tcp, 4*(REG_REG0+3), &scno) < 0) if (upeek(tcp, 4*(REG_REG0+3), &scno) < 0)
return -1; return -1;
if (scno < 0) { if (scno < 0) {
/* Odd as it may seem, a glibc bug has been known to cause /* Odd as it may seem, a glibc bug has been known to cause
glibc to issue bogus negative syscall numbers. So for glibc to issue bogus negative syscall numbers. So for
our purposes, make strace print what it *should* have been */ our purposes, make strace print what it *should* have been */
long correct_scno = (scno & 0xff); long correct_scno = (scno & 0xff);
if (debug) if (debug)
fprintf(stderr, fprintf(stderr,
"Detected glibc bug: bogus system call number = %ld, " "Detected glibc bug: bogus system call"
"correcting to %ld\n", " number = %ld, correcting to %ld\n",
scno, scno,
correct_scno); correct_scno);
scno = correct_scno; scno = correct_scno;
} }
if (!(tcp->flags & TCB_INSYSCALL)) {
if (!(tcp->flags & TCB_INSYSCALL)) { /* Check if we return from execve. */
/* Check if we return from execve. */ if (scno == 0 && tcp->flags & TCB_WAITEXECVE) {
if (scno == 0 && tcp->flags & TCB_WAITEXECVE) { tcp->flags &= ~TCB_WAITEXECVE;
tcp->flags &= ~TCB_WAITEXECVE; return 0;
return 0; }
} }
}
#elif defined(SH64) #elif defined(SH64)
if (upeek(tcp, REG_SYSCALL, &scno) < 0) if (upeek(tcp, REG_SYSCALL, &scno) < 0)
return -1; return -1;
scno &= 0xFFFF; scno &= 0xFFFF;
if (!(tcp->flags & TCB_INSYSCALL)) { if (!(tcp->flags & TCB_INSYSCALL)) {
/* Check if we return from execve. */ /* Check if we return from execve. */
@@ -1287,13 +1285,13 @@ struct tcb *tcp;
if (upeek(tcp, uoff(u_arg[7]), &scno) < 0) if (upeek(tcp, uoff(u_arg[7]), &scno) < 0)
return -1; return -1;
#elif defined(SH) #elif defined(SH)
/* new syscall ABI returns result in R0 */ /* new syscall ABI returns result in R0 */
if (upeek(tcp, 4*REG_REG0, (long *)&r0) < 0) if (upeek(tcp, 4*REG_REG0, (long *)&r0) < 0)
return -1; return -1;
#elif defined(SH64) #elif defined(SH64)
/* ABI defines result returned in r9 */ /* ABI defines result returned in r9 */
if (upeek(tcp, REG_GENERAL(9), (long *)&r9) < 0) if (upeek(tcp, REG_GENERAL(9), (long *)&r9) < 0)
return -1; return -1;
#endif #endif
#ifdef USE_PROCFS #ifdef USE_PROCFS
@@ -1304,17 +1302,17 @@ struct tcb *tcp;
scno = tcp->status.PR_WHAT; scno = tcp->status.PR_WHAT;
#else /* FREEBSD */ #else /* FREEBSD */
if (pread(tcp->pfd_reg, &regs, sizeof(regs), 0) < 0) { if (pread(tcp->pfd_reg, &regs, sizeof(regs), 0) < 0) {
perror("pread"); perror("pread");
return -1; return -1;
} }
switch (regs.r_eax) { switch (regs.r_eax) {
case SYS_syscall: case SYS_syscall:
case SYS___syscall: case SYS___syscall:
pread(tcp->pfd, &scno, sizeof(scno), regs.r_esp + sizeof(int)); pread(tcp->pfd, &scno, sizeof(scno), regs.r_esp + sizeof(int));
break; break;
default: default:
scno = regs.r_eax; scno = regs.r_eax;
break; break;
} }
#endif /* FREEBSD */ #endif /* FREEBSD */
#endif /* !HAVE_PR_SYSCALL */ #endif /* !HAVE_PR_SYSCALL */
@@ -1658,15 +1656,15 @@ struct tcb *tcp;
} }
#else #else
#ifdef SH64 #ifdef SH64
/* interpret result as return value or error number */ /* interpret result as return value or error number */
if (is_negated_errno(r9)) { if (is_negated_errno(r9)) {
tcp->u_rval = -1; tcp->u_rval = -1;
u_error = -r9; u_error = -r9;
} }
else { else {
tcp->u_rval = r9; tcp->u_rval = r9;
u_error = 0; u_error = 0;
} }
#endif /* SH64 */ #endif /* SH64 */
#endif /* SH */ #endif /* SH */
#endif /* HPPA */ #endif /* HPPA */
@@ -1840,8 +1838,8 @@ force_result(tcp, error, rval)
return -1; return -1;
#else /* !M68K */ #else /* !M68K */
#ifdef ARM #ifdef ARM
regs.ARM_r0 = error ? -error : rval; regs.ARM_r0 = error ? -error : rval;
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*0), regs.ARM_r0) < 0) if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*0), regs.ARM_r0) < 0)
return -1; return -1;
#else /* !ARM */ #else /* !ARM */
#ifdef ALPHA #ifdef ALPHA
@@ -1896,7 +1894,7 @@ force_result(tcp, error, rval)
return -1; return -1;
#else #else
#ifdef SH64 #ifdef SH64
r9 = error ? -error : rval; r9 = error ? -error : rval;
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)REG_GENERAL(9), r9) < 0) if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)REG_GENERAL(9), r9) < 0)
return -1; return -1;
#endif /* SH64 */ #endif /* SH64 */
@@ -1927,9 +1925,9 @@ force_result(tcp, error, rval)
#endif /* SVR4 */ #endif /* SVR4 */
#ifdef FREEBSD #ifdef FREEBSD
if (pread(tcp->pfd_reg, &regs, sizeof(regs), 0) < 0) { if (pread(tcp->pfd_reg, &regs, sizeof(regs), 0) < 0) {
perror("pread"); perror("pread");
return -1; return -1;
} }
if (error) { if (error) {
regs.r_eflags |= PSL_C; regs.r_eflags |= PSL_C;
regs.r_eax = error; regs.r_eax = error;
@@ -1939,9 +1937,9 @@ force_result(tcp, error, rval)
regs.r_eax = rval; regs.r_eax = rval;
} }
if (pwrite(tcp->pfd_reg, &regs, sizeof(regs), 0) < 0) { if (pwrite(tcp->pfd_reg, &regs, sizeof(regs), 0) < 0) {
perror("pwrite"); perror("pwrite");
return -1; return -1;
} }
#endif /* FREEBSD */ #endif /* FREEBSD */
/* All branches reach here on success (only). */ /* All branches reach here on success (only). */
@@ -2153,23 +2151,23 @@ struct tcb *tcp;
return -1; return -1;
} }
#elif defined(SH) #elif defined(SH)
{ {
int i; int i;
static int syscall_regs[] = { static int syscall_regs[] = {
REG_REG0+4, REG_REG0+5, REG_REG0+6, REG_REG0+7, REG_REG0+4, REG_REG0+5, REG_REG0+6, REG_REG0+7,
REG_REG0, REG_REG0+1, REG_REG0+2 REG_REG0, REG_REG0+1, REG_REG0+2
}; };
tcp->u_nargs = sysent[tcp->scno].nargs; tcp->u_nargs = sysent[tcp->scno].nargs;
for (i = 0; i < tcp->u_nargs; i++) { for (i = 0; i < tcp->u_nargs; i++) {
if (upeek(tcp, 4*syscall_regs[i], &tcp->u_arg[i]) < 0) if (upeek(tcp, 4*syscall_regs[i], &tcp->u_arg[i]) < 0)
return -1; return -1;
} }
} }
#elif defined(SH64) #elif defined(SH64)
{ {
int i; int i;
/* Registers used by SH5 Linux system calls for parameters */ /* Registers used by SH5 Linux system calls for parameters */
static int syscall_regs[] = { 2, 3, 4, 5, 6, 7 }; static int syscall_regs[] = { 2, 3, 4, 5, 6, 7 };
/* /*
@@ -2300,15 +2298,15 @@ struct tcb *tcp;
case SYS___syscall: case SYS___syscall:
pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long), pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long),
regs.r_esp + sizeof(int) + sizeof(quad_t)); regs.r_esp + sizeof(int) + sizeof(quad_t));
break; break;
case SYS_syscall: case SYS_syscall:
pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long), pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long),
regs.r_esp + 2 * sizeof(int)); regs.r_esp + 2 * sizeof(int));
break; break;
default: default:
pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long), pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long),
regs.r_esp + sizeof(int)); regs.r_esp + sizeof(int));
break; break;
} }
#endif /* FREEBSD */ #endif /* FREEBSD */
return 1; return 1;

74
util.c
View File

@@ -127,7 +127,7 @@ __asm__ volatile ("or %%g0, %1, %%o0\n\t" \
"i" (__NR_##syscall) \ "i" (__NR_##syscall) \
: "g1", "o0", "o1", "o2", "o3", "o4"); \ : "g1", "o0", "o1", "o2", "o3", "o4"); \
if (__res>=0) \ if (__res>=0) \
return (type) __res; \ return (type) __res; \
errno = -__res; \ errno = -__res; \
return -1; \ return -1; \
} }
@@ -706,13 +706,13 @@ long addr;
} }
if (umoven(tcp, addr, size, (char *) iov) >= 0) { if (umoven(tcp, addr, size, (char *) iov) >= 0) {
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
/* include the buffer number to make it easy to /* include the buffer number to make it easy to
* match up the trace with the source */ * match up the trace with the source */
tprintf(" * %lu bytes in buffer %d\n", tprintf(" * %lu bytes in buffer %d\n",
(unsigned long)iov_iov_len(i), i); (unsigned long)iov_iov_len(i), i);
dumpstr(tcp, (long) iov_iov_base(i), dumpstr(tcp, (long) iov_iov_base(i),
iov_iov_len(i)); iov_iov_len(i));
} }
} }
free((char *) iov); free((char *) iov);
#undef sizeof_iov #undef sizeof_iov
@@ -1195,11 +1195,11 @@ struct tcb *tcp;
if(upeek(tcp,PT_IAOQ0,&pc) < 0) if(upeek(tcp,PT_IAOQ0,&pc) < 0)
return -1; return -1;
#elif defined(SH) #elif defined(SH)
if (upeek(tcp, 4*REG_PC ,&pc) < 0) if (upeek(tcp, 4*REG_PC ,&pc) < 0)
return -1; return -1;
#elif defined(SH64) #elif defined(SH64)
if (upeek(tcp, REG_PC ,&pc) < 0) if (upeek(tcp, REG_PC ,&pc) < 0)
return -1; return -1;
#endif #endif
return pc; return pc;
#endif /* LINUX */ #endif /* LINUX */
@@ -1250,15 +1250,15 @@ struct tcb *tcp;
tprintf("[%08lx] ", eip); tprintf("[%08lx] ", eip);
#elif defined(S390) || defined(S390X) #elif defined(S390) || defined(S390X)
long psw; long psw;
if(upeek(tcp,PT_PSWADDR,&psw) < 0) { if(upeek(tcp,PT_PSWADDR,&psw) < 0) {
PRINTBADPC; PRINTBADPC;
return; return;
} }
#ifdef S390 #ifdef S390
tprintf("[%08lx] ", psw); tprintf("[%08lx] ", psw);
#elif S390X #elif S390X
tprintf("[%16lx] ", psw); tprintf("[%16lx] ", psw);
#endif #endif
#elif defined(X86_64) #elif defined(X86_64)
@@ -1325,13 +1325,13 @@ struct tcb *tcp;
} }
tprintf("[%08lx] ", pc); tprintf("[%08lx] ", pc);
#elif defined(SH) #elif defined(SH)
long pc; long pc;
if (upeek(tcp, 4*REG_PC, &pc) < 0) { if (upeek(tcp, 4*REG_PC, &pc) < 0) {
tprintf ("[????????] "); tprintf ("[????????] ");
return; return;
} }
tprintf("[%08lx] ", pc); tprintf("[%08lx] ", pc);
#elif defined(SH64) #elif defined(SH64)
long pc; long pc;
@@ -1877,8 +1877,8 @@ struct tcb *tcp;
return -1; return -1;
tcp->baddr &= ~0x03; tcp->baddr &= ~0x03;
#elif defined(SH) #elif defined(SH)
if (upeek(tcp, 4*REG_PC, &tcp->baddr) < 0) if (upeek(tcp, 4*REG_PC, &tcp->baddr) < 0)
return -1; return -1;
#else #else
#error unknown architecture #error unknown architecture
#endif #endif
@@ -1969,7 +1969,7 @@ struct tcb *tcp;
#elif defined(HPPA) #elif defined(HPPA)
long iaoq; long iaoq;
#elif defined(SH) #elif defined(SH)
long pc; long pc;
#endif /* architecture */ #endif /* architecture */
#if defined (SPARC) || defined (SPARC64) #if defined (SPARC) || defined (SPARC64)
@@ -2139,15 +2139,15 @@ struct tcb *tcp;
ptrace(PTRACE_POKEUSER, tcp->pid, (void *)PT_IAOQ0, iaoq); ptrace(PTRACE_POKEUSER, tcp->pid, (void *)PT_IAOQ0, iaoq);
ptrace(PTRACE_POKEUSER, tcp->pid, (void *)PT_IAOQ1, iaoq); ptrace(PTRACE_POKEUSER, tcp->pid, (void *)PT_IAOQ1, iaoq);
#elif defined(SH) #elif defined(SH)
if (upeek(tcp, 4*REG_PC, &pc) < 0) if (upeek(tcp, 4*REG_PC, &pc) < 0)
return -1; return -1;
if (pc != tcp->baddr) { if (pc != tcp->baddr) {
/* The breakpoint has not been reached yet. */ /* The breakpoint has not been reached yet. */
if (debug) if (debug)
fprintf(stderr, "NOTE: PC not at bpt (pc %#lx baddr %#lx)\n", fprintf(stderr, "NOTE: PC not at bpt (pc %#lx baddr %#lx)\n",
pc, tcp->baddr); pc, tcp->baddr);
return 0; return 0;
} }
#endif /* arch */ #endif /* arch */
#endif /* !SPARC && !SPARC64 && !IA64 */ #endif /* !SPARC && !SPARC64 && !IA64 */