My Profile Photo

Welcome


This is the little corner of Dinesh, where you can find his thoughts, work and anything else he wants to share.


Announcing Rust Demangler Online

Just a little tool to help a colleague debug some Android crashes


Rust Demangler Online

A colleague of mine came to me to make sense of some crash logs and they mostly looked like:

12-25 21:51:29.094  5668  5668 F DEBUG   : backtrace:
12-25 21:51:29.094  5668  5668 F DEBUG   :       #00 pc 000000000004fe2c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+180) (BuildId: 7589cf4bcb5e11ec06c41940bf849449)
12-25 21:51:29.094  5668  5668 F DEBUG   :       #01 pc 00000000000f9a00  /apex/com.android.resolv/lib64/libnetd_resolv.so (_RNvNtNtCsglGYCpMRyF7_3std3sys4unix14abort_internal+4) (BuildId: 7bedfb4e26a6f9467d2ec60e3050401d)
12-25 21:51:29.094  5668  5668 F DEBUG   :       #02 pc 00000000000bd214  /apex/com.android.resolv/lib64/libnetd_resolv.so (__rust_start_panic+8) (BuildId: 7bedfb4e26a6f9467d2ec60e3050401d)
12-25 21:51:29.094  5668  5668 F DEBUG   :       #03 pc 00000000000f99b0  /apex/com.android.resolv/lib64/libnetd_resolv.so (rust_panic+16) (BuildId: 7bedfb4e26a6f9467d2ec60e3050401d)
12-25 21:51:29.094  5668  5668 F DEBUG   :       #04 pc 00000000000f9768  /apex/
...

I quickly demangled those names and shared the actual locations of the code these crashes are coming from. But that’s where this story begins..

A quick websearch later, I did not find something like: C++ Demangler for rust. So I thought to make one myself. I found a bunch libraries that did this. There was one written in python, one written in C and one in rust.

I could write one in javascript too.. but I thought this would be a good opportunity to play with the WebAssembly ecosystem and I set out to do just that. A quick search later, I found this useful rust webpack starter guide . I ran with it.

The actual Rust code itself took me less than 2 minutes to write.. but i did end up spending a few hours on this project, thanks to some annoyances of node.js/webpack ecosystem.. and my non existent CSS skills. In my defense, I still blame it on the whole html/css/js thing being designed to make documents/webpages and not web apps. Either way, it was a fun little experience. I even got ChatGPT to help me out with the CSS headaches. Quite impressed.

Without further ado, check out my Rust Demangler

Happy New Year!