Fixed a problem with the IR interpreter that caused
it to generate result variables that were not bound
to their underlying data. This allowed the SBValue
class to use the interpreter (if possible).
Also made sure that any result variables that point
to stack allocations in the stack frame of the
interpreted expressions do not get live data.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140285 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index 1af41b5..763546b 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -320,7 +320,8 @@
ClangExpressionDeclMap::CompleteResultVariable (lldb::ClangExpressionVariableSP &valobj,
lldb_private::Value &value,
const ConstString &name,
- lldb_private::TypeFromParser type)
+ lldb_private::TypeFromParser type,
+ bool transient)
{
assert (m_parser_vars.get());
@@ -330,7 +331,8 @@
return false;
if (pvar_sp->m_flags & ClangExpressionVariable::EVIsProgramReference &&
- !pvar_sp->m_live_sp)
+ !pvar_sp->m_live_sp &&
+ !transient)
{
// The reference comes from the program. We need to set up a live SP for it.
@@ -927,11 +929,20 @@
}
else if (persistent_var_sp)
{
- lldb_private::Value ret;
- ret.SetValueType(Value::eValueTypeHostAddress);
- ret.SetContext(Value::eContextTypeInvalid, NULL);
- ret.GetScalar() = (lldb::addr_t)persistent_var_sp->GetValueBytes();
- return ret;
+ if ((persistent_var_sp->m_flags & ClangExpressionVariable::EVIsProgramReference ||
+ persistent_var_sp->m_flags & ClangExpressionVariable::EVIsLLDBAllocated) &&
+ persistent_var_sp->m_live_sp)
+ {
+ return persistent_var_sp->m_live_sp->GetValue();
+ }
+ else
+ {
+ lldb_private::Value ret;
+ ret.SetValueType(Value::eValueTypeHostAddress);
+ ret.SetContext(Value::eContextTypeInvalid, NULL);
+ ret.GetScalar() = (lldb::addr_t)persistent_var_sp->GetValueBytes();
+ return ret;
+ }
}
else
{