[PATCH] D16509: [DebugInfo] Fix DWARFDebugFrame instruction operand ordering

Igor Laevsky via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 23 08:52:56 PST 2016


igor-laevsky removed rL LLVM as the repository for this revision.
igor-laevsky updated this revision to Diff 45794.

http://reviews.llvm.org/D16509

Files:
  lib/DebugInfo/DWARF/DWARFDebugFrame.cpp

Index: lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -160,18 +160,28 @@
         case DW_CFA_offset_extended:
         case DW_CFA_register:
         case DW_CFA_def_cfa:
-        case DW_CFA_val_offset:
+        case DW_CFA_val_offset: {
           // Operands: ULEB128, ULEB128
-          addInstruction(Opcode, Data.getULEB128(Offset),
-                                 Data.getULEB128(Offset));
+          // Note: We can not embed getULEB128 directly into function
+          // argument list. getULEB128 changes Offset and order of evaluation
+          // for arguments is unspecified.
+          uint64_t op1, op2;
+          op1 = Data.getULEB128(Offset);
+          op2 = Data.getULEB128(Offset);
+          addInstruction(Opcode, op1, op2);
           break;
+        }
         case DW_CFA_offset_extended_sf:
         case DW_CFA_def_cfa_sf:
-        case DW_CFA_val_offset_sf:
+        case DW_CFA_val_offset_sf: {
           // Operands: ULEB128, SLEB128
-          addInstruction(Opcode, Data.getULEB128(Offset),
-                                 Data.getSLEB128(Offset));
+          // Note: see comment for the previous case
+          uint64_t op1, op2;
+          op1 = Data.getULEB128(Offset);
+          op2 = (uint64_t)Data.getSLEB128(Offset);
+          addInstruction(Opcode, op1, op2);
           break;
+        }
         case DW_CFA_def_cfa_expression:
         case DW_CFA_expression:
         case DW_CFA_val_expression:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16509.45794.patch
Type: text/x-patch
Size: 1605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160123/d4d7afe1/attachment.bin>


More information about the llvm-commits mailing list