]> granicus.if.org Git - strace/blobdiff - syscall.c
Fix the length argument passed from print_iovec to decode_netlink
[strace] / syscall.c
index 8cfc3852811bc74ec33bc2caa4c7770438c2de8a..3e91880c956fa1924689dec90b562fc61e2802bd 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -76,8 +76,6 @@
 #define TP TRACE_PROCESS
 #define TS TRACE_SIGNAL
 #define TM TRACE_MEMORY
-#define TSC TRACE_SCHED
-#define TCL TRACE_CLOCK
 #define TSF TRACE_STATFS
 #define NF SYSCALL_NEVER_FAILS
 #define MA MAX_ARGS
@@ -114,8 +112,6 @@ static const struct_sysent sysent2[] = {
 #undef TP
 #undef TS
 #undef TM
-#undef TSC
-#undef TCL
 #undef TSF
 #undef NF
 #undef MA
@@ -559,6 +555,7 @@ clear_regs(void)
        get_regs_error = -1;
 }
 
+static void get_regs(pid_t pid);
 static int get_syscall_args(struct tcb *);
 static int get_syscall_result(struct tcb *);
 static int arch_get_scno(struct tcb *tcp);
@@ -756,7 +753,7 @@ trace_syscall_exiting(struct tcb *tcp)
        struct timeval tv;
 
        /* Measure the exit time as early as possible to avoid errors. */
-       if (Tflag || cflag)
+       if ((Tflag || cflag) && !(filtered(tcp) || hide_log(tcp)))
                gettimeofday(&tv, NULL);
 
 #ifdef USE_LIBUNWIND
@@ -766,12 +763,14 @@ trace_syscall_exiting(struct tcb *tcp)
        }
 #endif
 
+       if (filtered(tcp) || hide_log(tcp))
+               goto ret;
+
+       get_regs(tcp->pid);
 #if SUPPORTED_PERSONALITIES > 1
        update_personality(tcp, tcp->currpers);
 #endif
        int res = (get_regs_error ? -1 : get_syscall_result(tcp));
-       if (filtered(tcp) || hide_log(tcp))
-               goto ret;
 
        if (syserror(tcp) && syscall_tampered(tcp))
                tamper_with_syscall_exiting(tcp);
@@ -1065,6 +1064,7 @@ print_pc(struct tcb *tcp)
 #else
 # error Neither ARCH_PC_REG nor ARCH_PC_PEEK_ADDR is defined
 #endif
+       get_regs(tcp->pid);
        if (get_regs_error || ARCH_GET_PC)
                tprints(current_wordsize == 4 ? "[????????] "
                                              : "[????????????????] ");
@@ -1150,7 +1150,7 @@ ptrace_setregs(pid_t pid)
 
 #endif /* ARCH_REGS_FOR_GETREGSET || ARCH_REGS_FOR_GETREGS */
 
-void
+static void
 get_regs(pid_t pid)
 {
 #undef USE_GET_SYSCALL_RESULT_REGS
@@ -1225,6 +1225,8 @@ free_sysent_buf(void *ptr)
 int
 get_scno(struct tcb *tcp)
 {
+       get_regs(tcp->pid);
+
        if (get_regs_error)
                return -1;