diff --git a/desc.c b/desc.c index 2b0cd534..50d4b510 100644 --- a/desc.c +++ b/desc.c @@ -658,7 +658,7 @@ struct tcb *tcp; { if (entering(tcp)) { 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]); if (tcp->u_arg[3] == 0) tprintf("NULL"); diff --git a/file.c b/file.c index ea6df327..899efb79 100644 --- a/file.c +++ b/file.c @@ -722,29 +722,29 @@ sprinttime(time_t t) #ifdef LINUXSPARC typedef struct { - int tv_sec; - int tv_nsec; + int tv_sec; + int tv_nsec; } timestruct_t; struct solstat { - unsigned st_dev; - int st_pad1[3]; /* network id */ - unsigned st_ino; - unsigned st_mode; - unsigned st_nlink; - unsigned st_uid; - unsigned st_gid; - unsigned st_rdev; - int st_pad2[2]; - int st_size; - int st_pad3; /* st_size, off_t expansion */ - timestruct_t st_atime; - timestruct_t st_mtime; - timestruct_t st_ctime; - int st_blksize; - int st_blocks; - char st_fstype[16]; - int st_pad4[8]; /* expansion area */ + unsigned st_dev; + int st_pad1[3]; /* network id */ + unsigned st_ino; + unsigned st_mode; + unsigned st_nlink; + unsigned st_uid; + unsigned st_gid; + unsigned st_rdev; + int st_pad2[2]; + int st_size; + int st_pad3; /* st_size, off_t expansion */ + timestruct_t st_atime; + timestruct_t st_mtime; + timestruct_t st_ctime; + int st_blksize; + int st_blocks; + char st_fstype[16]; + int st_pad4[8]; /* expansion area */ }; static void diff --git a/linux/hppa/syscallent.h b/linux/hppa/syscallent.h index f3a9978f..c8ff52ee 100644 --- a/linux/hppa/syscallent.h +++ b/linux/hppa/syscallent.h @@ -233,7 +233,7 @@ { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 225 */ { 4, TD, sys_epoll_wait, "epoll_wait" }, /* 226 */ { 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_unlink" }, /* 230 */ { 5, 0, printargs, "mq_timedsend" }, /* 231 */ diff --git a/linux/s390/syscallent.h b/linux/s390/syscallent.h index e565d4b8..b4d0d67d 100644 --- a/linux/s390/syscallent.h +++ b/linux/s390/syscallent.h @@ -245,7 +245,7 @@ { 1, 0, sys_setgid, "setgid" }, /* 214 */ { 1, 0, sys_setfsuid, "setfsuid" }, /* 215 */ { 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_madvise, "madvise" }, /* 219 */ { 3, TD, sys_getdents64, "getdents64" }, /* 220 */ diff --git a/linux/s390x/syscallent.h b/linux/s390x/syscallent.h index 91c08d7d..23e157a0 100644 --- a/linux/s390x/syscallent.h +++ b/linux/s390x/syscallent.h @@ -244,7 +244,7 @@ { 1, 0, sys_setgid, "setgid" }, /* 214 */ { 1, 0, sys_setfsuid, "setfsuid" }, /* 215 */ { 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_madvise, "madvise" }, /* 219 */ { 3, TD, sys_getdents64, "getdents64" }, /* 220 */ diff --git a/linux/sparc/syscallent.h b/linux/sparc/syscallent.h index 8af031a7..6324bf45 100644 --- a/linux/sparc/syscallent.h +++ b/linux/sparc/syscallent.h @@ -11,7 +11,7 @@ { 1, TF, sys_unlink, "unlink" }, /* 10 */ { 2, TF|TP, sys_execv, "execv" }, /* 11 */ { 1, TF, sys_chdir, "chdir" }, /* 12 */ - { 3, TF, sys_chown, "chown"}, /* 13 */ + { 3, TF, sys_chown, "chown"}, /* 13 */ { 3, TF, sys_mknod, "mknod" }, /* 14 */ { 2, TF, sys_chmod, "chmod" }, /* 15 */ { 3, TF, sys_chown, "lchown" }, /* 16 */ diff --git a/mem.c b/mem.c index 0fd4a2a3..b3c4edc4 100644 --- a/mem.c +++ b/mem.c @@ -229,48 +229,47 @@ long long offset; int sys_old_mmap(tcp) struct tcb *tcp; { - long u_arg[6]; + long u_arg[6]; #if defined(IA64) - int i, v; - /* - * IA64 processes never call this routine, they only use the - * new `sys_mmap' interface. This code converts the integer - * arguments that the IA32 process pushed onto the stack into - * longs. - * - * Note that addresses with bit 31 set will be sign extended. - * Fortunately, those addresses are not currently being generated - * for IA32 processes so it's not a problem. - */ - for (i = 0; i < 6; i++) - if (umove(tcp, tcp->u_arg[0] + (i * sizeof(int)), &v) == -1) - return 0; - else - u_arg[i] = v; + int i, v; + /* + * IA64 processes never call this routine, they only use the + * new `sys_mmap' interface. This code converts the integer + * arguments that the IA32 process pushed onto the stack into + * longs. + * + * Note that addresses with bit 31 set will be sign extended. + * Fortunately, those addresses are not currently being generated + * for IA32 processes so it's not a problem. + */ + for (i = 0; i < 6; i++) + if (umove(tcp, tcp->u_arg[0] + (i * sizeof(int)), &v) == -1) + return 0; + else + u_arg[i] = v; #elif defined(SH) || defined(SH64) - /* SH has always passed the args in registers */ - int i; - for (i=0; i<6; i++) - u_arg[i] = tcp->u_arg[i]; + /* SH has always passed the args in registers */ + int i; + for (i=0; i<6; i++) + u_arg[i] = tcp->u_arg[i]; #else # if defined(X86_64) - if (current_personality == 1) { - int i; - for (i = 0; i < 6; ++i) { - unsigned int val; - if (umove(tcp, tcp->u_arg[0] + i * 4, &val) == -1) - return 0; - u_arg[i] = val; - } - } - else + if (current_personality == 1) { + int i; + for (i = 0; i < 6; ++i) { + unsigned int val; + if (umove(tcp, tcp->u_arg[0] + i * 4, &val) == -1) + return 0; + u_arg[i] = val; + } + } + else # endif - if (umoven(tcp, tcp->u_arg[0], sizeof u_arg, (char *) u_arg) == -1) - return 0; + if (umoven(tcp, tcp->u_arg[0], sizeof u_arg, (char *) u_arg) == -1) + return 0; #endif // defined(IA64) - return print_mmap(tcp, u_arg, u_arg[5]); - + return print_mmap(tcp, u_arg, u_arg[5]); } #endif @@ -278,21 +277,21 @@ int sys_mmap(tcp) struct tcb *tcp; { - long long offset = tcp->u_arg[5]; + long long offset = tcp->u_arg[5]; #if defined(LINUX) && defined(SH64) - /* - * Old mmap differs from new mmap in specifying the - * offset in units of bytes rather than pages. We - * pretend it's in byte units so the user only ever - * sees bytes in the printout. - */ - offset <<= PAGE_SHIFT; + /* + * Old mmap differs from new mmap in specifying the + * offset in units of bytes rather than pages. We + * pretend it's in byte units so the user only ever + * sees bytes in the printout. + */ + offset <<= PAGE_SHIFT; #endif #if defined(LINUX_MIPSN32) - offset = tcp->ext_arg[5]; + offset = tcp->ext_arg[5]; #endif - return print_mmap(tcp, tcp->u_arg, offset); + return print_mmap(tcp, tcp->u_arg, offset); } #endif /* !HAVE_LONG_LONG_OFF_T */ diff --git a/process.c b/process.c index d0ca23bf..02c05959 100644 --- a/process.c +++ b/process.c @@ -725,7 +725,7 @@ int new; if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(sizeof(unsigned long)*PT_R0), new) < 0) return -1; - return 0; + return 0; #elif defined(S390) || defined(S390X) /* 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) @@ -775,26 +775,26 @@ int new; return -1; return 0; #elif defined(SH) - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*(REG_REG0+3)), new)<0) - return -1; - return 0; + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*(REG_REG0+3)), new)<0) + return -1; + return 0; #elif defined(SH64) - /* Top half of reg encodes the no. of args n as 0x1n. - Assume 0 args as kernel never actually checks... */ - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_SYSCALL), - 0x100000 | new) < 0) - return -1; - return 0; + /* Top half of reg encodes the no. of args n as 0x1n. + Assume 0 args as kernel never actually checks... */ + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_SYSCALL), + 0x100000 | new) < 0) + return -1; + return 0; #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 # define PTRACE_SET_SYSCALL 23 # endif - if (ptrace (PTRACE_SET_SYSCALL, tcp->pid, 0, new) != 0) + if (ptrace (PTRACE_SET_SYSCALL, tcp->pid, 0, new) != 0) return -1; - return 0; + return 0; #else #warning Do not know how to handle change_syscall for this architecture #endif /* architecture */ @@ -864,7 +864,7 @@ setarg(tcp, argnum) return -1; } #elif defined(S390) || defined(S390X) - { + { if(argnum <= 5) ptrace(PTRACE_POKEUSER, tcp->pid, (char *) (argnum==0 ? PT_ORIGGPR2 : @@ -874,7 +874,7 @@ setarg(tcp, argnum) return -E2BIG; if (errno) return -1; - } + } #else # warning Sorry, setargs not implemented for this architecture. #endif @@ -2747,57 +2747,57 @@ const struct xlat struct_user_offsets[] = { #endif /* M68K */ #endif /* !I386 */ #ifdef SH - { 4*REG_REG0, "4*REG_REG0" }, - { 4*(REG_REG0+1), "4*REG_REG1" }, - { 4*(REG_REG0+2), "4*REG_REG2" }, - { 4*(REG_REG0+3), "4*REG_REG3" }, - { 4*(REG_REG0+4), "4*REG_REG4" }, - { 4*(REG_REG0+5), "4*REG_REG5" }, - { 4*(REG_REG0+6), "4*REG_REG6" }, - { 4*(REG_REG0+7), "4*REG_REG7" }, - { 4*(REG_REG0+8), "4*REG_REG8" }, - { 4*(REG_REG0+9), "4*REG_REG9" }, - { 4*(REG_REG0+10), "4*REG_REG10" }, - { 4*(REG_REG0+11), "4*REG_REG11" }, - { 4*(REG_REG0+12), "4*REG_REG12" }, - { 4*(REG_REG0+13), "4*REG_REG13" }, - { 4*(REG_REG0+14), "4*REG_REG14" }, - { 4*REG_REG15, "4*REG_REG15" }, - { 4*REG_PC, "4*REG_PC" }, - { 4*REG_PR, "4*REG_PR" }, - { 4*REG_SR, "4*REG_SR" }, - { 4*REG_GBR, "4*REG_GBR" }, - { 4*REG_MACH, "4*REG_MACH" }, - { 4*REG_MACL, "4*REG_MACL" }, - { 4*REG_SYSCALL, "4*REG_SYSCALL" }, - { 4*REG_FPUL, "4*REG_FPUL" }, - { 4*REG_FPREG0, "4*REG_FPREG0" }, - { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, - { 4*(REG_FPREG0+2), "4*REG_FPREG2" }, - { 4*(REG_FPREG0+3), "4*REG_FPREG3" }, - { 4*(REG_FPREG0+4), "4*REG_FPREG4" }, - { 4*(REG_FPREG0+5), "4*REG_FPREG5" }, - { 4*(REG_FPREG0+6), "4*REG_FPREG6" }, - { 4*(REG_FPREG0+7), "4*REG_FPREG7" }, - { 4*(REG_FPREG0+8), "4*REG_FPREG8" }, - { 4*(REG_FPREG0+9), "4*REG_FPREG9" }, - { 4*(REG_FPREG0+10), "4*REG_FPREG10" }, - { 4*(REG_FPREG0+11), "4*REG_FPREG11" }, - { 4*(REG_FPREG0+12), "4*REG_FPREG12" }, - { 4*(REG_FPREG0+13), "4*REG_FPREG13" }, - { 4*(REG_FPREG0+14), "4*REG_FPREG14" }, - { 4*REG_FPREG15, "4*REG_FPREG15" }, + { 4*REG_REG0, "4*REG_REG0" }, + { 4*(REG_REG0+1), "4*REG_REG1" }, + { 4*(REG_REG0+2), "4*REG_REG2" }, + { 4*(REG_REG0+3), "4*REG_REG3" }, + { 4*(REG_REG0+4), "4*REG_REG4" }, + { 4*(REG_REG0+5), "4*REG_REG5" }, + { 4*(REG_REG0+6), "4*REG_REG6" }, + { 4*(REG_REG0+7), "4*REG_REG7" }, + { 4*(REG_REG0+8), "4*REG_REG8" }, + { 4*(REG_REG0+9), "4*REG_REG9" }, + { 4*(REG_REG0+10), "4*REG_REG10" }, + { 4*(REG_REG0+11), "4*REG_REG11" }, + { 4*(REG_REG0+12), "4*REG_REG12" }, + { 4*(REG_REG0+13), "4*REG_REG13" }, + { 4*(REG_REG0+14), "4*REG_REG14" }, + { 4*REG_REG15, "4*REG_REG15" }, + { 4*REG_PC, "4*REG_PC" }, + { 4*REG_PR, "4*REG_PR" }, + { 4*REG_SR, "4*REG_SR" }, + { 4*REG_GBR, "4*REG_GBR" }, + { 4*REG_MACH, "4*REG_MACH" }, + { 4*REG_MACL, "4*REG_MACL" }, + { 4*REG_SYSCALL, "4*REG_SYSCALL" }, + { 4*REG_FPUL, "4*REG_FPUL" }, + { 4*REG_FPREG0, "4*REG_FPREG0" }, + { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, + { 4*(REG_FPREG0+2), "4*REG_FPREG2" }, + { 4*(REG_FPREG0+3), "4*REG_FPREG3" }, + { 4*(REG_FPREG0+4), "4*REG_FPREG4" }, + { 4*(REG_FPREG0+5), "4*REG_FPREG5" }, + { 4*(REG_FPREG0+6), "4*REG_FPREG6" }, + { 4*(REG_FPREG0+7), "4*REG_FPREG7" }, + { 4*(REG_FPREG0+8), "4*REG_FPREG8" }, + { 4*(REG_FPREG0+9), "4*REG_FPREG9" }, + { 4*(REG_FPREG0+10), "4*REG_FPREG10" }, + { 4*(REG_FPREG0+11), "4*REG_FPREG11" }, + { 4*(REG_FPREG0+12), "4*REG_FPREG12" }, + { 4*(REG_FPREG0+13), "4*REG_FPREG13" }, + { 4*(REG_FPREG0+14), "4*REG_FPREG14" }, + { 4*REG_FPREG15, "4*REG_FPREG15" }, #ifdef REG_XDREG0 - { 4*REG_XDREG0, "4*REG_XDREG0" }, - { 4*(REG_XDREG0+2), "4*REG_XDREG2" }, - { 4*(REG_XDREG0+4), "4*REG_XDREG4" }, - { 4*(REG_XDREG0+6), "4*REG_XDREG6" }, - { 4*(REG_XDREG0+8), "4*REG_XDREG8" }, - { 4*(REG_XDREG0+10), "4*REG_XDREG10" }, - { 4*(REG_XDREG0+12), "4*REG_XDREG12" }, - { 4*REG_XDREG14, "4*REG_XDREG14" }, + { 4*REG_XDREG0, "4*REG_XDREG0" }, + { 4*(REG_XDREG0+2), "4*REG_XDREG2" }, + { 4*(REG_XDREG0+4), "4*REG_XDREG4" }, + { 4*(REG_XDREG0+6), "4*REG_XDREG6" }, + { 4*(REG_XDREG0+8), "4*REG_XDREG8" }, + { 4*(REG_XDREG0+10), "4*REG_XDREG10" }, + { 4*(REG_XDREG0+12), "4*REG_XDREG12" }, + { 4*REG_XDREG14, "4*REG_XDREG14" }, #endif - { 4*REG_FPSCR, "4*REG_FPSCR" }, + { 4*REG_FPSCR, "4*REG_FPSCR" }, #endif /* SH */ #ifdef SH64 { 0, "PC(L)" }, @@ -2948,8 +2948,8 @@ const struct xlat struct_user_offsets[] = { { 580, "TR6(U)" }, { 584, "TR7(L)" }, { 588, "TR7(U)" }, - /* This entry is in case pt_regs contains dregs (depends on - the kernel build options). */ + /* This entry is in case pt_regs contains dregs (depends on + the kernel build options). */ { uoff(regs), "offsetof(struct user, regs)" }, { uoff(fpu), "offsetof(struct user, fpu)" }, #endif diff --git a/sock.c b/sock.c index 5e2ab57d..5303fa91 100644 --- a/sock.c +++ b/sock.c @@ -192,7 +192,7 @@ sock_ioctl(struct tcb *tcp, long code, long arg) tprintf("%s={", str); printxval(addrfams, ifr.ifr_addr.sa_family, - "AF_???"); + "AF_???"); tprintf(", "); print_addr(tcp, ((long) tcp->u_arg[2] + offsetof (struct ifreq, @@ -252,7 +252,7 @@ sock_ioctl(struct tcb *tcp, long code, long arg) return 1; } tprintf("%d, ", ifc.ifc_len); - if (syserror(tcp)) { + if (syserror(tcp)) { tprintf("%lx", (unsigned long) ifc.ifc_buf); } else if (ifc.ifc_buf == NULL) { tprintf("NULL"); diff --git a/stream.c b/stream.c index 8c7dfda3..36e8ed5f 100644 --- a/stream.c +++ b/stream.c @@ -55,9 +55,9 @@ #ifndef HAVE_STROPTS_H #define RS_HIPRI 1 struct strbuf { - int maxlen; /* no. of bytes in buffer */ - int len; /* no. of bytes returned */ - char *buf; /* pointer to data */ + int maxlen; /* no. of bytes in buffer */ + int len; /* no. of bytes returned */ + char *buf; /* pointer to data */ }; #define MORECTL 1 #define MOREDATA 2 @@ -350,7 +350,7 @@ decode_poll(struct tcb *tcp, long pts) } else { static char outstr[1024]; char str[64]; - const char *flagstr; + const char *flagstr; unsigned int cumlen; if (syserror(tcp)) diff --git a/syscall.c b/syscall.c index eb974692..19f8fe9f 100644 --- a/syscall.c +++ b/syscall.c @@ -545,17 +545,16 @@ struct tcb *tcp; dumpstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); break; #ifdef SYS_readv - case SYS_readv: - if (qual_flags[tcp->u_arg[0]] & QUAL_READ) - dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); - break; + case SYS_readv: + if (qual_flags[tcp->u_arg[0]] & QUAL_READ) + dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); + break; #endif #ifdef SYS_writev - case SYS_writev: - - if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE) - dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); - break; + case SYS_writev: + if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE) + dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); + break; #endif } } @@ -769,11 +768,11 @@ internal_syscall(struct tcb *tcp) #elif defined(HPPA) static long r28; #elif defined(SH) - static long r0; + static long r0; #elif defined(SH64) - static long r9; + static long r9; #elif defined(X86_64) - static long rax; + static long rax; #endif #endif /* LINUX */ #ifdef FREEBSD @@ -1169,7 +1168,7 @@ struct tcb *tcp; if (ptrace(PTRACE_GETREGS,pid,(char *)®s,0) < 0) 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)) { /* Retrieve the syscall trap instruction. */ errno = 0; @@ -1241,38 +1240,37 @@ struct tcb *tcp; } } #elif defined(SH) - /* - * In the new syscall ABI, the system call number is in R3. - */ - if (upeek(tcp, 4*(REG_REG0+3), &scno) < 0) - return -1; + /* + * In the new syscall ABI, the system call number is in R3. + */ + if (upeek(tcp, 4*(REG_REG0+3), &scno) < 0) + return -1; - if (scno < 0) { - /* Odd as it may seem, a glibc bug has been known to cause - glibc to issue bogus negative syscall numbers. So for - our purposes, make strace print what it *should* have been */ - long correct_scno = (scno & 0xff); - if (debug) - fprintf(stderr, - "Detected glibc bug: bogus system call number = %ld, " - "correcting to %ld\n", - scno, - correct_scno); - scno = correct_scno; - } + if (scno < 0) { + /* Odd as it may seem, a glibc bug has been known to cause + glibc to issue bogus negative syscall numbers. So for + our purposes, make strace print what it *should* have been */ + long correct_scno = (scno & 0xff); + if (debug) + fprintf(stderr, + "Detected glibc bug: bogus system call" + " number = %ld, correcting to %ld\n", + scno, + correct_scno); + scno = correct_scno; + } - - if (!(tcp->flags & TCB_INSYSCALL)) { - /* Check if we return from execve. */ - if (scno == 0 && tcp->flags & TCB_WAITEXECVE) { - tcp->flags &= ~TCB_WAITEXECVE; - return 0; - } - } + if (!(tcp->flags & TCB_INSYSCALL)) { + /* Check if we return from execve. */ + if (scno == 0 && tcp->flags & TCB_WAITEXECVE) { + tcp->flags &= ~TCB_WAITEXECVE; + return 0; + } + } #elif defined(SH64) if (upeek(tcp, REG_SYSCALL, &scno) < 0) return -1; - scno &= 0xFFFF; + scno &= 0xFFFF; if (!(tcp->flags & TCB_INSYSCALL)) { /* Check if we return from execve. */ @@ -1287,13 +1285,13 @@ struct tcb *tcp; if (upeek(tcp, uoff(u_arg[7]), &scno) < 0) return -1; #elif defined(SH) - /* new syscall ABI returns result in R0 */ - if (upeek(tcp, 4*REG_REG0, (long *)&r0) < 0) - return -1; + /* new syscall ABI returns result in R0 */ + if (upeek(tcp, 4*REG_REG0, (long *)&r0) < 0) + return -1; #elif defined(SH64) - /* ABI defines result returned in r9 */ - if (upeek(tcp, REG_GENERAL(9), (long *)&r9) < 0) - return -1; + /* ABI defines result returned in r9 */ + if (upeek(tcp, REG_GENERAL(9), (long *)&r9) < 0) + return -1; #endif #ifdef USE_PROCFS @@ -1304,17 +1302,17 @@ struct tcb *tcp; scno = tcp->status.PR_WHAT; #else /* FREEBSD */ if (pread(tcp->pfd_reg, ®s, sizeof(regs), 0) < 0) { - perror("pread"); - return -1; - } + perror("pread"); + return -1; + } switch (regs.r_eax) { case SYS_syscall: case SYS___syscall: - pread(tcp->pfd, &scno, sizeof(scno), regs.r_esp + sizeof(int)); - break; + pread(tcp->pfd, &scno, sizeof(scno), regs.r_esp + sizeof(int)); + break; default: - scno = regs.r_eax; - break; + scno = regs.r_eax; + break; } #endif /* FREEBSD */ #endif /* !HAVE_PR_SYSCALL */ @@ -1658,15 +1656,15 @@ struct tcb *tcp; } #else #ifdef SH64 - /* interpret result as return value or error number */ - if (is_negated_errno(r9)) { - tcp->u_rval = -1; - u_error = -r9; - } - else { - tcp->u_rval = r9; - u_error = 0; - } + /* interpret result as return value or error number */ + if (is_negated_errno(r9)) { + tcp->u_rval = -1; + u_error = -r9; + } + else { + tcp->u_rval = r9; + u_error = 0; + } #endif /* SH64 */ #endif /* SH */ #endif /* HPPA */ @@ -1840,8 +1838,8 @@ force_result(tcp, error, rval) return -1; #else /* !M68K */ #ifdef ARM - regs.ARM_r0 = error ? -error : rval; - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*0), regs.ARM_r0) < 0) + regs.ARM_r0 = error ? -error : rval; + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*0), regs.ARM_r0) < 0) return -1; #else /* !ARM */ #ifdef ALPHA @@ -1896,7 +1894,7 @@ force_result(tcp, error, rval) return -1; #else #ifdef SH64 - r9 = error ? -error : rval; + r9 = error ? -error : rval; if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)REG_GENERAL(9), r9) < 0) return -1; #endif /* SH64 */ @@ -1927,9 +1925,9 @@ force_result(tcp, error, rval) #endif /* SVR4 */ #ifdef FREEBSD if (pread(tcp->pfd_reg, ®s, sizeof(regs), 0) < 0) { - perror("pread"); - return -1; - } + perror("pread"); + return -1; + } if (error) { regs.r_eflags |= PSL_C; regs.r_eax = error; @@ -1939,9 +1937,9 @@ force_result(tcp, error, rval) regs.r_eax = rval; } if (pwrite(tcp->pfd_reg, ®s, sizeof(regs), 0) < 0) { - perror("pwrite"); - return -1; - } + perror("pwrite"); + return -1; + } #endif /* FREEBSD */ /* All branches reach here on success (only). */ @@ -2153,23 +2151,23 @@ struct tcb *tcp; return -1; } #elif defined(SH) - { - int i; - static int syscall_regs[] = { - REG_REG0+4, REG_REG0+5, REG_REG0+6, REG_REG0+7, - REG_REG0, REG_REG0+1, REG_REG0+2 - }; + { + int i; + static int syscall_regs[] = { + REG_REG0+4, REG_REG0+5, REG_REG0+6, REG_REG0+7, + REG_REG0, REG_REG0+1, REG_REG0+2 + }; - tcp->u_nargs = sysent[tcp->scno].nargs; - for (i = 0; i < tcp->u_nargs; i++) { - if (upeek(tcp, 4*syscall_regs[i], &tcp->u_arg[i]) < 0) - return -1; - } - } + tcp->u_nargs = sysent[tcp->scno].nargs; + for (i = 0; i < tcp->u_nargs; i++) { + if (upeek(tcp, 4*syscall_regs[i], &tcp->u_arg[i]) < 0) + return -1; + } + } #elif defined(SH64) { 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 }; /* @@ -2300,15 +2298,15 @@ struct tcb *tcp; case SYS___syscall: pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long), regs.r_esp + sizeof(int) + sizeof(quad_t)); - break; - case SYS_syscall: + break; + case SYS_syscall: pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long), regs.r_esp + 2 * sizeof(int)); - break; - default: + break; + default: pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long), regs.r_esp + sizeof(int)); - break; + break; } #endif /* FREEBSD */ return 1; diff --git a/util.c b/util.c index 8f97811b..ac925513 100644 --- a/util.c +++ b/util.c @@ -127,7 +127,7 @@ __asm__ volatile ("or %%g0, %1, %%o0\n\t" \ "i" (__NR_##syscall) \ : "g1", "o0", "o1", "o2", "o3", "o4"); \ if (__res>=0) \ - return (type) __res; \ + return (type) __res; \ errno = -__res; \ return -1; \ } @@ -706,13 +706,13 @@ long addr; } if (umoven(tcp, addr, size, (char *) iov) >= 0) { for (i = 0; i < len; i++) { - /* include the buffer number to make it easy to - * match up the trace with the source */ - tprintf(" * %lu bytes in buffer %d\n", - (unsigned long)iov_iov_len(i), i); - dumpstr(tcp, (long) iov_iov_base(i), - iov_iov_len(i)); - } + /* include the buffer number to make it easy to + * match up the trace with the source */ + tprintf(" * %lu bytes in buffer %d\n", + (unsigned long)iov_iov_len(i), i); + dumpstr(tcp, (long) iov_iov_base(i), + iov_iov_len(i)); + } } free((char *) iov); #undef sizeof_iov @@ -1195,11 +1195,11 @@ struct tcb *tcp; if(upeek(tcp,PT_IAOQ0,&pc) < 0) return -1; #elif defined(SH) - if (upeek(tcp, 4*REG_PC ,&pc) < 0) - return -1; + if (upeek(tcp, 4*REG_PC ,&pc) < 0) + return -1; #elif defined(SH64) - if (upeek(tcp, REG_PC ,&pc) < 0) - return -1; + if (upeek(tcp, REG_PC ,&pc) < 0) + return -1; #endif return pc; #endif /* LINUX */ @@ -1250,15 +1250,15 @@ struct tcb *tcp; tprintf("[%08lx] ", eip); #elif defined(S390) || defined(S390X) - long psw; - if(upeek(tcp,PT_PSWADDR,&psw) < 0) { - PRINTBADPC; - return; - } + long psw; + if(upeek(tcp,PT_PSWADDR,&psw) < 0) { + PRINTBADPC; + return; + } #ifdef S390 - tprintf("[%08lx] ", psw); + tprintf("[%08lx] ", psw); #elif S390X - tprintf("[%16lx] ", psw); + tprintf("[%16lx] ", psw); #endif #elif defined(X86_64) @@ -1325,13 +1325,13 @@ struct tcb *tcp; } tprintf("[%08lx] ", pc); #elif defined(SH) - long pc; + long pc; - if (upeek(tcp, 4*REG_PC, &pc) < 0) { - tprintf ("[????????] "); - return; - } - tprintf("[%08lx] ", pc); + if (upeek(tcp, 4*REG_PC, &pc) < 0) { + tprintf ("[????????] "); + return; + } + tprintf("[%08lx] ", pc); #elif defined(SH64) long pc; @@ -1877,8 +1877,8 @@ struct tcb *tcp; return -1; tcp->baddr &= ~0x03; #elif defined(SH) - if (upeek(tcp, 4*REG_PC, &tcp->baddr) < 0) - return -1; + if (upeek(tcp, 4*REG_PC, &tcp->baddr) < 0) + return -1; #else #error unknown architecture #endif @@ -1969,7 +1969,7 @@ struct tcb *tcp; #elif defined(HPPA) long iaoq; #elif defined(SH) - long pc; + long pc; #endif /* architecture */ #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_IAOQ1, iaoq); #elif defined(SH) - if (upeek(tcp, 4*REG_PC, &pc) < 0) - return -1; - if (pc != tcp->baddr) { - /* The breakpoint has not been reached yet. */ - if (debug) - fprintf(stderr, "NOTE: PC not at bpt (pc %#lx baddr %#lx)\n", - pc, tcp->baddr); - return 0; - } + if (upeek(tcp, 4*REG_PC, &pc) < 0) + return -1; + if (pc != tcp->baddr) { + /* The breakpoint has not been reached yet. */ + if (debug) + fprintf(stderr, "NOTE: PC not at bpt (pc %#lx baddr %#lx)\n", + pc, tcp->baddr); + return 0; + } #endif /* arch */ #endif /* !SPARC && !SPARC64 && !IA64 */