Using "-c" and CTRL+C
enh
enh at google.com
Mon May 12 18:40:27 UTC 2014
running the x86-64 Android strace on my desktop worked fine too. switching
back to arm, it looks like the problem is something to do with adb rather
than strace:
$ adb shell strace -c sleep 100
^C
$ adb shell
root at mako:/ # strace -c sleep 100
^CProcess 2294 detached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.000153 5 34 mmap2
0.00 0.000000 0 7 read
0.00 0.000000 0 8 close
0.00 0.000000 0 1 execve
0.00 0.000000 0 1 brk
0.00 0.000000 0 8 sigaction
0.00 0.000000 0 1 gettimeofday
0.00 0.000000 0 7 munmap
0.00 0.000000 0 18 mprotect
0.00 0.000000 0 1 prctl
0.00 0.000000 0 1 sigaltstack
0.00 0.000000 0 1 getrlimit
0.00 0.000000 0 1 fstat64
0.00 0.000000 0 2 2 madvise
0.00 0.000000 0 1 fcntl64
0.00 0.000000 0 1 futex
0.00 0.000000 0 1 set_tid_address
0.00 0.000000 0 1 statfs64
0.00 0.000000 0 15 7 openat
0.00 0.000000 0 1 set_tls
------ ----------- ----------- --------- --------- ----------------
100.00 0.000153 111 9 total
root at mako:/ #
so whatever i was seeing doesn't look like an strace problem.
looks like adb just doesn't catch SIGINT to pass it on:
$ strace -f adb shell sleep 100
...
write(3, "shell:sleep 100", 15) = 15
read(3, "OKAY", 4) = 4
read(3, ^C <unfinished ...>
On Thu, May 8, 2014 at 2:11 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> Hi,
>
> On Wed, May 07, 2014 at 04:54:40PM +0200, Bud Millwood wrote:
> > Hi all, I'm not on this list but I'll keep an eye out for a response
> > to this message.
> >
> > In the past I noticed that if I ran "strace -c" against a process, I
> > could press CTRL-C and strace would print out the statistics it had
> > collected so far, then exit. It now seems to just exit without
> > printing any of the statistics.
>
> Strange, it works for me, both in simple and in -p mode.
> For example:
>
> $ strace -c cat & sleep 1 && kill -INT $!
> [1] 19981
> Process 19985 detached
> % time seconds usecs/call calls errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> $ 27.65 0.000060 8 8 mmap
> 14.29 0.000031 8 4 mprotect
> 10.14 0.000022 6 4 fstat
> 7.83 0.000017 9 2 open
> 7.83 0.000017 4 4 brk
> 6.45 0.000014 7 2 1 read
> 5.53 0.000012 12 1 1 access
> 5.07 0.000011 6 2 fadvise64
> 4.61 0.000010 5 2 close
> 4.61 0.000010 10 1 munmap
> 3.69 0.000008 8 1 execve
> 2.30 0.000005 5 1 arch_prctl
> ------ ----------- ----------- --------- --------- ----------------
> 100.00 0.000217 32 2 total
> [1]+ Done strace -c cat
>
> $ sleep 2 && sleep 2 & sleep 1; strace -cp $! & sleep 2 && kill -INT $!
> [1] 19986
> [2] 19989
> Process 19986 attached
> Process 19986 detached
> % time seconds usecs/call calls errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> $ 80.77 0.000710 355 2 1 wait4
> 15.81 0.000139 139 1 clone
> 2.62 0.000023 4 6 rt_sigprocmask
> 0.46 0.000004 2 2 rt_sigaction
> 0.34 0.000003 3 1 rt_sigreturn
> ------ ----------- ----------- --------- --------- ----------------
> 100.00 0.000879 12 1 total
> [2]+ Done strace -cp $!
> [1]- Done sleep 2 && sleep 2
>
> You aren't using -I1 option, are you?
>
>
> --
> ldv
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20140512/ff4a36bd/attachment.html>
More information about the Strace-devel
mailing list