Skip to content

Commit 93b2551

Browse files
committed
[LLDB] Fix how ValueObjectVariable handles DW_AT_const_value when the DWARFExpression holds the data that represents a constant value
In some cases when we have a DW_AT_const_value and the data can be found in the DWARFExpression then ValueObjectVariable does not handle it properly and we end up with an extracting data from value failed error. The test is a very stripped down assembly file since reproducing this relies on the results of compiling with -O1 which may not be stable over time. Differential Revision: https://reviews.llvm.org/D86311
1 parent 62e91bf commit 93b2551

File tree

2 files changed

+413
-1
lines changed

2 files changed

+413
-1
lines changed

lldb/source/Core/ValueObjectVariable.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,11 @@ bool ValueObjectVariable::UpdateValue() {
132132
if (variable->GetLocationIsConstantValueData()) {
133133
// expr doesn't contain DWARF bytes, it contains the constant variable
134134
// value bytes themselves...
135-
if (expr.GetExpressionData(m_data))
135+
if (expr.GetExpressionData(m_data)) {
136+
if (m_data.GetDataStart() && m_data.GetByteSize())
137+
m_value.SetBytes(m_data.GetDataStart(), m_data.GetByteSize());
136138
m_value.SetContext(Value::eContextTypeVariable, variable);
139+
}
137140
else
138141
m_error.SetErrorString("empty constant data");
139142
// constant bytes can't be edited - sorry

0 commit comments

Comments
 (0)