Skip to content

Extracting a stack back trace

Frank Filz edited this page Sep 19, 2023 · 1 revision

OK, here's a way to get a good stack trace from what Ganesha logs:

First, define this function for your shell:

addr2lines() ( perl -ne '$m = s/(.*).*\(([^)]*)\).*/gdb -nh -q -batch -ex "info line *\2" \1/;print $_ if $m' | bash )

Then issue this command:

tac /var/log/ganesha {or whatever it's called} | grep -F -m1 -B 1000 'stack backtrace follows' | head -n -1 | tac | addr2lines | sed -e "s@Line \([0-9][0-9]*\) of .\(/[/a-zA-Z0-9_\.]*\). starts at address \(0x[0-9a-f]*\)..\([0-9a-zA-Z_]*\)+.*@\3 \4 \2:\1@" | sed -e "s@No line number information available for address \(.*\)@\1@"