Cleaned up the SBType.h file to not include internal headers and reorganized

the SBType implementation classes.

Fixed LLDB core and the test suite to not use deprecated SBValue APIs.

Added a few new APIs to SBValue:

    int64_t
    SBValue::GetValueAsSigned(int64_t fail_value=0);

    uint64_t
    SBValue::GetValueAsUnsigned(uint64_t fail_value=0)

 

llvm-svn: 136829
This commit is contained in:
Greg Clayton
2011-08-03 22:57:10 +00:00
parent 3ef20e35f9
commit fe42ac4d0a
31 changed files with 319 additions and 287 deletions

View File

@@ -13,6 +13,7 @@
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/Value.h"
@@ -270,8 +271,7 @@ SBValue::GetType()
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
{
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
result = SBType(m_opaque_sp->GetClangAST(),
m_opaque_sp->GetClangType());
result = SBType(ClangASTType (m_opaque_sp->GetClangAST(), m_opaque_sp->GetClangType()));
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -391,7 +391,7 @@ SBValue::CreateChildAtOffset (const char *name, uint32_t offset, const SBType& t
{
if (type.IsValid())
{
result = SBValue(m_opaque_sp->GetSyntheticChildAtOffset(offset, *type.m_opaque_ap->GetClangASTType(), true));
result = SBValue(m_opaque_sp->GetSyntheticChildAtOffset(offset, type.m_opaque_sp->GetClangASTType(), true));
result.m_opaque_sp->SetName(ConstString(name));
}
}
@@ -449,8 +449,8 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, const SB
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
ValueObjectSP result_valobj_sp(ValueObjectConstResult::Create(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
real_type.m_opaque_ap->GetASTContext(),
real_type.m_opaque_ap->GetOpaqueQualType(),
real_type.m_opaque_sp->GetASTContext(),
real_type.m_opaque_sp->GetOpaqueQualType(),
ConstString(name),
buffer,
lldb::endian::InlHostByteOrder(),
@@ -618,6 +618,38 @@ SBValue::GetValueForExpressionPath(const char* expr_path)
return sb_value;
}
int64_t
SBValue::GetValueAsSigned(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);
}
}
return fail_value;
}
uint64_t
SBValue::GetValueAsUnsigned(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);
}
}
return fail_value;
}
uint32_t
SBValue::GetNumChildren ()
{