差分
このページの2つのバージョン間の差分を表示します。
| 次のリビジョン | 前のリビジョン | ||
| hardware:gl-ar750s-ext:strace [2020/03/16 10:24] – 作成 ともやん | hardware:gl-ar750s-ext:strace [2020/09/11 19:08] (現在) – [実行] ともやん | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | < | ||
| - | < | ||
| - | #result pre { | ||
| - | overflow: scroll; | ||
| - | overflow-x: hidden; | ||
| - | font-size: 10px; | ||
| - | } | ||
| - | # | ||
| - | height: 300px; | ||
| - | overflow: scroll; | ||
| - | overflow-x: hidden; | ||
| - | font-size: 10px; | ||
| - | } | ||
| - | </ | ||
| - | </ | ||
| ====== strace コマンド ====== | ====== strace コマンド ====== | ||
| 行 46: | 行 31: | ||
| </ | </ | ||
| + | ===== 動作確認 ===== | ||
| + | < | ||
| + | # strace -h | ||
| + | </ | ||
| + | <WRAP prewrap 100% # | ||
| + | < | ||
| + | usage: strace [-CdffhiqrtttTvVwxxy] [-I n] [-e expr]... | ||
| + | [-a column] [-o file] [-s strsize] [-P path]... | ||
| + | -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS] | ||
| + | or: strace -c[dfw] [-I n] [-e expr]... [-O overhead] [-S sortby] | ||
| + | -p pid... / [-D] [-E var=val]... [-u username] PROG [ARGS] | ||
| + | |||
| + | Output format: | ||
| + | -a column | ||
| + | -i print instruction pointer at time of syscall | ||
| + | -o file send trace output to FILE instead of stderr | ||
| + | -q | ||
| + | -r print relative timestamp | ||
| + | -s strsize | ||
| + | -t print absolute timestamp | ||
| + | -tt print absolute timestamp with usecs | ||
| + | -T print time spent in each syscall | ||
| + | -x print non-ascii strings in hex | ||
| + | -xx print all strings in hex | ||
| + | -y print paths associated with file descriptor arguments | ||
| + | -yy print protocol specific information associated with socket file descriptors | ||
| + | |||
| + | Statistics: | ||
| + | -c count time, calls, and errors for each syscall and report summary | ||
| + | -C like -c but also print regular output | ||
| + | -O overhead | ||
| + | -S sortby | ||
| + | -w | ||
| + | |||
| + | Filtering: | ||
| + | -e expr a qualifying expression: option=[!]all or option=[!]val1[, | ||
| + | | ||
| + | -P path trace accesses to path | ||
| + | |||
| + | Tracing: | ||
| + | -b execve | ||
| + | -D run tracer process as a detached grandchild, not as parent | ||
| + | -f | ||
| + | -ff follow forks with output into separate files | ||
| + | -I interruptible | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | Startup: | ||
| + | -E var | ||
| + | -E var=val | ||
| + | -p pid trace process with process id PID, may be repeated | ||
| + | -u username | ||
| + | |||
| + | Miscellaneous: | ||
| + | -d | ||
| + | -v | ||
| + | -h print help message | ||
| + | -V print version | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== 実行 ===== | ||
| + | strace [プロセス(コマンド等)]\\ | ||
| + | \\ | ||
| + | 実行例: | ||
| + | < | ||
| + | # strace ls | ||
| + | </ | ||
| + | <WRAP prewrap 100% #result> | ||
| + | < | ||
| + | execve("/ | ||
| + | set_thread_area(0x77cc1da0) | ||
| + | set_tid_address(0x77cbad08) | ||
| + | open("/ | ||
| + | open("/ | ||
| + | fcntl64(3, F_SETFD, FD_CLOEXEC) | ||
| + | fstat64(3, {st_mode=S_IFREG|0644, | ||
| + | read(3, " | ||
| + | mmap2(NULL, 155648, PROT_READ|PROT_EXEC, | ||
| + | mmap2(0x77c07000, | ||
| + | close(3) | ||
| + | mprotect(0x45f000, | ||
| + | prctl(PR_SET_NAME, | ||
| + | getuid() | ||
| + | clock_gettime(CLOCK_REALTIME, | ||
| + | ioctl(0, TIOCGWINSZ, 0x7fd4acd8) | ||
| + | ioctl(1, TIOCGWINSZ, 0x7fd4ad10) | ||
| + | ioctl(1, TIOCGWINSZ, 0x7fd4ad10) | ||
| + | stat64(" | ||
| + | open(" | ||
| + | fcntl64(3, F_SETFD, FD_CLOEXEC) | ||
| + | getdents64(3, | ||
| + | getdents64(3, | ||
| + | close(3) | ||
| + | exit_group(0) | ||
| + | +++ exited with 0 +++ | ||
| + | </ | ||
| + | </ | ||