diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp index 605236bc1833c..28b24b3baaab3 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp @@ -120,13 +120,12 @@ static DWARFExpression::Operation::Description getOpDesc(unsigned OpCode) { bool DWARFExpression::Operation::extract(DataExtractor Data, uint8_t AddressSize, uint64_t Offset, Optional Format) { + EndOffset = Offset; Opcode = Data.getU8(&Offset); Desc = getOpDesc(Opcode); - if (Desc.Version == Operation::DwarfNA) { - EndOffset = Offset; + if (Desc.Version == Operation::DwarfNA) return false; - } for (unsigned Operand = 0; Operand < 2; ++Operand) { unsigned Size = Desc.Op[Operand]; @@ -135,7 +134,6 @@ bool DWARFExpression::Operation::extract(DataExtractor Data, if (Size == Operation::SizeNA) break; - EndOffset = Offset; switch (Size & ~Operation::SignBit) { case Operation::Size1: Operands[Operand] = Data.getU8(&Offset); diff --git a/llvm/test/DebugInfo/X86/DW_OP_call_ref_unexpected.s b/llvm/test/DebugInfo/X86/DW_OP_call_ref_unexpected.s index 036e044270b63..4a3ac03f797bb 100644 --- a/llvm/test/DebugInfo/X86/DW_OP_call_ref_unexpected.s +++ b/llvm/test/DebugInfo/X86/DW_OP_call_ref_unexpected.s @@ -6,7 +6,7 @@ # CHECK: .debug_loc contents: # CHECK-NEXT: 0x00000000: -# CHECK-NEXT: (0x0000000000000000, 0x0000000000000015): +# CHECK-NEXT: (0x0000000000000000, 0x0000000000000015): 9a ff 00 00 00 .section .debug_loc, "", @progbits .quad 0 # Beginning address offset diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s b/llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s index 33a9aedbbb4ff..21a2ec530d7cf 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s @@ -3,13 +3,13 @@ ## Check we don't crash when parsing invalid expression opcode. # RUN: llvm-dwarfdump %t | FileCheck %s # CHECK: DW_TAG_GNU_call_site_parameter -# CHECK-NEXT: DW_AT_location () +# CHECK-NEXT: DW_AT_location ( ff) ## Check verifier reports an error. # RUN: not llvm-dwarfdump -verify %t 2>&1 | FileCheck %s --check-prefix=VERIFY # VERIFY: DIE contains invalid DWARF expression: # VERIFY: DW_TAG_GNU_call_site_parameter -# VERIFY-NEXT: DW_AT_location () +# VERIFY-NEXT: DW_AT_location ( ff) .section .debug_info,"",@progbits .long 0x12