google / bloaty

Bloaty: a size profiler for binaries
Apache License 2.0
4.79k stars 346 forks source link

`couldn't find abbreviation for code` when run with `-d compileunits` #362

Open carlosperate opened 1 year ago

carlosperate commented 1 year ago

With a project built with arm-none-eabi-gcc v12.3, looks like bloaty cannot process the "compileunits":

$ bloaty -d compileunits build-gcc12/MICROBIT 
bloaty: couldn't find abbreviation for code

The same project built with v11.3 does work:

$ bloaty -d compileunits build-gcc11/MICROBIT
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  63.3%  2.09Mi  35.5%   134Ki    [194 Others]
   7.1%   242Ki   0.0%       0    [section .debug_loclists]
   3.7%   126Ki   0.0%       0    [Unmapped]
   0.0%       0  29.1%   110Ki    [section .heap]
   3.1%   105Ki  27.7%   105Ki    [section .softdevice]
   2.4%  82.7Ki   0.4%  1.34Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-microbit-v2/source/bluetooth/MicroBitBLEManager.cpp
   1.9%  63.8Ki   0.5%  1.79Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-microbit-v2/model/MicroBit.cpp
   1.7%  58.6Ki   0.0%       0    [section .debug_frame]
   1.7%  56.4Ki   1.4%  5.36Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/source/main.cpp
   1.5%  50.8Ki   0.6%  2.40Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-microbit-v2/source/MicroBitPowerManager.cpp
   1.4%  47.7Ki   0.9%  3.38Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-nrf52/source/NRF52ADC.cpp
   1.4%  46.2Ki   0.0%     152    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/source/samples/OOB.cpp
   1.3%  44.1Ki   0.1%     352    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-microbit-v2/source/MicroBitLog.cpp
   1.3%  43.0Ki   0.1%     264    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-microbit-v2/source/bluetooth/MicroBitPartialFlashingService.cpp
   1.3%  43.0Ki   0.4%  1.39Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-microbit-v2/source/MicroBitAudio.cpp
   1.2%  41.6Ki   0.0%       0    [section .debug_rnglists]
   1.2%  39.6Ki   0.6%  2.11Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-microbit-v2/source/MicroBitUSBFlashManager.cpp
   1.2%  39.2Ki   0.9%  3.44Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-nrf52/source/NRF52Pin.cpp
   1.1%  38.8Ki   0.5%  1.78Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-core/source/driver-models/Serial.cpp
   1.1%  38.7Ki   0.9%  3.48Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-core/source/core/CodalFiber.cpp
   1.1%  37.6Ki   0.4%  1.57Ki    /Users/microbit-carlos/workspace/carlos/docker-microbit-toolchain/rmfolder/microbit-v2-samples/libraries/codal-nrf52/source/NRF52Serial.cpp
 100.0%  3.31Mi 100.0%   378Ki    TOTAL

So I'm guessing something might have changed in the latest release.

The two elf/dwarf files used for testing:

And, in case it's useful to have the full project with a build folder for arm-none-eabi-gcc v11 and another for v12:

As a test, I built bloaty in Ubuntu 23.04 with their default gcc v12.2 and run it on itself with -d compileunits, and that worked fined.