Implement DW_OP_convert
authorAdrian Prantl <aprantl@apple.com>
Tue, 10 Sep 2019 16:17:38 +0000 (16:17 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 10 Sep 2019 16:17:38 +0000 (16:17 +0000)
commit9b23df63ecd9f23bb8877783d30d1a49e895cf7c
treee1e9e41f9c70fd6c5ba7c34eb00757305d84649d
parent6b877f6aac3d8e569e74953f0310323c2882619c
Implement DW_OP_convert

This patch adds basic support for DW_OP_convert[1] for integer
types. Recent versions of LLVM's optimizer may insert this opcode into
DWARF expressions. DW_OP_convert is effectively a type cast operation
that takes a reference to a base type DIE (or zero) and then casts the
value at the top of the DWARF stack to that type. Internally this
works by changing the bit size of the APInt that is used as backing
storage for LLDB's DWARF stack.

I managed to write a unit test for this by implementing a mock YAML
object file / module that takes debug info sections in yaml2obj
format.

[1] Typed DWARF stack. http://www.dwarfstd.org/ShowIssue.php?issue=140425.1

<rdar://problem/48167864>

Differential Revision: https://reviews.llvm.org/D67369

llvm-svn: 371532
lldb/include/lldb/Core/Section.h
lldb/include/lldb/Utility/Scalar.h
lldb/source/Core/Section.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Utility/Scalar.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp
lldb/unittests/Utility/ScalarTest.cpp