Page MenuHomePhabricator

[DWARFExpression] Read literars as unsigned values.
ClosedPublic

Authored by JDevlieghere on Sep 6 2018, 6:39 AM.

Details

Summary

After landing 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.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Sep 6 2018, 6:39 AM

Can we add a test for this?

Added a test case. I really didn't know where to put it so I decided on something generic. Hope that's fine.

ping

(I'd like to land this so I can un-revert the DW_OP_constu normalization for Swift)

clayborg accepted this revision.Sep 13 2018, 7:18 AM

The test really should encode actual DWARF that contains a DW_OP_litXXX opcode (using obj2yaml/yaml2obj or llvm-mc) as compiling the code for the test won't always produce the needed DWARF opcode,, but the change is simple and correct.

This revision is now accepted and ready to land.Sep 13 2018, 7:18 AM
This revision was automatically updated to reflect the committed changes.