Syscall fault injection strace
Force the 3rd openat to fail with ENOENT to test error handling; chaos testing without code
strace -f -e inject=openat:error=ENOENT:when=3 -p <pid>
more strace
all 13 commands →
Trace signals delivered
strace -f -e signal=all -e trace=none -p <pid>
Trace a new process
strace -o trace.log ls /tmp
Attach to running process
strace -p $(pgrep nginx | head -1) -o /tmp/nginx.trace
Trace only specific syscalls
strace -e trace=openat,read,write curl https://example.com
Count syscall statistics
strace -c -e trace=all python3 app.py