google / bloaty

Bloaty: a size profiler for binaries
Apache License 2.0
4.73k stars 341 forks source link

bloaty file.elf -d compileunits assert failure in ItaniumDemangle #262

Closed charles-haynes closed 3 years ago

charles-haynes commented 3 years ago

built bloaty from latest (c47f8677) on Ubuntu. Ran it on an elf compiled by xtensa-esp32-elf-g++ for the ESP32 using the command bloaty firmware.elf -d compileunits I get:

Unexpected source: 1
bloaty: /home/haynes/projects/bloaty/src/bloaty.cc:256: std::string bloaty::ItaniumDemangle(absl::string_view, bloaty::DataSource): Assertion `false' failed.
Aborted

This is because DataSource source is equal to DataSource::kCompileUnits

I fixed it by changing ItaniumDemangle to not try to demangle if the source was a compile unit, but don't know enough about how bloaty is structured to know if there isn't some other better fix at a higher level. I can submit a patch and pull but while the change is trivial I don't know enough about the unit tests to write a proper test for this case.

haberman commented 3 years ago

Fixed in https://github.com/google/bloaty/pull/269, thanks for the report!