<rdar://problem/12437442>

Given our implementation of ValueObjects we could have a scenario where a ValueObject has a dynamic type of Foo* at one point, and then its dynamic type changes to Bar*
If Bar* has synthetic children enabled, by the time we figure that out, our public API is already vending SBValues wrapping a DynamicVO, instead of a SyntheticVO and there was
no trivial way for us to change the SP inside an SBValue on the fly
This checkin reimplements SBValue in terms of a wrapper, ValueImpl, that allows this substitutions on-the-fly by overriding GetSP() to do The Right Thing (TM)
As an additional bonus, GetNonSyntheticValue() now works, and we can get rid of the ForceDisableSyntheticChildren idiom in ScriptInterpreterPython
Lastly, this checkin makes sure the synthetic VOs get the correct m_value and m_data from their parents (prevented summaries from working in some cases)

llvm-svn: 166426
This commit is contained in:
Enrico Granata
2012-10-22 18:18:36 +00:00
parent 2f758cf8ba
commit e3e91517ff
16 changed files with 492 additions and 149 deletions

View File

@@ -197,24 +197,6 @@ ScriptInterpreterPython::Locker::~Locker()
DoFreeLock();
}
class ForceDisableSyntheticChildren
{
public:
ForceDisableSyntheticChildren (Target* target) :
m_target(target)
{
m_old_value = target->GetSuppressSyntheticValue();
target->SetSuppressSyntheticValue(true);
}
~ForceDisableSyntheticChildren ()
{
m_target->SetSuppressSyntheticValue(m_old_value);
}
private:
Target* m_target;
bool m_old_value;
};
ScriptInterpreterPython::PythonInputReaderManager::PythonInputReaderManager (ScriptInterpreterPython *interpreter) :
m_interpreter(interpreter),
m_debugger_sp(),
@@ -1933,10 +1915,9 @@ ScriptInterpreterPython::CreateSyntheticScriptedProvider (std::string class_name
{
Locker py_lock(this);
ForceDisableSyntheticChildren no_synthetics(target);
ret_val = g_swig_synthetic_script (class_name,
python_interpreter->m_dictionary_name.c_str(),
valobj);
ret_val = g_swig_synthetic_script (class_name,
python_interpreter->m_dictionary_name.c_str(),
valobj);
}
return MakeScriptObject(ret_val);
@@ -2275,8 +2256,7 @@ ScriptInterpreterPython::CalculateNumChildren (const lldb::ScriptInterpreterObje
{
Locker py_lock(this);
ForceDisableSyntheticChildren no_synthetics(GetCommandInterpreter().GetDebugger().GetSelectedTarget().get());
ret_val = g_swig_calc_children (implementor);
ret_val = g_swig_calc_children (implementor);
}
return ret_val;
@@ -2302,8 +2282,7 @@ ScriptInterpreterPython::GetChildAtIndex (const lldb::ScriptInterpreterObjectSP&
{
Locker py_lock(this);
ForceDisableSyntheticChildren no_synthetics(GetCommandInterpreter().GetDebugger().GetSelectedTarget().get());
child_ptr = g_swig_get_child_index (implementor,idx);
child_ptr = g_swig_get_child_index (implementor,idx);
if (child_ptr != NULL && child_ptr != Py_None)
{
value_sb = (lldb::SBValue*)g_swig_cast_to_sbvalue(child_ptr);
@@ -2339,8 +2318,7 @@ ScriptInterpreterPython::GetIndexOfChildWithName (const lldb::ScriptInterpreterO
{
Locker py_lock(this);
ForceDisableSyntheticChildren no_synthetics(GetCommandInterpreter().GetDebugger().GetSelectedTarget().get());
ret_val = g_swig_get_index_child (implementor, child_name);
ret_val = g_swig_get_index_child (implementor, child_name);
}
return ret_val;
@@ -2364,8 +2342,7 @@ ScriptInterpreterPython::UpdateSynthProviderInstance (const lldb::ScriptInterpre
{
Locker py_lock(this);
ForceDisableSyntheticChildren no_synthetics(GetCommandInterpreter().GetDebugger().GetSelectedTarget().get());
ret_val = g_swig_update_provider (implementor);
ret_val = g_swig_update_provider (implementor);
}
return ret_val;