I wrote some functions with elisp to help me analyze core dumps & call stacks. I think they are very helpful, so I’ve decided to rewrite them in Rust, making them usable outside of Emacs.
./target/debug/cs --help
Tool to show call stack of process(es) Usage: cs [OPTIONS] [FILES]... Arguments: [FILES]... files to read stack from, use "-" for stdin; multiple files will be merged together Options: -p, --pid <PIDS> Show stack of process PID -c, --core <CORE> Show stack found in COREFILE -e, --executable <EXECUTABLE> (optional) EXECUTABLE that produced COREFILE -u, --users <USERS> Show processes of users (separated by \",\") when listing/choosing processes -i, --initial <INITIAL> Initial value to filter process -l, --list List processes -t, --interval <INTERVAL> Specify update interval as seconds, it should not be quicker than 0.1. Applies only when getting callstack from running app -n, --count <COUNT> Specify number of sampling. Applies only when getting callstack from running app, and `interval` is specified [default: 1] -W, --Wide Wide mode: when showing processes, show all chars in a line -M, --multi Multi mode: when choosing processes, to select multiple processes -U, --unique Unique mode: when showing call stack, show only unique ones -G, --gdb gdb mode: use gdb to get call stack (default to eu-stack) -R, --raw Raw mode: do not try to simplify callstacks (works only in GDB mode) -N, --no-pager Disable pager -P, --pattern <PATTERN> Show call stacks of processes whose name matches PATTERN -h, --help Print help -V, --version Print version
Usage examples:
cs
Choose process interactive and show’s its call stackcs -l -u user
Show processes of USER.cs -p 90588 -U
Show uniue stack for process90588
cs -U -P google.chrome
Show unique stack of all processes of google chromecs -U -p 90588 -t 0.5 -n 3
Get callstack for PID 90588 for 3 times with interval 0.5 seconds, then uniquify the output.