google / google/bloaty

short DWARF compilation unit error on MIPS binary

Open
#301 1 comment 3 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
5.5k
Forks
378
Avg merge
23h 54m
Merged PRs (30d)
6

Description

I have a binary that bloaty can show the sections and segments for, but it gives the error `bloaty: short DWARF compilation unit` when I attempt to use `-d compileunits`.

Readelf and dwarfdump are able to parse the binary, and bloaty itself assigns a reasonable size to the section:
```
FILE SIZE VM SIZE
-------------- --------------
24.6% 23.0Ki 80.4% 23.0Ki .text
19.7% 18.4Ki 0.0% 0 .debug_info
17.9% 16.8Ki 0.0% 0 .debug_loc
8.1% 7.57Ki 0.0% 0 .debug_line
5.4% 5.04Ki 0.0% 0 .debug_abbrev
5.0% 4.70Ki 0.0% 0 .debug_str
...
0.9% 816 0.0% 0 .debug_ranges
...
0.6% 616 0.0% 0 .debug_aranges
0.6% 608 2.1% 608 .MIPS.stubs
....
100.0% 93.5Ki 100.0% 28.7Ki TOTAL
```

However, if I dump the remaining size and length just before the error, the remaining size is correct, but the length is a wildly large number:
```
bloaty libuuid.so.1.3.0 -d compileunits
size: 0x264, len: 0x24000000
bloaty: short DWARF compilation unit
```

More information about binary in question:
```ELF Header:
Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: MIPS R3000
Version: 0x1
Entry point address: 0x40a270
Start of program headers: 52 (bytes into file)
Start of section headers: 14672868 (bytes into file)
Flags: 0x70001005, noreorder, cpic, o32, mips32r2
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 9
Size of section headers: 40 (bytes)
Number of section headers: 46
Section header string table index: 43
```

Readelf is able to parse the debug info section:
```
readelf --debug-dump=info libuuid.so.1.3.0 | grep -A 2 'Compilation Unit @'
Compilation Unit @ offset 0x0:
Length: 0xd2 (32-bit)
Version: 2
--
Compilation Unit @ offset 0xd6:
Length: 0xb7 (32-bit)
Version: 4
--
```

Do you have any advice on why this may be occurring or additional debugging steps to take?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.