Difference between revisions of "Strace"
Jump to navigation
Jump to search
m (Text replacement - "<abbr title="[^"]+">(.*)<\/abbr>" to "$1") |
(Created page with "System Trace is a tool for hackers. Say you have some python application such as Reposurgeon that you need to understand better. You can attach <code>strace</code> to th...") |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
System Trace is a tool for hackers. | System Trace is a tool for hackers. | ||
− | 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><abbrev title="process id">pid</abbrev></code> of the running application to see the underlying system calls being made. |
<source lang="bash"> | <source lang="bash"> | ||
− | sudo strace -f -s128 | + | sudo strace -f -s128 -p$(ps -o lwp= -LC python2 | tail -1) |
# -f follow child processes | # -f follow child processes | ||
# -s string width | # -s string width | ||
− | + | ||
</source> | </source> | ||
Line 56: | Line 56: | ||
munmap(0x7f885c126000, 412069888) = 0 | munmap(0x7f885c126000, 412069888) = 0 | ||
</pre> | </pre> | ||
− | |||
− | |||
− |
Revision as of 18:55, 17 December 2015
System Trace is a tool for hackers.
Say you have some python application such as Reposurgeon that you need to understand better. You can attach strace
to the <abbrev title="process id">pid</abbrev>
of the running application to see the underlying system calls being made.
sudo strace -f -s128 -p$(ps -o lwp= -LC python2 | tail -1)
# -f follow child processes
# -s string width
write(1, "reposurgeon: r10952 copynode filemap is <PathMap: branches/784.919Merge/diag/Makefile branches/784.919Merge/diag/changelog branc"..., 1024) = 1024 write(1, "/cmts.cmd.h branches/784.919Merge/diag/cli/commands/cmts_dsg.cmd.h branches/784.919Merge/diag/cli/commands/copy.cmd branches/784"..., 412067840) = 412067840 write(1, "c/zebos/rip/rip_distance.c trunk/linux/src/zebos/rip/rip_distance.h trunk/linux/src/zebos/rip/rip_host.h trunk/linux/src/zebos/r"..., 888) = 888 munmap(0x7f888d31c000, 412069888) = 0 munmap(0x7f885c126000, 412069888) = 0 mmap(NULL, 412069888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f888d31d000 mmap(NULL, 412069888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8874a22000 munmap(0x7f888d31d000, 412069888) = 0 mmap(NULL, 412073984, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f885c126000 munmap(0x7f8874a22000, 412069888) = 0 mremap(0x7f885c126000, 412073984, 412069888, MREMAP_MAYMOVE) = 0x7f885c126000 mmap(NULL, 412073984, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f888d31c000 mremap(0x7f888d31c000, 412073984, 412069888, MREMAP_MAYMOVE) = 0x7f888d31c000 write(1, "reposurgeon: r10952 copynode filemap is <PathMap: branches/784.919Merge/diag/Makefile branches/784.919Merge/diag/changelog branc"..., 1024) = 1024 write(1, "/cmts.cmd.h branches/784.919Merge/diag/cli/commands/cmts_dsg.cmd.h branches/784.919Merge/diag/cli/commands/copy.cmd branches/784"..., 412067840) = 412067840 write(1, "c/zebos/rip/rip_distance.c trunk/linux/src/zebos/rip/rip_distance.h trunk/linux/src/zebos/rip/rip_host.h trunk/linux/src/zebos/r"..., 888) = 888 munmap(0x7f888d31c000, 412069888) = 0 munmap(0x7f885c126000, 412069888) = 0 mmap(NULL, 412069888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f888d31d000 mmap(NULL, 412069888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8874a22000 munmap(0x7f888d31d000, 412069888) = 0 mmap(NULL, 412073984, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f885c126000 munmap(0x7f8874a22000, 412069888) = 0 mremap(0x7f885c126000, 412073984, 412069888, MREMAP_MAYMOVE) = 0x7f885c126000 mmap(NULL, 412073984, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f888d31c000 mremap(0x7f888d31c000, 412073984, 412069888, MREMAP_MAYMOVE) = 0x7f888d31c000 write(1, "reposurgeon: r10952 copynode filemap is <PathMap: branches/784.919Merge/diag/Makefile branches/784.919Merge/diag/changelog branc"..., 1024) = 1024 write(1, "/cmts.cmd.h branches/784.919Merge/diag/cli/commands/cmts_dsg.cmd.h branches/784.919Merge/diag/cli/commands/copy.cmd branches/784"..., 412067840) = 412067840 write(1, "c/zebos/rip/rip_distance.c trunk/linux/src/zebos/rip/rip_distance.h trunk/linux/src/zebos/rip/rip_host.h trunk/linux/src/zebos/r"..., 888) = 888 munmap(0x7f888d31c000, 412069888) = 0 munmap(0x7f885c126000, 412069888) = 0 mmap(NULL, 412069888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f888d31d000 mmap(NULL, 412069888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8874a22000 munmap(0x7f888d31d000, 412069888) = 0 mmap(NULL, 412073984, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f885c126000 munmap(0x7f8874a22000, 412069888) = 0 mremap(0x7f885c126000, 412073984, 412069888, MREMAP_MAYMOVE) = 0x7f885c126000 mmap(NULL, 412073984, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f888d31c000 mremap(0x7f888d31c000, 412073984, 412069888, MREMAP_MAYMOVE) = 0x7f888d31c000 write(1, "reposurgeon: r10952 copynode filemap is <PathMap: branches/784.919Merge/diag/Makefile branches/784.919Merge/diag/changelog branc"..., 1024) = 1024 write(1, "/cmts.cmd.h branches/784.919Merge/diag/cli/commands/cmts_dsg.cmd.h branches/784.919Merge/diag/cli/commands/copy.cmd branches/784"..., 412067840) = 412067840 write(1, "c/zebos/rip/rip_distance.c trunk/linux/src/zebos/rip/rip_distance.h trunk/linux/src/zebos/rip/rip_host.h trunk/linux/src/zebos/r"..., 888) = 888 munmap(0x7f888d31c000, 412069888) = 0 munmap(0x7f885c126000, 412069888) = 0