On Fri, Aug 14, 2009 at 12:56:12AM +0400, Dmitry V. Levin wrote: > Your patch introduces new variable (Cflag) which behaves similar to > already existing variable (cflag). More simple approach would be to reuse > the cflag variable.
If that means changing behaviour of -c and breaks compatibility, I am not sure that's better but here is the (indeed, simpler) patch for that. Let me know if that's more appropriate.
From c1ff03072478c4e9d907f7f4fd9f80240f380779 Mon Sep 17 00:00:00 2001 From: Adrien Kunysz <[email protected]> Date: Thu, 13 Aug 2009 23:52:12 +0200 Subject: [PATCH] Modify -c to make it print both regular output and statistics. --- strace.c | 10 ++++------ syscall.c | 10 ++-------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/strace.c b/strace.c index da8cc4a..fcb0cc6 100644 --- a/strace.c +++ b/strace.c @@ -2143,7 +2143,7 @@ trace() } break; case PR_SIGNALLED: - if (!cflag && (qual_flags[what] & QUAL_SIGNAL)) { + if (qual_flags[what] & QUAL_SIGNAL) { printleader(tcp); tprintf("--- %s (%s) ---", signame(what), strsignal(what)); @@ -2159,7 +2159,7 @@ trace() } break; case PR_FAULTED: - if (!cflag && (qual_flags[what] & QUAL_FAULT)) { + if (qual_flags[what] & QUAL_FAULT) { printleader(tcp); tprintf("=== FAULT %d ===", what); printtrailer(); @@ -2385,8 +2385,7 @@ Process %d attached (waiting for parent)\n", if (WIFSIGNALED(status)) { if (pid == strace_child) exit_code = 0x100 | WTERMSIG(status); - if (!cflag - && (qual_flags[WTERMSIG(status)] & QUAL_SIGNAL)) { + if (qual_flags[WTERMSIG(status)] & QUAL_SIGNAL) { printleader(tcp); tprintf("+++ killed by %s %s+++", signame(WTERMSIG(status)), @@ -2481,8 +2480,7 @@ Process %d attached (waiting for parent)\n", } continue; } - if (!cflag - && (qual_flags[WSTOPSIG(status)] & QUAL_SIGNAL)) { + if (qual_flags[WSTOPSIG(status)] & QUAL_SIGNAL) { unsigned long addr = 0; long pc = 0; #if defined(PT_CR_IPSR) && defined(PT_CR_IIP) && defined(PT_GETSIGINFO) diff --git a/syscall.c b/syscall.c index 26b1a9d..0e52d48 100644 --- a/syscall.c +++ b/syscall.c @@ -2390,7 +2390,7 @@ trace_syscall(struct tcb *tcp) } if (cflag) - return count_syscall(tcp, &tv); + res = count_syscall(tcp, &tv); if (res != 1) { tprintf(") "); @@ -2635,12 +2635,6 @@ trace_syscall(struct tcb *tcp) return 0; } - if (cflag) { - gettimeofday(&tcp->etime, NULL); - tcp->flags |= TCB_INSYSCALL; - return 0; - } - printleader(tcp); tcp->flags &= ~TCB_REPRINT; tcp_last = tcp; @@ -2657,7 +2651,7 @@ trace_syscall(struct tcb *tcp) return -1; tcp->flags |= TCB_INSYSCALL; /* Measure the entrance time as late as possible to avoid errors. */ - if (dtime) + if (dtime || cflag) gettimeofday(&tcp->etime, NULL); return sys_res; } -- 1.5.4.3
signature.asc
Description: Digital signature
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
