Fix up how the ValueObjects manage their life cycle so that you can hand out a shared
pointer to a ValueObject or any of its dependent ValueObjects, and the whole cluster will
stay around as long as that shared pointer stays around.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130035 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 93c5410..9a42ae0 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -351,6 +351,8 @@
SBFrame::FindVariable (const char *name, bool use_dynamic)
{
VariableSP var_sp;
+ SBValue sb_value;
+
if (m_opaque_sp && name && name[0])
{
VariableList variable_list;
@@ -373,8 +375,6 @@
}
}
- SBValue sb_value;
-
if (var_sp)
*sb_value = ValueObjectSP (m_opaque_sp->GetValueObjectForFrameVariable(var_sp, use_dynamic));
@@ -452,7 +452,7 @@
((reg_info->name && strcasecmp (reg_info->name, name) == 0) ||
(reg_info->alt_name && strcasecmp (reg_info->alt_name, name) == 0)))
{
- *sb_value = ValueObjectSP (new ValueObjectRegister (m_opaque_sp.get(), reg_ctx, reg_idx));
+ *sb_value = ValueObjectRegister::Create (m_opaque_sp.get(), reg_ctx, reg_idx);
}
}
}
@@ -472,7 +472,7 @@
((reg_set->name && strcasecmp (reg_set->name, name) == 0) ||
(reg_set->short_name && strcasecmp (reg_set->short_name, name) == 0)))
{
- *sb_value = ValueObjectSP (new ValueObjectRegisterSet (m_opaque_sp.get(), reg_ctx, set_idx));
+ *sb_value = ValueObjectRegisterSet::Create (m_opaque_sp.get(), reg_ctx, set_idx);
}
}
}
@@ -677,7 +677,7 @@
const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
{
- value_list.Append(ValueObjectSP (new ValueObjectRegisterSet (m_opaque_sp.get(), reg_ctx, set_idx)));
+ value_list.Append(ValueObjectRegisterSet::Create (m_opaque_sp.get(), reg_ctx, set_idx));
}
}
}
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 6401178..6ad6bb9 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -357,7 +357,7 @@
{
if (child_sp)
{
- lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue(true, child_sp);
+ lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue(true);
if (dynamic_sp)
child_sp = dynamic_sp;
}
@@ -410,7 +410,7 @@
{
if (child_sp)
{
- lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue(true, child_sp);
+ lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue(true);
if (dynamic_sp)
child_sp = dynamic_sp;
}