2 ms·
This was easier than I thought: https://github.com/google/bloaty/compare/master...zokier:rust_demangle?expand=1 https://github.com/google/bloaty/compare/master
by zokier 9y ago
This was easier than I thought:
https://github.com/google/bloaty/compare/master...zokier:rust_demangle?expand=1 https://github.com/google/bloaty/compare/master...zokier:rus...
and here is the wrapper for rustc-demangle:
https://github.com/zokier/rust-demangle-clib https://github.com/zokier/rust-demangle-clib
Seems to work just fine for my simple use at least:
[zokier@zarch bloaty]$ ./bloaty -d sections,segments,symbols -C rust /tmp/tinyrocket/target/release/tinyrocket
VM SIZE FILE SIZE
-------------- --------------
52.0% 506Ki .text 506Ki 24.8%
100.0% 506Ki LOAD [RX] 506Ki 100.0%
65.6% 332Ki [967 Others] 332Ki 65.6%
5.1% 25.7Ki hyper::server::listener::spawn_with::{{closure}} 25.7Ki 5.1%
3.6% 18.3Ki <yansi::Paint<T> as core::fmt::Display>::fmt 18.3Ki 3.6%
2.9% 14.5Ki rocket::ignite 14.5Ki 2.9%
2.5% 12.8Ki rocket::config::config::Config::set_raw 12.8Ki 2.5%
2.1% 10.7Ki core::ptr::drop_in_place 10.7Ki 2.1%
1.9% 9.78Ki std::sys_common::backtrace::output 9.78Ki 1.9%
1.9% 9.62Ki tinyrocket::main 9.62Ki 1.9%
1.6% 8.16Ki <alloc::raw_vec::RawVec<T, A>>::double 8.16Ki 1.6%
...
I can try to clean it up bit more etc if you want a proper pull request for this?
- haberman 9y agoCool! If the dependency is optional I think this would be great and I'd love to see a PR for it. It could be configured at CMake time. I think I'd prefer to just make this part of shortsymbols/fullsymbols instead of making a separate "rustsymbols". I assume that Rust symbols won't successfully demangle as C++ (and vice-versa), so we can just try both demanglers and use whatever works. That seems like it will be more graceful for mixed C++/Rust binaries.
- zokier 9y agoI created https://github.com/google/bloaty/issues/110 https://github.com/google/bloaty/issues/110 to track this. I'll try to find time to clean up the patch, but no promises. Lets continue the discussion in the GH issue.