Strace: Difference between revisions

m Text replacement - "<abbr title="[^"]+">(.*)<\/abbr>" to "$1"
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight"
 
Line 2: Line 2:


Say you have some python application such as [[Reposurgeon]] that you need to understand better.  You can attach <code>strace</code> to the <code>pid</code> of the running application to see the underlying system calls being made.
Say you have some python application such as [[Reposurgeon]] that you need to understand better.  You can attach <code>strace</code> to the <code>pid</code> of the running application to see the underlying system calls being made.
<source lang="bash">
<syntaxhighlight lang="bash">
sudo strace -f -s128 -e trace=open -p$(ps -o lwp= -LC python2 | tail -1)
sudo strace -f -s128 -e trace=open -p$(ps -o lwp= -LC python2 | tail -1)
# -f follow child processes
# -f follow child processes
# -s string width
# -s string width
# -e set which calls you want to see.  Using trace=open is like sudo lsof -ad3-999 -c python2
# -e set which calls you want to see.  Using trace=open is like sudo lsof -ad3-999 -c python2
</source>
</syntaxhighlight>