[Lldb-commits] [PATCH] D51730: [DWARFExpression] Read literars as unsigned values.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 6 06:41:14 PDT 2018


JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, jingham, clayborg.
JDevlieghere added a project: LLDB.

After landing https://reviews.llvm.org/rL341457, we started seeing a failure on the swift-lldb bots. The change was correct and pretty straightforward, a `DW_OP_constu` was replaced with `DW_OP_lit23`, the value remaining identical.

  0x000000f4:         DW_TAG_variable
                        DW_AT_location    (0x00000000
                           [0x0000000100000a51,  0x0000000100000d47): DW_OP_lit23, DW_OP_stack_value)
                        DW_AT_name        ("number")

However, this broke LLDB:

  (Int) number = <extracting data from value failed>

The value was read correctly, but apparently the value's type was different. When reading a `constu` it was reading a uint64 (`m_type = e_ulonglong`) while for the literal, it got a signed int (`m_type = e_sint`). This change makes sure we read the value as an unsigned.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51730

Files:
  source/Expression/DWARFExpression.cpp


Index: source/Expression/DWARFExpression.cpp
===================================================================
--- source/Expression/DWARFExpression.cpp
+++ source/Expression/DWARFExpression.cpp
@@ -2382,7 +2382,7 @@
     case DW_OP_lit29:
     case DW_OP_lit30:
     case DW_OP_lit31:
-      stack.push_back(Scalar(op - DW_OP_lit0));
+      stack.push_back(Scalar((uint64_t(op - DW_OP_lit0)));
       break;
 
     //----------------------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51730.164203.patch
Type: text/x-patch
Size: 491 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180906/4de4a99a/attachment.bin>


More information about the lldb-commits mailing list