lldb::SBValue SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type) { lldb::SBValue sb_value; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); lldb::ValueObjectSP new_value_sp; if (value_sp) { TypeImplSP type_sp (type.GetSP()); if (type.IsValid()) { sb_value.SetSP(value_sp->GetSyntheticChildAtOffset(offset, type_sp->GetClangASTType(), true),GetPreferDynamicValue(),GetPreferSyntheticValue(), name); } } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (new_value_sp) log->Printf ("SBValue(%p)::CreateChildAtOffset => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString()); else log->Printf ("SBValue(%p)::CreateChildAtOffset => NULL", value_sp.get()); } return sb_value; }
bool SBType::operator != (SBType &rhs) { if (IsValid() == false) return rhs.IsValid(); if (rhs.IsValid() == false) return true; return *m_opaque_sp.get() != *rhs.m_opaque_sp.get(); }
//SBType::SBType (TypeImpl* impl) : // m_opaque_ap(impl) //{} // bool SBType::operator == (SBType &rhs) { if (IsValid() == false) return !rhs.IsValid(); if (rhs.IsValid() == false) return false; return *m_opaque_sp.get() == *rhs.m_opaque_sp.get(); }
bool SBType::operator != (SBType &rhs) { if (IsValid() == false) return rhs.IsValid(); return (rhs.m_opaque_sp->GetASTContext() != m_opaque_sp->GetASTContext()) || (rhs.m_opaque_sp->GetOpaqueQualType() != m_opaque_sp->GetOpaqueQualType()); }
lldb::SBValue SBValue::Cast (SBType type) { lldb::SBValue sb_value; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); TypeImplSP type_sp (type.GetSP()); if (value_sp && type_sp) sb_value.SetSP(value_sp->Cast(type_sp->GetClangASTType()),GetPreferDynamicValue(),GetPreferSyntheticValue()); return sb_value; }
lldb::SBValue SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType type) { lldb::SBValue result; if (m_opaque_sp && type.IsValid() && type.GetPointerType().IsValid()) { SBType real_type(type.GetPointerType()); lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t))); ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (m_opaque_sp->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; ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress); if (ptr_result_valobj_sp) { Error err; result_valobj_sp = ptr_result_valobj_sp->Dereference(err); if (result_valobj_sp) result_valobj_sp->SetName(ConstString(name)); } result = SBValue(result_valobj_sp); } LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (result.IsValid()) log->Printf ("SBValue(%p)::GetChildFromAddress => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString()); else log->Printf ("SBValue(%p)::GetChildFromAddress => NULL", m_opaque_sp.get()); } return result; }
SBType SBValue::GetType() { SBType result; if (m_opaque_sp) { if (m_opaque_sp->GetUpdatePoint().GetTargetSP()) { Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex()); result = SBType(ClangASTType (m_opaque_sp->GetClangAST(), m_opaque_sp->GetClangType())); } } LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (result.IsValid()) log->Printf ("SBValue(%p)::GetType => %p", m_opaque_sp.get(), &result); else log->Printf ("SBValue(%p)::GetType => NULL", m_opaque_sp.get()); } return result; }
lldb::SBValue SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType sb_type) { lldb::SBValue sb_value; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); lldb::ValueObjectSP new_value_sp; lldb::TypeImplSP type_impl_sp (sb_type.GetSP()); if (value_sp && type_impl_sp) { ClangASTType pointee_ast_type(type_impl_sp->GetClangASTType().GetPointerType ()); if (pointee_ast_type) { lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t))); ExecutionContext exe_ctx (value_sp->GetExecutionContextRef()); ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), pointee_ast_type, ConstString(name), buffer, lldb::endian::InlHostByteOrder(), exe_ctx.GetAddressByteSize())); if (ptr_result_valobj_sp) { ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress); Error err; new_value_sp = ptr_result_valobj_sp->Dereference(err); if (new_value_sp) new_value_sp->SetName(ConstString(name)); } sb_value.SetSP(new_value_sp); } } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (new_value_sp) log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString()); else log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL", value_sp.get()); } return sb_value; }
lldb::SBValue SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type) { lldb::SBValue result; if (m_opaque_sp) { if (type.IsValid()) { result = SBValue(m_opaque_sp->GetSyntheticChildAtOffset(offset, type.m_opaque_sp->GetClangASTType(), true)); result.m_opaque_sp->SetName(ConstString(name)); } } LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (result.IsValid()) log->Printf ("SBValue(%p)::GetChildAtOffset => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString()); else log->Printf ("SBValue(%p)::GetChildAtOffset => NULL", m_opaque_sp.get()); } return result; }
void SBTypeList::Append (SBType type) { if (type.IsValid()) m_opaque_ap->Append (type.m_opaque_sp); }
SBTypeNameSpecifier::SBTypeNameSpecifier (SBType type) : m_opaque_sp() { if (type.IsValid()) m_opaque_sp = TypeNameSpecifierImplSP(new TypeNameSpecifierImpl(type.m_opaque_sp->GetClangASTType())); }