This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Fix DWARFDebugFrame instruction operand ordering
ClosedPublic

Authored by igor-laevsky on Jan 23 2016, 8:51 AM.

Details

Summary

When parsing DWARF instructions we can sometimes end up with instruction operands in reversed order. This was caused by two facts:

  1. getULEB128(Offset) changes Offset and
  2. Evaluation order of function arguments is unspecified

It means that two getULEB128 calls embedded into function argument list were executed in any arbitrary order. Sometimes this was resulting in a reversed instruction operands.

This issue came up after _eh_frame changes http://reviews.llvm.org/D15535. However they are not directly related.

Diff Detail

Repository
rL LLVM

Event Timeline

igor-laevsky updated this revision to Diff 45794.
igor-laevsky retitled this revision from to [DebugInfo] Fix DWARFDebugFrame instruction operand ordering.
igor-laevsky updated this object.
igor-laevsky added reviewers: pete, rafael.
igor-laevsky set the repository for this revision to rL LLVM.
igor-laevsky removed rL LLVM as the repository for this revision.
igor-laevsky added a subscriber: llvm-commits.
dblaikie accepted this revision.Jan 23 2016, 11:11 AM
dblaikie added a reviewer: dblaikie.
dblaikie added a subscriber: dblaikie.

Looks good, with one suggested change. Thanks!

lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
168

Roll the declaration/initialization together:

auto op1 = Data.getULEB128(Offset);
auto op2 = Data.getULEB128(Offset);

(using auto is optional - whichever you prefer - but the type information doesn't seem that important (given that the origintal formulation of this code didn't provide explicit type information to the reader))

This revision is now accepted and ready to land.Jan 23 2016, 11:11 AM
This revision was automatically updated to reflect the committed changes.