Issue 177812
Summary [LLDB] `DWARFASTParserClang` handles `DW_AT_variant` incorrectly
Labels new issue
Assignees
Reporter Walnut356
    This problem affects Rust most directly. In short, there are 2 problems:

1. LLDB stores [discriminant values of `DW_TAG_variant` as a `uint32_t`](https://github.com/llvm/llvm-project/blob/3c4ce40c3f614a21fa3d4495f5d41a6a0f205421/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L2601), even though discriminants can be up to 128 bits long (e.g. `Option<String>` is 64 bits, `Option<NonZero<u128>>` is 128 bits). In the 128-bit case, the `DW_AT_discr_value` is a `DW_FORM_block1`:

<img width="1495" height="527" alt="Image" src="" />

2. [`die.GetAttributeValueAsOptionalUnsigned` returns a `std_optional<uint64_t>`](https://github.com/llvm/llvm-project/blob/3c4ce40c3f614a21fa3d4495f5d41a6a0f205421/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L2630), so even if the `DW_FORM_block1` was read correctly and `VariantMember.discr_value` was a `u128`, it wouldn't be communicated to `VariantMember` correctly
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to