Closed Bug 1311498 Opened 8 years ago Closed 6 years ago

Demangle Rust function names in dump_syms with rust-demangle-capi

Categories

(Toolkit :: Crash Reporting, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1474871

People

(Reporter: ted, Unassigned)

References

(Blocks 1 open bug)

Details

I was looking at the state of Breakpad symbols for Rust functions in bug 1268328 and I noted that Rust function names come out looking different on Windows vs. Mac/Linux. Windows: FUNC 3e820 1ad 0 read<&mut mp4parse::BMFFBox<mp4parse_capi::mp4parse_io>> Mac/Linux: FUNC 4055d00 269 0 {{inlined-root}}::read<mp4parse::BMFFBox<mp4parse::BMFFBox<mp4parse_capi::mp4parse_io>>> To quote myself from that bug: This is because rustc uses GCC-style C++ name mangling, and dump_syms uses `cxx_demangle` if it finds a mangled name, and so we get sort-of-C++-looking symbol names back. We could fix dump_syms to not do this (upstream Breakpad took a patch to handle Swift symbols that way: https://codereview.chromium.org/2147523005/ ) and then do the Rust demangling ourselves in symbolstore.py in order to get function names that match across platforms. This is probably worth doing in order to get consistent Rust signatures across platforms.
I took a slightly different tack. I wrote a crate to provide a C API around the rustc-demangle crate: https://github.com/luser/rust-demangle-capi I landed a change to upstream Breakpad to allow linking against rust-demangle-capi and use it to demangle Rust symbols: https://chromium.googlesource.com/breakpad/breakpad/+/2ecb2baba829a7ed4fff4bc60edf0c1643dc129c ...so now I have to figure out the mechanics to wire up host Rust crates in our build system so I can build and link that into dump_syms.
Summary: Demangle Rust function names in symbolstore.py, not dump_syms → Demangle Rust function names in dump_syms with rust-demangle-capi
Depends on: 1312916
No longer blocks: 1268328
Blocks: 1348896
Ted, is this still on your radar?
Flags: needinfo?(ted)
It was originally blocked on having support for building host Rust code, but I believe that's all wired up now so we'd just need to import + build the rust-demangle-capi crate I wrote, update our Breakpad snapshot, and set the define that Breakpad uses to enable this code.
Flags: needinfo?(ted)
See Also: → 1440233
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.