Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash on reversed high_pc/low_pc with -d compileunits #372

Open
bence42 opened this issue Mar 1, 2024 · 0 comments
Open

crash on reversed high_pc/low_pc with -d compileunits #372

bence42 opened this issue Mar 1, 2024 · 0 comments

Comments

@bence42
Copy link

bence42 commented Mar 1, 2024

bloaty crashes when the high_pc is of a DIE is greater than the low_pc.
Also when the high_pc is 0. Both of these happen with GHS arm 2022 compiler

bloaty version: 22a83c0
cmd: bloaty -d compileunits bar.elf
compiler: GHS arm 2022

(gdb) bt
#0  0x00007fb272262662 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x0000560bd423625a in bloaty::Throw (str=0x560bd459b874 "Failed to open file.", line=974) at /home/zbb2bp/mnt/ws/others/bloaty/src/util.cc:23
#2  0x0000560bd41e0692 in bloaty::MmapInputFileFactory::OpenFile (this=0x7fff880a7528, filename="build/target_r5f/bin/perception.elf") at /home/zbb2bp/mnt/ws/others/bloaty/src/bloaty.cc:974
#3  0x0000560bd41e32df in bloaty::Bloaty::GetObjectFile (this=0x7fff880a7300, filename="build/target_r5f/bin/perception.elf") at /home/zbb2bp/mnt/ws/others/bloaty/src/bloaty.cc:1552
#4  0x0000560bd41e3563 in bloaty::Bloaty::AddFilename (this=0x7fff880a7300, filename="build/target_r5f/bin/perception.elf", is_base=false) at /home/zbb2bp/mnt/ws/others/bloaty/src/bloaty.cc:1575
#5  0x0000560bd41e7601 in bloaty::BloatyDoMain (options=..., file_factory=..., output=0x7fff880a7640) at /home/zbb2bp/mnt/ws/others/bloaty/src/bloaty.cc:2252
#6  0x0000560bd41e7a39 in bloaty::BloatyMain (options=..., file_factory=..., output=0x7fff880a7640, error=0x7fff880a7550) at /home/zbb2bp/mnt/ws/others/bloaty/src/bloaty.cc:2290
#7  0x0000560bd41da82e in main (argc=1, argv=0x7fff880a7818) at /home/zbb2bp/mnt/ws/others/bloaty/src/main.cc:36

at the crash the high_pc was 0x10222c0c, so I've checked how the binary looked, and it indeed has this strange reversed high/low pc:

$ readelf --debug-dump=info bar.elf  | grep -i -B2 10222c0c
 <5><cdea7>: Abbrev Number: 34 (DW_TAG_lexical_block)
    <cdea8>   DW_AT_low_pc      : 0x10222c0e
    <cdeac>   DW_AT_high_pc     : 0x10222c0c

I'm not sure if I can provide a dummy binary that showcases this strange reversed pc for a dwarf tag.

@bence42 bence42 changed the title crash on reversed high_pc/low_pc crash on reversed high_pc/low_pc with -d compileunits Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant