• Austin Clements's avatar
    debug/dwarf: return ClassUnknown if attribute class cannot be determined · 6044dd09
    Austin Clements authored
    Currently, if the .debug_abbrev section of an ELF file contains
    attributes that aren't known to the dwarf package and that have form
    formSecOffset, the dwarf package will fail to open the DWARF data with
    an error like "decoding dwarf section abbrev at offset 0x17: cannot
    determine class of unknown attribute with formSecOffset". For the most
    part, the class is implied by the form encoded in the abbrev section,
    but formSecOffset can imply many different DWARF classes. Hence,
    debug/dwarf disambiguates these using a table of known attributes.
    However, it will reject the entire image if it encounters an attribute
    it can't determine the class of. This is particularly unfortunate
    because the caller may never even uses the offending attribute.
    
    Fix this by introducing a ClassUnknown attribute class to use as a
    fallback in these cases. This allows the dwarf package to load the
    DWARF data and isolates the problem to just the affected attributes.
    
    Fixes #12592.
    
    Change-Id: I766227b136e9757f8b89c0b3ab8e9ddea899d94f
    Reviewed-on: https://go-review.googlesource.com/14541Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Reviewed-by: 's avatarjcd . <jcd@golang.org>
    6044dd09
class_string.go 578 Bytes