]> granicus.if.org Git - strace/blobdiff - syscall.c
mips n32: fix preadv/pwritev offset decoding
[strace] / syscall.c
index 70ba8a0942a29cf3898d0d5c16b8996049907fc2..228536b479a7f51ac8dd4cb98fd69939c73e8f5a 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -37,6 +37,7 @@
 /* for struct iovec */
 #include <sys/uio.h>
 
+#include "regs.h"
 #include "ptrace.h"
 
 #if defined(SPARC64)
@@ -46,8 +47,6 @@
 # define PTRACE_SETREGS PTRACE_SETREGS64
 #endif
 
-#include "regs.h"
-
 #if defined SPARC64
 # include <asm/psrcompat.h>
 #elif defined SPARC
@@ -882,6 +881,11 @@ print_pc(struct tcb *tcp)
                return;
        }
        tprintf(fmt, pc);
+#elif defined(AARCH64)
+       if (aarch64_io.iov_len == sizeof(arm_regs))
+               tprintf(fmt, (unsigned long) arm_regs.ARM_pc);
+       else
+               tprintf(fmt, (unsigned long) aarch64_regs.pc);
 #elif defined(ARM)
        tprintf(fmt, arm_regs.ARM_pc);
 #elif defined(AVR32)
@@ -1403,7 +1407,7 @@ get_scno(struct tcb *tcp)
        scno = mips_REG_V0;
 
        if (!SCNO_IN_RANGE(scno)) {
-               if (mips_REG_A3 == 0 || mips_REG_A3 == -1) {
+               if (mips_REG_A3 == 0 || mips_REG_A3 == (uint64_t) -1) {
                        if (debug_flag)
                                fprintf(stderr, "stray syscall exit: v0 = %ld\n", scno);
                        return 0;
@@ -2451,7 +2455,13 @@ trace_syscall_exiting(struct tcb *tcp)
                else {
                        switch (sys_res & RVAL_MASK) {
                        case RVAL_HEX:
-                               tprintf("= %#lx", tcp->u_rval);
+#if SUPPORTED_PERSONALITIES > 1
+                               if (current_wordsize < sizeof(long))
+                                       tprintf("= %#x",
+                                               (unsigned int) tcp->u_rval);
+                               else
+#endif
+                                       tprintf("= %#lx", tcp->u_rval);
                                break;
                        case RVAL_OCTAL:
                                tprintf("= %#lo", tcp->u_rval);