This commit aims to improve error handling in the DWARFAbbreviationDeclarationSet class. Specifically, we change the return type of DWARFAbbreviationDeclarationSet::extract to an llvm::Error. In doing so, we propagate the error from DWARFAbbreviationDeclaration::extract another layer upward. I have built on the previous unittest for DWARFDebugAbbrev that I wrote a few days prior. Namely, I am verifying that the following should give an error: - An invalid tag following a non-null code - An invalid attribute with a valid form - A valid attribute with an invalid form - An incorrectly terminated DWARFAbbreviationDeclaration Additionally, I uncovered some invalid DWARF in an unrelated dsymutil test. Namely the last Abbreviation Decl was missing a code. This test has been updated accordingly. However, this commit does not fix the underlying issue: llvm-dwarfdump does not correctly verify the debug abbreviation section to catch these kinds of mistakes. I have updated DWARFVerifier to not dereference a pointer without first checking it and left a FIXME for future contributors. Differential Revision: https://reviews.llvm.org/D151353
18 lines
465 B
ArmAsm
18 lines
465 B
ArmAsm
.section __DWARF,__debug_info,regular,debug
|
|
.long 8 # CU length
|
|
.short 3 # Version
|
|
.long 0 # Abbrev offset
|
|
.byte 4 # AddrSize
|
|
.byte 1 # Abbrev 1
|
|
.long 7 # Unit lengthh...
|
|
.short 3
|
|
.long 0
|
|
.byte 4
|
|
.section __DWARF,__debug_abbrev,regular,debug
|
|
.byte 1 # Abbrev code
|
|
.byte 0x11 # DW_TAG_compile_unit
|
|
.byte 0 # DW_CHILDREN_no
|
|
.byte 0 # Terminating attribute
|
|
.byte 0 # Terminating form
|
|
.byte 0 # Terminating abbrev code
|