summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBFrame.cpp4
-rw-r--r--lldb/source/API/SBType.cpp245
-rw-r--r--lldb/source/API/SBValue.cpp84
3 files changed, 237 insertions, 96 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 4174638b8e7..3f27b6fc123 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -538,8 +538,8 @@ SBFrame::get() const
return m_opaque_sp.get();
}
-const lldb::StackFrameSP &
-SBFrame::get_sp() const
+lldb::StackFrameSP &
+SBFrame::get_sp()
{
return m_opaque_sp;
}
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 582eceec1e3..8deb01c50af 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -31,7 +31,7 @@ SBType::SBType() :
{
}
-SBType::SBType (const lldb_private::ClangASTType &type) :
+SBType::SBType (const ClangASTType &type) :
m_opaque_sp(new TypeImpl(ClangASTType(type.GetASTContext(),
type.GetOpaqueQualType())))
{
@@ -63,7 +63,7 @@ SBType::SBType (const SBType &rhs) :
//{}
//
bool
-SBType::operator == (const lldb::SBType &rhs) const
+SBType::operator == (SBType &rhs)
{
if (IsValid() == false)
return !rhs.IsValid();
@@ -73,7 +73,7 @@ SBType::operator == (const lldb::SBType &rhs) const
}
bool
-SBType::operator != (const lldb::SBType &rhs) const
+SBType::operator != (SBType &rhs)
{
if (IsValid() == false)
return rhs.IsValid();
@@ -82,11 +82,16 @@ SBType::operator != (const lldb::SBType &rhs) const
(rhs.m_opaque_sp->GetOpaqueQualType() != m_opaque_sp->GetOpaqueQualType());
}
+void
+SBType::reset(const lldb::TypeImplSP &type_impl_sp)
+{
+ m_opaque_sp = type_impl_sp;
+}
-const lldb::SBType &
-SBType::operator = (const lldb::SBType &rhs)
+SBType &
+SBType::operator = (const SBType &rhs)
{
- if (*this != rhs)
+ if (this != &rhs)
{
m_opaque_sp = rhs.m_opaque_sp;
}
@@ -96,15 +101,15 @@ SBType::operator = (const lldb::SBType &rhs)
SBType::~SBType ()
{}
-lldb_private::TypeImpl &
+TypeImpl &
SBType::ref ()
{
if (m_opaque_sp.get() == NULL)
- m_opaque_sp.reset (new lldb_private::TypeImpl());
+ m_opaque_sp.reset (new TypeImpl());
return *m_opaque_sp;
}
-const lldb_private::TypeImpl &
+const TypeImpl &
SBType::ref () const
{
// "const SBAddress &addr" should already have checked "addr.IsValid()"
@@ -124,7 +129,7 @@ SBType::IsValid() const
}
size_t
-SBType::GetByteSize() const
+SBType::GetByteSize()
{
if (!IsValid())
return 0;
@@ -134,7 +139,7 @@ SBType::GetByteSize() const
}
bool
-SBType::IsPointerType() const
+SBType::IsPointerType()
{
if (!IsValid())
return false;
@@ -148,7 +153,7 @@ SBType::IsPointerType() const
}
bool
-SBType::IsReferenceType() const
+SBType::IsReferenceType()
{
if (!IsValid())
return false;
@@ -162,7 +167,7 @@ SBType::IsReferenceType() const
}
SBType
-SBType::GetPointerType() const
+SBType::GetPointerType()
{
if (!IsValid())
return SBType();
@@ -172,7 +177,7 @@ SBType::GetPointerType() const
}
SBType
-SBType::GetPointeeType() const
+SBType::GetPointeeType()
{
if (!IsValid())
return SBType();
@@ -186,7 +191,7 @@ SBType::GetPointeeType() const
}
SBType
-SBType::GetReferenceType() const
+SBType::GetReferenceType()
{
if (!IsValid())
return SBType();
@@ -196,7 +201,7 @@ SBType::GetReferenceType() const
}
SBType
-SBType::GetDereferencedType() const
+SBType::GetDereferencedType()
{
if (!IsValid())
return SBType();
@@ -207,7 +212,7 @@ SBType::GetDereferencedType() const
}
SBType
-SBType::GetBasicType(lldb::BasicType type) const
+SBType::GetBasicType(lldb::BasicType type)
{
if (!IsValid())
@@ -302,6 +307,89 @@ SBType::GetBasicType(lldb::BasicType type) const
return SBType(ClangASTType(m_opaque_sp->GetASTContext(), base_type_qual.getAsOpaquePtr()));
}
+uint32_t
+SBType::GetNumberOfDirectBaseClasses ()
+{
+ if (IsValid())
+ return ClangASTContext::GetNumDirectBaseClasses(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+ return 0;
+}
+
+uint32_t
+SBType::GetNumberOfVirtualBaseClasses ()
+{
+ if (IsValid())
+ return ClangASTContext::GetNumVirtualBaseClasses(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+ return 0;
+}
+
+uint32_t
+SBType::GetNumberOfFields ()
+{
+ if (IsValid())
+ return ClangASTContext::GetNumFields(m_opaque_sp->GetASTContext(), m_opaque_sp->GetOpaqueQualType());
+ return 0;
+}
+
+SBTypeMember
+SBType::GetDirectBaseClassAtIndex (uint32_t idx)
+{
+ SBTypeMember sb_type_member;
+ if (IsValid())
+ {
+ clang::ASTContext* ast = m_opaque_sp->GetASTContext();
+ uint32_t byte_offset = 0;
+ clang_type_t clang_type = ClangASTContext::GetDirectBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &byte_offset);
+ if (clang_type)
+ {
+ TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset));
+ }
+ }
+ return sb_type_member;
+
+}
+
+SBTypeMember
+SBType::GetVirtualBaseClassAtIndex (uint32_t idx)
+{
+ SBTypeMember sb_type_member;
+ if (IsValid())
+ {
+ uint32_t byte_offset = 0;
+ clang::ASTContext* ast = m_opaque_sp->GetASTContext();
+ clang_type_t clang_type = ClangASTContext::GetVirtualBaseClassAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, &byte_offset);
+ if (clang_type)
+ {
+ TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset));
+ }
+ }
+ return sb_type_member;
+}
+
+SBTypeMember
+SBType::GetFieldAtIndex (uint32_t idx)
+{
+ SBTypeMember sb_type_member;
+ if (IsValid())
+ {
+ uint32_t byte_offset = 0;
+ clang::ASTContext* ast = m_opaque_sp->GetASTContext();
+ std::string name_sstr;
+ clang_type_t clang_type = ClangASTContext::GetFieldAtIndex (ast, m_opaque_sp->GetOpaqueQualType(), idx, name_sstr, &byte_offset);
+ if (clang_type)
+ {
+ ConstString name;
+ if (!name_sstr.empty())
+ name.SetCString(name_sstr.c_str());
+ TypeImplSP type_impl_sp (new TypeImpl(ClangASTType (ast, clang_type)));
+ sb_type_member.reset (new TypeMemberImpl (type_impl_sp, byte_offset, name));
+ }
+ }
+ return sb_type_member;
+}
+
const char*
SBType::GetName()
{
@@ -311,6 +399,15 @@ SBType::GetName()
return ClangASTType::GetConstTypeName(m_opaque_sp->GetOpaqueQualType()).GetCString();
}
+lldb::TypeClass
+SBType::GetTypeClass ()
+{
+ if (IsValid())
+ return ClangASTType::GetTypeClass (m_opaque_sp->GetASTContext(),
+ m_opaque_sp->GetOpaqueQualType());
+ return lldb::eTypeClassInvalid;
+}
+
SBTypeList::SBTypeList() :
m_opaque_ap(new TypeListImpl())
{
@@ -319,12 +416,12 @@ SBTypeList::SBTypeList() :
SBTypeList::SBTypeList(const SBTypeList& rhs) :
m_opaque_ap(new TypeListImpl())
{
- for (uint32_t i = 0, rhs_size = rhs.GetSize(); i < rhs_size; i++)
- Append(rhs.GetTypeAtIndex(i));
+ for (uint32_t i = 0, rhs_size = const_cast<SBTypeList&>(rhs).GetSize(); i < rhs_size; i++)
+ Append(const_cast<SBTypeList&>(rhs).GetTypeAtIndex(i));
}
bool
-SBTypeList::IsValid () const
+SBTypeList::IsValid ()
{
return (m_opaque_ap.get() != NULL);
}
@@ -332,30 +429,32 @@ SBTypeList::IsValid () const
SBTypeList&
SBTypeList::operator = (const SBTypeList& rhs)
{
- if (this != &rhs && m_opaque_ap.get() != rhs.m_opaque_ap.get())
+ if (this != &rhs)
{
- m_opaque_ap.reset(new TypeListImpl());
- for (uint32_t i = 0, rhs_size = rhs.GetSize(); i < rhs_size; i++)
- Append(rhs.GetTypeAtIndex(i));
+ m_opaque_ap.reset (new TypeListImpl());
+ for (uint32_t i = 0, rhs_size = const_cast<SBTypeList&>(rhs).GetSize(); i < rhs_size; i++)
+ Append(const_cast<SBTypeList&>(rhs).GetTypeAtIndex(i));
}
return *this;
}
void
-SBTypeList::Append (const SBType& type)
+SBTypeList::Append (SBType type)
{
if (type.IsValid())
m_opaque_ap->Append (type.m_opaque_sp);
}
SBType
-SBTypeList::GetTypeAtIndex(int index) const
+SBTypeList::GetTypeAtIndex(uint32_t index)
{
- return SBType(m_opaque_ap->GetTypeAtIndex(index));
+ if (m_opaque_ap.get())
+ return SBType(m_opaque_ap->GetTypeAtIndex(index));
+ return SBType();
}
-int
-SBTypeList::GetSize() const
+uint32_t
+SBTypeList::GetSize()
{
return m_opaque_ap->GetSize();
}
@@ -367,7 +466,7 @@ SBTypeList::~SBTypeList()
bool
SBType::IsPointerType (void *opaque_type)
{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_value = ClangASTContext::IsPointerType (opaque_type);
@@ -376,3 +475,89 @@ SBType::IsPointerType (void *opaque_type)
return ret_value;
}
+
+
+SBTypeMember::SBTypeMember() :
+ m_opaque_ap()
+{
+}
+
+SBTypeMember::~SBTypeMember()
+{
+}
+
+SBTypeMember::SBTypeMember (const SBTypeMember& rhs) :
+ m_opaque_ap()
+{
+ if (this != &rhs)
+ {
+ if (rhs.IsValid())
+ m_opaque_ap.reset(new TypeMemberImpl(rhs.ref()));
+ }
+}
+
+lldb::SBTypeMember&
+SBTypeMember::operator = (const lldb::SBTypeMember& rhs)
+{
+ if (this != &rhs)
+ {
+ if (rhs.IsValid())
+ m_opaque_ap.reset(new TypeMemberImpl(rhs.ref()));
+ }
+ return *this;
+}
+
+bool
+SBTypeMember::IsValid() const
+{
+ return m_opaque_ap.get();
+}
+
+const char *
+SBTypeMember::GetName ()
+{
+ if (m_opaque_ap.get())
+ return m_opaque_ap->GetName().GetCString();
+ return NULL;
+}
+
+SBType
+SBTypeMember::GetType ()
+{
+ SBType sb_type;
+ if (m_opaque_ap.get())
+ {
+ sb_type.reset (m_opaque_ap->GetTypeImpl());
+ }
+ return sb_type;
+
+}
+
+uint64_t
+SBTypeMember::GetOffsetByteSize()
+{
+ if (m_opaque_ap.get())
+ return (m_opaque_ap->GetBitOffset() + 7) / 8u;
+ return 0;
+}
+
+void
+SBTypeMember::reset(TypeMemberImpl *type_member_impl)
+{
+ m_opaque_ap.reset(type_member_impl);
+}
+
+TypeMemberImpl &
+SBTypeMember::ref ()
+{
+ if (m_opaque_ap.get() == NULL)
+ m_opaque_ap.reset (new TypeMemberImpl());
+ return *m_opaque_ap.get();
+}
+
+const TypeMemberImpl &
+SBTypeMember::ref () const
+{
+ return *m_opaque_ap.get();
+}
+
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index ea7ebf8c13e..d0e2e678793 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -52,7 +52,7 @@ SBValue::SBValue(const SBValue &rhs) :
{
}
-const SBValue &
+SBValue &
SBValue::operator = (const SBValue &rhs)
{
if (this != &rhs)
@@ -65,7 +65,7 @@ SBValue::~SBValue()
}
bool
-SBValue::IsValid () const
+SBValue::IsValid ()
{
// If this function ever changes to anything that does more than just
// check if the opaque shared pointer is non NULL, then we need to update
@@ -146,12 +146,6 @@ SBValue::GetByteSize ()
}
bool
-SBValue::IsInScope (const SBFrame &sb_frame)
-{
- return IsInScope();
-}
-
-bool
SBValue::IsInScope ()
{
bool result = false;
@@ -173,12 +167,6 @@ SBValue::IsInScope ()
}
const char *
-SBValue::GetValue (const SBFrame &sb_frame)
-{
- return GetValue();
-}
-
-const char *
SBValue::GetValue ()
{
const char *cstr = NULL;
@@ -228,12 +216,6 @@ SBValue::GetValueType ()
}
const char *
-SBValue::GetObjectDescription (const SBFrame &sb_frame)
-{
- return GetObjectDescription ();
-}
-
-const char *
SBValue::GetObjectDescription ()
{
const char *cstr = NULL;
@@ -256,12 +238,6 @@ SBValue::GetObjectDescription ()
return cstr;
}
-bool
-SBValue::GetValueDidChange (const SBFrame &sb_frame)
-{
- return GetValueDidChange ();
-}
-
SBType
SBValue::GetType()
{
@@ -305,12 +281,6 @@ SBValue::GetValueDidChange ()
}
const char *
-SBValue::GetSummary (const SBFrame &sb_frame)
-{
- return GetSummary ();
-}
-
-const char *
SBValue::GetSummary ()
{
const char *cstr = NULL;
@@ -334,12 +304,6 @@ SBValue::GetSummary ()
}
const char *
-SBValue::GetLocation (const SBFrame &sb_frame)
-{
- return GetLocation ();
-}
-
-const char *
SBValue::GetLocation ()
{
const char *cstr = NULL;
@@ -363,12 +327,6 @@ SBValue::GetLocation ()
}
bool
-SBValue::SetValueFromCString (const SBFrame &sb_frame, const char *value_str)
-{
- return SetValueFromCString (value_str);
-}
-
-bool
SBValue::SetValueFromCString (const char *value_str)
{
bool success = false;
@@ -384,7 +342,7 @@ SBValue::SetValueFromCString (const char *value_str)
}
lldb::SBValue
-SBValue::CreateChildAtOffset (const char *name, uint32_t offset, const SBType& type)
+SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type)
{
lldb::SBValue result;
if (m_opaque_sp)
@@ -407,7 +365,7 @@ SBValue::CreateChildAtOffset (const char *name, uint32_t offset, const SBType& t
}
lldb::SBValue
-SBValue::Cast(const SBType& type)
+SBValue::Cast (SBType type)
{
return CreateChildAtOffset(m_opaque_sp->GetName().GetCString(), 0, type);
}
@@ -419,10 +377,10 @@ SBValue::CreateValueFromExpression (const char *name, const char* expression)
if (m_opaque_sp)
{
ValueObjectSP result_valobj_sp;
- m_opaque_sp->GetUpdatePoint().GetTargetSP()->EvaluateExpression(expression,
- m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame(),
- true, true, eNoDynamicValues,
- result_valobj_sp);
+ m_opaque_sp->GetUpdatePoint().GetTargetSP()->EvaluateExpression (expression,
+ m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame(),
+ true, true, eNoDynamicValues,
+ result_valobj_sp);
result_valobj_sp->SetName(ConstString(name));
result = SBValue(result_valobj_sp);
}
@@ -438,7 +396,7 @@ SBValue::CreateValueFromExpression (const char *name, const char* expression)
}
lldb::SBValue
-SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, const SBType& type)
+SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType type)
{
lldb::SBValue result;
if (m_opaque_sp)
@@ -448,13 +406,13 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, const SB
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
- ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
- real_type.m_opaque_sp->GetASTContext(),
- real_type.m_opaque_sp->GetOpaqueQualType(),
- ConstString(name),
- buffer,
- lldb::endian::InlHostByteOrder(),
- GetTarget().GetProcess().GetAddressByteSize()));
+ ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
+ real_type.m_opaque_sp->GetASTContext(),
+ real_type.m_opaque_sp->GetOpaqueQualType(),
+ ConstString(name),
+ buffer,
+ lldb::endian::InlHostByteOrder(),
+ GetTarget().GetProcess().GetAddressByteSize()));
ValueObjectSP result_valobj_sp;
@@ -480,9 +438,7 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, const SB
}
lldb::SBValue
-SBValue::CreateValueFromData (const char* name,
- const SBData& data,
- const SBType& type)
+SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
{
SBValue result;
@@ -869,7 +825,7 @@ SBValue::GetThread()
{
if (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope())
{
- result = SBThread(lldb::ThreadSP(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateThread()));
+ result = SBThread(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateThread()->GetSP());
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -891,7 +847,7 @@ SBValue::GetFrame()
{
if (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope())
{
- result = SBFrame(lldb::StackFrameSP(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame()));
+ result.SetFrame (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame()->GetSP());
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -980,7 +936,7 @@ SBValue::GetDescription (SBStream &description)
}
lldb::Format
-SBValue::GetFormat () const
+SBValue::GetFormat ()
{
if (m_opaque_sp)
return m_opaque_sp->GetFormat();
OpenPOWER on IntegriCloud