This commit is contained in:
Cyryl Płotnicki 2020-11-28 13:28:00 +00:00
parent b60c93584d
commit 6070faa2de
4 changed files with 38 additions and 0 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
/target
**/*.rs.bk
.idea/
perf*
flame*

View file

@ -35,3 +35,5 @@ version = "1"
default-features = false
features = ["run-for-all", "prepush-hook", "run-cargo-check", "run-cargo-test", "run-cargo-clippy", "run-cargo-fmt"]
[profile.release]
debug = 1

32
scripts/rust-unmangle Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env -S 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/\$GT\$/>/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

View file

@ -8,6 +8,7 @@ in
name = "bakare_shell";
buildInputs = [
channel.rust
linuxPackages.perf flamegraph cargo-flamegraph geeqie
cacert openssl openssh zlib
pkgconfig clang llvm
git