Skip to content

Process Tracing Tips and Tools

andychu edited this page Sep 26, 2025 · 20 revisions

Single Process Tracing

  • Shell interpreter tracing with set -x aka set -o xtrace

    • Example from Andy: I used this to discover that autotool configure scripts call rm and cat commonly, and then we implemented builtin rm and builtin cat
  • strace myprog

    • the -e flag filters by syscall
    • the -c flag creates a histogram of syscalls
    • Samuel used this for the $PWD bug
  • ltrace myprog

    • has an -e flag
    • Example from Andy: I used this to debug setlocale() calls in bash versus OSH

Multi Process Tracing

  • shell tracing with set -x; export SHELLOPTS - bash and OSH have a feature where you can export SHELLOPTS to make all processes trace

  • strace -ff -o prefix - follow forks, creates prefix.$PID files

Related

Process Tracing Projects

Clone this wiki locally