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
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153495 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index c5a5fd2..b28004c 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -51,21 +51,23 @@
{
}
-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 @@
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 @@
SBValue::SetSP (const lldb::ValueObjectSP &sp)
{
m_opaque_sp = sp;
+ if (IsValid() && m_opaque_sp->HasSyntheticValue())
+ m_opaque_sp = m_opaque_sp->GetSyntheticValue();
}