[Lldb-commits] [PATCH] D90840: [lldb/DWARF] Fix sizes of DW_OP_const[1248][us] and DW_OP_litN results

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 5 04:50:22 PST 2020


labath created this revision.
labath added reviewers: JDevlieghere, aprantl, dblaikie.
Herald added a project: LLDB.
labath requested review of this revision.

Dwarf says (Section 2.5.1.1. of DWARF v5) that these operations should
push "generic" (pointer-sized) values. This was not the case for
DW_OP_const operations (which were pushing values based on the size of
arguments), nor DW_OP_litN (which were always pushing 64-bit values).

The practical effect of this that were were unable to display the values
of variables if the size of the DW_OP_const opcode was smaller than the
value of the variable it was describing. This would happen because we
would store this (small) result into a buffer and then would not be able
to read sufficient data out of it (in Value::GetValueAsData). Gcc emits
debug info like this.

Other (more subtle) effects are also possible.

The same fix should be applied to DW_OP_const[us] (leb128 versions), but
I'm not doing that right now, because that would cause us to display
wrong (truncated) values of variables on 32-bit targets (pr48087).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90840

Files:
  lldb/include/lldb/Utility/Scalar.h
  lldb/source/Expression/DWARFExpression.cpp
  lldb/unittests/Expression/DWARFExpressionTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90840.303085.patch
Type: text/x-patch
Size: 8589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201105/279fec10/attachment.bin>


More information about the lldb-commits mailing list