summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
diff options
context:
space:
mode:
authorIgor Laevsky <igmyrj@gmail.com>2016-01-26 13:31:11 +0000
committerIgor Laevsky <igmyrj@gmail.com>2016-01-26 13:31:11 +0000
commit0e1605a3b4828945f3d3e1c01cbd20b59e623c2d (patch)
treed0bc8e224bd995ff53bcf1cf0dbb06a8399f73ad /llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
parent1189bd020570f465c02176a609eb5109ab2fe0f8 (diff)
downloadbcm5719-llvm-0e1605a3b4828945f3d3e1c01cbd20b59e623c2d.tar.gz
bcm5719-llvm-0e1605a3b4828945f3d3e1c01cbd20b59e623c2d.zip
[DebugInfo] Fix DWARFDebugFrame instruction operand ordering
We can't rely on the evalution order of function arguments. Differential Revision: http://reviews.llvm.org/D16509 llvm-svn: 258806
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
index 1aa31be71fe..72dc95e977a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -160,18 +160,26 @@ void FrameEntry::parseInstructions(DataExtractor Data, uint32_t *Offset,
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.
+ auto op1 = Data.getULEB128(Offset);
+ auto 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
+ auto op1 = Data.getULEB128(Offset);
+ auto 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:
OpenPOWER on IntegriCloud