[lldb] DWARF expression results do not consistently preserve required bit widths
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This is a meta issue for tracking related LLDB issues and pull requests concerning incorrect DWARF expression result widths. It does not report another individual evaluator bug; each actionable instance remains in its linked report below.
DWARF v5 assigns a type to each value on the expression stack. The generic type has the target address width, while explicitly typed values use the width of their referenced base type. These are semantic widths: they must not depend on the host integer type or the C++ type used to carry the value inside LLDB. LLVM's location-description stack extension does not remove this requirement.
Several independent LLDB issues now show the same broader problem: evaluator handlers construct or transform `Scalar` objects using incidental `uint64_t`, `lldb::addr_t`, C++ `bool`, storage byte size, or normal `Scalar` promotion without restoring the width required by the DWARF result type. Depending on the opcode, this can make a 32-bit generic result remain 64 bits, make a 64-bit generic result become 32 bits, or widen a narrow explicitly typed value.
## Tracked Issues and PRs
- [x] #204353
- [x] #210122
- [x] #209728
- [x] #211007
- [x] #210972
- [x] #210991
- [x] #210980
- [x] #204520
- [x] #208203
- [x] #211010
## Common Implementation Pattern
For every operation whose result is defined to have the generic type, LLDB should canonicalize the result to the target address width before it is used by later operations. Existing mechanisms already express this requirement, for example by constructing the result through `to_generic` or by applying `TruncOrExtendTo(size_addr_bytes * 8, /*sign=*/false)` when the address-size variable is available under that name.
The exact call site differs between the linked reports, but the invariant is the same: a generic DWARF result must not retain the incidental width of its C++ carrier or `Scalar` storage.
Contributor guide
Research direction
Start with the tracked reports, especially issues #204353, #210122, #209728, and #211007, since this meta issue names no source file or test. Compare their evaluator call sites against the stated generic-width invariant and existing to_generic or TruncOrExtendTo mechanisms. Done means the linked cases preserve the DWARF-required result width.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100