#3532·bpftrace

Rust symbol demangling

Author: adammithaCreated Oct 20, 2024Updated Jul 10, 2026

Is your feature request related to a problem? Please describe.

bpftrace currently doesn't support demangling Rust symbols, so when listing uprobes on Rust programs you get the mangled symbol name. This is a suboptimal user experience.

Unfortunately, Rust's name mangling scheme is different from C++, so the :cpp prefix doesn't work on Rust binaries.

For example:

❯ bpftrace --version
bpftrace v0.20.4
adam @ adams-nixos-desktop in nixos-configuration on  main
❯ sudo bpftrace -l 'u:/nix/store/71jzy8l7bqkw64fn4gnldrr248vqi2ly-ripgrep-14.1.0/bin/rg:cpp:*' | head -n 1
uprobe:/nix/store/71jzy8l7bqkw64fn4gnldrr248vqi2ly-ripgrep-14.1.0/bin/rg:cpp:"_$LT$aho_corasick..packed..teddy..builder..x86_64..SlimAVX2$LT$_$GT$$u20$as$u20$core..fmt..Debug$GT$::fmt::h5c8301c85bfe80c1"

Describe the solution you'd like

Introduce a :rust prefix to the bpftrace probe syntax that allows users to request automatic symbol demangling for Rust symbols in the same way that they request automatic symbol demangling.

LLVM has a rust demangler that we should be able to use: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Demangle/RustDemangle.cpp.

I'm happy to do the work, but since this would be my first contribution I wanted to discuss the idea before implementing it.

Describe alternative solutions or features you've considered

Use the mangled symbol names – not a great user experience.