APIs to GetValueAsSigned/Unsigned() in SBValue now also accept an SBError parameter to give more info about any problem

The synthetic children providers now use the new (safer) APIs to get the values of objects
As a side effect, fixed an issue in ValueObject where ResolveValue() was not always updating the value before reading it

llvm-svn: 136861
This commit is contained in:
Enrico Granata
2011-08-04 01:41:02 +00:00
parent b224db72b0
commit 6fd87d5d33
12 changed files with 156 additions and 60 deletions

View File

@@ -618,6 +618,48 @@ SBValue::GetValueForExpressionPath(const char* expr_path)
return sb_value;
}
int64_t
SBValue::GetValueAsSigned(SBError& error, int64_t fail_value)
{
if (m_opaque_sp)
{
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
{
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
Scalar scalar;
if (m_opaque_sp->ResolveValue (scalar))
return scalar.GetRawBits64(fail_value);
else
error.SetErrorString("could not get value");
}
else
error.SetErrorString("could not get target");
}
error.SetErrorString("invalid SBValue");
return fail_value;
}
uint64_t
SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
{
if (m_opaque_sp)
{
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
{
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
Scalar scalar;
if (m_opaque_sp->ResolveValue (scalar))
return scalar.GetRawBits64(fail_value);
else
error.SetErrorString("could not get value");
}
else
error.SetErrorString("could not get target");
}
error.SetErrorString("invalid SBValue");
return fail_value;
}
int64_t
SBValue::GetValueAsSigned(int64_t fail_value)
{