Synthetic values are now automatically enabled and active by default. SBValue is set up to always wrap a synthetic value when one is available.

A new setting enable-synthetic-value is provided on the target to disable this behavior.
There also is a new GetNonSyntheticValue() API call on SBValue to go back from synthetic to non-synthetic. There is no call to go from non-synthetic to synthetic.
The test suite has been changed accordingly.
Fallout from changes to type searching: an hack has to be played to make it possible to use maps that contain std::string due to the special name replacement operated by clang
Fixing a test case that was using libstdcpp instead of libc++ - caught as a consequence of said changes to type searching

llvm-svn: 153495
This commit is contained in:
Enrico Granata
2012-03-27 02:35:13 +00:00
parent fe384a2c84
commit c5bc412cf6
21 changed files with 346 additions and 113 deletions

View File

@@ -51,21 +51,23 @@ SBValue::SBValue () :
{
}
SBValue::SBValue (const lldb::ValueObjectSP &value_sp) :
m_opaque_sp (value_sp)
SBValue::SBValue (const lldb::ValueObjectSP &value_sp)
{
SetSP(value_sp); // whenever setting the SP call SetSP() since it knows how to deal with synthetic values properly
}
SBValue::SBValue(const SBValue &rhs) :
m_opaque_sp (rhs.m_opaque_sp)
SBValue::SBValue(const SBValue &rhs)
{
SetSP(rhs.m_opaque_sp); // whenever setting the SP call SetSP() since it knows how to deal with synthetic values properly
}
SBValue &
SBValue::operator = (const SBValue &rhs)
{
if (this != &rhs)
m_opaque_sp = rhs.m_opaque_sp;
{
SetSP(rhs.m_opaque_sp); // whenever setting the SP call SetSP() since it knows how to deal with synthetic values properly
}
return *this;
}
@@ -809,6 +811,30 @@ SBValue::GetStaticValue ()
return SBValue();
}
lldb::SBValue
SBValue::GetNonSyntheticValue ()
{
SBValue sb_value;
lldb::ValueObjectSP value_sp(GetSP());
if (value_sp)
{
if (value_sp->IsSynthetic())
{
TargetSP target_sp(value_sp->GetTargetSP());
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
// deliberately breaking the rules here to optimize the case where we DO NOT want
// the synthetic value to be returned to the user - if we did not do this, we would have to tell
// the target to suppress the synthetic value, and then return the flag to its original value
if (value_sp->GetParent())
sb_value.m_opaque_sp = value_sp->GetParent()->GetSP();
}
}
}
return sb_value;
}
bool
SBValue::IsDynamic()
{
@@ -1124,6 +1150,8 @@ void
SBValue::SetSP (const lldb::ValueObjectSP &sp)
{
m_opaque_sp = sp;
if (IsValid() && m_opaque_sp->HasSyntheticValue())
m_opaque_sp = m_opaque_sp->GetSyntheticValue();
}