[PATCH] D79622: [DebugInfo] Dump raw data in a case of decoding error of an expression.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 20:25:11 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc6ed1fcf245b: [DebugInfo] Dump raw data in a case of decoding error of an expression. (authored by ikudrin).

Changed prior to commit:
  https://reviews.llvm.org/D79622?vs=262847&id=262990#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79622/new/

https://reviews.llvm.org/D79622

Files:
  llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
  llvm/test/DebugInfo/X86/DW_OP_call_ref_unexpected.s
  llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s


Index: llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s
===================================================================
--- llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s
+++ 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  (<decoding error>)
+# CHECK-NEXT:  DW_AT_location  (<decoding error> 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    (<decoding error>)
+# VERIFY-NEXT:   DW_AT_location    (<decoding error> ff)
 
 .section  .debug_info,"", at progbits
   .long  0x12
Index: llvm/test/DebugInfo/X86/DW_OP_call_ref_unexpected.s
===================================================================
--- llvm/test/DebugInfo/X86/DW_OP_call_ref_unexpected.s
+++ 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): <decoding error>
+# CHECK-NEXT:   (0x0000000000000000, 0x0000000000000015): <decoding error> 9a ff 00 00 00
 
     .section .debug_loc, "", @progbits
     .quad 0                         # Beginning address offset
Index: llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -120,13 +120,12 @@
 bool DWARFExpression::Operation::extract(DataExtractor Data,
                                          uint8_t AddressSize, uint64_t Offset,
                                          Optional<DwarfFormat> 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 @@
     if (Size == Operation::SizeNA)
       break;
 
-    EndOffset = Offset;
     switch (Size & ~Operation::SignBit) {
     case Operation::Size1:
       Operands[Operand] = Data.getU8(&Offset);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79622.262990.patch
Type: text/x-patch
Size: 2503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200509/273bc4ff/attachment.bin>


More information about the llvm-commits mailing list