From 70fa220f7a2b1b2275679547ac21768ab657cea2 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 12 Jan 2020 20:36:45 +0100 Subject: Add diagnostic script, prune result evaluation --- rust-unmangle | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 rust-unmangle (limited to 'rust-unmangle') diff --git a/rust-unmangle b/rust-unmangle new file mode 100755 index 0000000..183f7f9 --- /dev/null +++ b/rust-unmangle @@ -0,0 +1,32 @@ +#!/usr/bin/sed -rf +# Unmangle Rust symbols +# See https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=cae15db74999edb96dd9f5bbd4d55849391dd92b +# Example, with [FlameGraph](https://github.com/brendangregg/FlameGraph): +# perf record -g target/debug/bin +# perf script | stackcollapse-perf | rust-unmangle | flamegraph > perf.svg + +# Remove hash and address offset +s/::h[0-9a-f]{16}//g +s/\+0x[0-9a-f]+//g + +# Convert special characters +s/\$C\$/,/g +s/\$SP\$/@/g +s/\$BP\$/*/g +s/\$RF\$/\&/g +s/\$LT\$//g +s/\$LP\$/(/g +s/\$RP\$/)/g +s/\$u20\$/ /g +s/\$u27\$/'/g +s/\$u5b\$/[/g +s/\$u5d\$/]/g +s/\$u7b\$/{/g +s/\$u7d\$/}/g +s/\$u7e\$/~/g + +# Fix . and _ +s/\.\./::/g +s/[^\.]\.[^\.]/./g +s/([;:])_/\1/g -- cgit v1.2.3-54-g00ecf