Recent versions of both Binutils (`c++filt`) and LLVM (`llvm-cxxfilt`) provide Rust v0 mangling support.
Showing the changes to scripts/decode_stacktrace.sh (1 of 1 file). Show all
Unified · Split
| @@ -8,6 +8,14 @@ usage() { · 7 unmodified lines | |||
| 8 | echo " $0 -r <release> | <vmlinux> [<base path>|auto] [<modules path>]" | 8 | echo " $0 -r <release> | <vmlinux> [<base path>|auto] [<modules path>]" |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | # Try to find a Rust demangler | ||
| 12 | if type llvm-cxxfilt >/dev/null 2>&1 ; then | ||
| 13 | cppfilt=llvm-cxxfilt | ||
| 14 | elif type c++filt >/dev/null 2>&1 ; then | ||
| 15 | cppfilt=c++filt | ||
| 16 | cppfilt_opts=-i | ||
| 17 | fi | ||
| 18 | |||
| 11 | if [[ $1 == "-r" ]] ; then | 19 | if [[ $1 == "-r" ]] ; then |
| 12 | vmlinux="" | 20 | vmlinux="" |
| 13 | basepath="auto" | 21 | basepath="auto" |
| @@ -180,6 +188,12 @@ parse_symbol() { · 166 unmodified lines | |||
| 180 | # In the case of inlines, move everything to same line | 188 | # In the case of inlines, move everything to same line |
| 181 | code=${code//$'\n'/' '} | 189 | code=${code//$'\n'/' '} |
| 182 | 190 | ||
| 191 | # Demangle if the name looks like a Rust symbol and if | ||
| 192 | # we got a Rust demangler | ||
| 193 | if [[ $name =~ ^_R && $cppfilt != "" ]] ; then | ||
| 194 | name=$("$cppfilt" "$cppfilt_opts" "$name") | ||
| 195 | fi | ||
| 196 | |||
| 183 | # Replace old address with pretty line numbers | 197 | # Replace old address with pretty line numbers |
| 184 | symbol="$segment$name ($code)" | 198 | symbol="$segment$name ($code)" |
| 185 | } | 199 | } |