Skip to content

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는 애플리케이션들이 사용하는 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

Favorite site

References


  1. Brunch.co.kr_-_strace.pdf