Bug 24623 - DWARF errors
Summary: DWARF errors
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: 2.33
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-27 08:30 UTC by trass3r
Modified: 2019-08-14 05:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2019-08-13 00:00:00
Project(s) to access:
ssh public key:


Attachments
test files (8.59 KB, application/x-zip-compressed)
2019-05-27 08:30 UTC, trass3r
Details

Note You need to log in before you can comment on or make changes to this bug.
Description trass3r 2019-05-27 08:30:25 UTC
Created attachment 11805 [details]
test files

$ nm -ClS --radix=d --size-sort firmwareNoError.elf
T __libc_csu_fini
b completed.7374
T main        main.cpp:9
R _IO_stdin_used
T _start
T __libc_csu_init

$ nm -ClS --radix=d --size-sort firmwareAbbrevError.elf
T __libc_csu_fininm: DWARF error: could not find abbrev number 7

b completed.7374
R _IO_stdin_used
T _start
T __libc_csu_init

$ nm -ClS --radix=d --size-sort firmwareInfoPtr.elf
T __libc_csu_fininm: DWARF error: info pointer extends beyond end of attributes
b completed.7374
R _IO_stdin_used
T _start
T __libc_csu_init
Comment 1 trass3r 2019-08-12 10:53:45 UTC
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90441#c25

"I fear this is the libbfd dwarf reader simply not coping with
DW_AT_abstract_origin in other CUs, being confused as to which
abbrev section it needs to look into (probably using that of
the refering CU instead of the referred to one)."
Comment 2 Alan Modra 2019-08-13 05:11:35 UTC
The problem is that the code in dwarf2.c:find_abstract_instance only looks over the chain of CUs already parsed.  The one pointed at by DW_FORM_ref_addr hasn't yet been parsed.
Comment 3 Sourceware Commits 2019-08-14 04:17:35 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dfc19da6a6d43390544fa446bb1a33723b339a77

commit dfc19da6a6d43390544fa446bb1a33723b339a77
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Aug 14 10:51:22 2019 +0930

    PR24623, DWARF errors
    
    	PR 24623
    	* dwarf2.c (stash_comp_unit): New function, extracted from..
    	(_bfd_dwarf2_find_nearest_line): ..here.
    	(find_abstract_instance): Parse comp units and decode line info
    	as needed.
Comment 4 Alan Modra 2019-08-14 05:25:11 UTC
Fixed for 2.33, I believe.