Strace
strace is a system call tracer, i.e. a debugging tool which prints out a trace of all the system calls made by a another process/program.
시스템함수 콜을 어떤 것을 사용하는지 확인할 수 있다.
About
- [추천] 마법의 도구 strace 1
strace는 애플리케이션들이 사용하는 system call과 signal 등을 추적해서 성능 저하를 일으키는 부분은 없는지, 에러가 나는 부분은 없는지를 확인하는데 사용하는 디버깅 툴입니다.
Simple Usage
# 실행 중인 프로세스에 attach / Attach to running process
strace -p <PID> -e trace=openat,open,close -f -t 2>&1 | tee /tmp/trace.log
# 새로 실행하며 추적 / Trace from start
strace -e trace=openat,open,close -f -t -o /tmp/trace.log ./my_program
-
-f- 자식 프로세스까지 추적 -
-t- 타임 스탬프 출력
See also
- Valgrind
- DrMemory
- Pin
- DynamoRIO
- ftrace
- syscall (System call)
- syslog
- ltrace
- fuser - 특정 파일/포트를 사용 중인 프로세스 찾기
- inotifywait - 특정 파일/디렉토리 감시
- bpftrace/bcc - 오버헤드 최소, 프로덕션 환경 적합
- auditd - 시스템 레벨 감사 로그 (영구 설정 가능)
- lsof
Favorite site
- strace project site
- Wikipedia (en) strace에 대한 설명
- Sourceforge strace project page
- 리눅스 디버깅을 위한 툴 strace (1)
- (Linux) strace - 시스템 콜과 시그널을 추적하자~ :: :: heestory.me ::
- [추천] UNIX as IDE: 6. Debugging (strace, ltrace)
References
-
Brunch.co.kr_-_strace.pdf ↩