google / bloaty

Bloaty: a size profiler for binaries
Apache License 2.0
4.71k stars 340 forks source link

"bloaty: Data is in new DWARF format we don't understand" for compileunits source #310

Open ScoreUnder opened 2 years ago

ScoreUnder commented 2 years ago

I used gcc --help=common | perl -lne 'print $1 if /^\s*(-g[^\s<]+) /' to get every possible debug flag from gcc, and did a full rebuild of my project with each one in succession. The -gz option gave bloaty: premature EOF reading fixed-length DWARF data, but every other option (including the absence of a debug option) gave bloaty: Data is in new DWARF format we don't understand. This is on an x86_64 linux system compiling a project written in C using GCC 12.1.0. I haven't had much success with clang either (version 13.0.1).

I am invoking it with bloaty -d compileunits followed by the name of the program. By default I build with -ggdb3, and the other two documented modes bloaty and bloaty -d symbols seem to work fine with that.

Is there a specific maximum version of gcc, or combination of debug parameters, which gets the compileunits option working?

pedronavf commented 2 years ago

I think gcc 12 defaults to DWARF 5, so using -gdwarf-4 might be what you need.

ScoreUnder commented 2 years ago

This still seems to be unrecognised:

$ gcc -gdwarf-4 -o test test.c
$ bloaty -d compileunits ./test
bloaty: Data is in new DWARF format we don't understand
brianosman commented 2 years ago

I'm seeing something similar (building using clang 14), but I get the more specific failure "Don't know how to parse DWARF form: 39" (only when using compileunits).

Edit: This is only true for some of my executables, and the ones I'm trying are various test applications for our primary project (a large statically linked library). So, it's probably something that's specifically linked only into the failing executable (like one of our third party dependencies). If I track it down, I'll let you know.

crazyhappygame commented 1 year ago

The same for me

$ cd bloaty-1.1/
$ cmake .
$ make -j6
$ ./bloaty bloaty -d compileunits
bloaty: Data is in new DWARF format we don't understand