-
-
Couldn't load subscription status.
- Fork 171
Process Tracing Tips and Tools
andychu edited this page Sep 26, 2025
·
20 revisions
e.g. busybox ash on an Alpine machine, for reducing bugs from regtest/aports
These techniques do NOT require recompilation, debug symbols, or source code modification
-
Shell interpreter tracing with
set -xakaset -o xtrace- show shell statements executed- Example from Andy: I used this to discover that autotool configure scripts call
rmandcatcommonly, and then we implementedbuiltin rmandbuiltin cat
- Example from Andy: I used this to discover that autotool configure scripts call
-
strace myprog- show syscalls- the
-eflag filters by syscall - the
-cflag creates a histogram of syscalls - Samuel used this for the
$PWDbug
- the
-
ltrace myprog- showlibccalls- has an
-eflag - Example from Andy: I used this to debug
setlocale()calls in bash versus OSH
- has an
-
shell tracing with
set -x; export SHELLOPTS- bash and OSH have a feature where you canexport SHELLOPTSto make all processes trace- Note: bash also has an
XTRACE_FD=env var to send all the traces to the same place; I don't think OSH has this yet
- Note: bash also has an
-
strace -ff -o prefix- follow forks, createsprefix.$PIDfiles
gdb --args myprog --flag- ASAN gives nicer stack traces
- We are using
uftrace- user space function tracing- it traces all function call entry and exit, by putting probes in the code
-
systemtap- we haveDTRACE_PROBE()calls in the Oils C++ source code