当前位置: 首页>>代码示例>>C++>>正文


C++ DWARFDIE类代码示例

本文整理汇总了C++中DWARFDIE的典型用法代码示例。如果您正苦于以下问题:C++ DWARFDIE类的具体用法?C++ DWARFDIE怎么用?C++ DWARFDIE使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DWARFDIE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ParseBaseTypeFromDIE

TypeSP DWARFASTParserOCaml::ParseBaseTypeFromDIE(const DWARFDIE &die) {
  SymbolFileDWARF *dwarf = die.GetDWARF();
  dwarf->m_die_to_type[die.GetDIE()] = DIE_IS_BEING_PARSED;

  ConstString type_name;
  uint64_t byte_size = 0;

  DWARFAttributes attributes;
  const size_t num_attributes = die.GetAttributes(attributes);
  for (uint32_t i = 0; i < num_attributes; ++i) {
    DWARFFormValue form_value;
    dw_attr_t attr = attributes.AttributeAtIndex(i);
    if (attributes.ExtractFormValueAtIndex(i, form_value)) {
      switch (attr) {
      case DW_AT_name:
        type_name.SetCString(form_value.AsCString());
        break;
      case DW_AT_byte_size:
        byte_size = form_value.Unsigned();
        break;
      case DW_AT_encoding:
        break;
      default:
        assert(false && "Unsupported attribute for DW_TAG_base_type");
      }
    }
  }

  Declaration decl;
  CompilerType compiler_type = m_ast.CreateBaseType(type_name, byte_size);
  return std::make_shared<Type>(die.GetID(), dwarf, type_name, byte_size,
                                nullptr, LLDB_INVALID_UID, Type::eEncodingIsUID,
                                decl, compiler_type, Type::eResolveStateFull);
}
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:34,代码来源:DWARFASTParserOCaml.cpp

示例2: dumpInfo

//----------------------------------------------------------------------
// Dump
//
// Dump the contents of this DWARFDebugInfo object as has been parsed
// and/or modified after it has been parsed.
//----------------------------------------------------------------------
void DWARFDebugInfo::Dump(Stream *s, const uint32_t die_offset,
                          const uint32_t recurse_depth) {
  DumpInfo dumpInfo(s, die_offset, recurse_depth);

  s->PutCString("Dumping .debug_info section from internal representation\n");

  CompileUnitColl::const_iterator pos;
  uint32_t curr_depth = 0;
  ParseCompileUnitHeadersIfNeeded();
  for (pos = m_compile_units.begin(); pos != m_compile_units.end(); ++pos) {
    DWARFCompileUnit *cu = pos->get();
    DumpCallback(m_dwarf2Data, cu, NULL, 0, curr_depth, &dumpInfo);

    const DWARFDIE die = cu->DIE();
    if (die)
      die.Dump(s, recurse_depth);
  }
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:24,代码来源:DWARFDebugInfo.cpp

示例3: Tag

void
DWARFDIE::GetDWOContext (std::vector<CompilerContext> &context) const
{
    const dw_tag_t tag = Tag();
    if (tag == DW_TAG_compile_unit)
        return;
    DWARFDIE parent = GetParent();
    if (parent)
        parent.GetDWOContext(context);
    switch (tag)
    {
        case DW_TAG_module:
            context.push_back(CompilerContext(CompilerContextKind::Module, ConstString(GetName())));
            break;
        case DW_TAG_namespace:
            context.push_back(CompilerContext(CompilerContextKind::Namespace, ConstString(GetName())));
            break;
        case DW_TAG_structure_type:
            context.push_back(CompilerContext(CompilerContextKind::Structure, ConstString(GetName())));
            break;
        case DW_TAG_union_type:
            context.push_back(CompilerContext(CompilerContextKind::Union, ConstString(GetName())));
            break;
        case DW_TAG_class_type:
            context.push_back(CompilerContext(CompilerContextKind::Class, ConstString(GetName())));
            break;
        case DW_TAG_enumeration_type:
            context.push_back(CompilerContext(CompilerContextKind::Enumeration, ConstString(GetName())));
            break;
        case DW_TAG_subprogram:
            context.push_back(CompilerContext(CompilerContextKind::Function, ConstString(GetPubname())));
            break;
        case DW_TAG_variable:
            context.push_back(CompilerContext(CompilerContextKind::Variable, ConstString(GetPubname())));
            break;
        case DW_TAG_typedef:
            context.push_back(CompilerContext(CompilerContextKind::Typedef, ConstString(GetName())));
            break;
        default:
            break;
    }
}
开发者ID:2asoft,项目名称:freebsd,代码行数:42,代码来源:DWARFDIE.cpp

示例4: if

DWARFDIE
DWARFDIE::GetContainingDWOModuleDIE () const
{
    if (IsValid())
    {
        DWARFDIE top_module_die;
        // Now make sure this DIE is scoped in a DW_TAG_module tag and return true if so
        for (DWARFDIE parent = GetParent(); parent.IsValid(); parent = parent.GetParent())
        {
            const dw_tag_t tag = parent.Tag();
            if (tag == DW_TAG_module)
                top_module_die = parent;
            else if (tag == DW_TAG_compile_unit)
                break;
        }

        return top_module_die;
    }
    return DWARFDIE();
}
开发者ID:2asoft,项目名称:freebsd,代码行数:20,代码来源:DWARFDIE.cpp

示例5: type_die_ref

TypeSP
DWARFASTParserJava::ParseReferenceTypeFromDIE(const DWARFDIE &die)
{
    SymbolFileDWARF *dwarf = die.GetDWARF();
    dwarf->m_die_to_type[die.GetDIE()] = DIE_IS_BEING_PARSED;

    Declaration decl;
    DWARFFormValue type_attr_value;

    DWARFAttributes attributes;
    const size_t num_attributes = die.GetAttributes(attributes);
    for (uint32_t i = 0; i < num_attributes; ++i)
    {
        DWARFFormValue form_value;
        dw_attr_t attr = attributes.AttributeAtIndex(i);
        if (attributes.ExtractFormValueAtIndex(i, form_value))
        {
            switch (attr)
            {
                case DW_AT_type:
                    type_attr_value = form_value;
                    break;
                default:
                    assert(false && "Unsupported attribute for DW_TAG_array_type");
            }
        }
    }

    DIERef type_die_ref(type_attr_value);
    Type *pointee_type = dwarf->ResolveTypeUID(type_die_ref);
    if (!pointee_type)
        return nullptr;

    CompilerType pointee_compiler_type = pointee_type->GetForwardCompilerType();
    CompilerType reference_compiler_type = m_ast.CreateReferenceType(pointee_compiler_type);
    TypeSP type_sp(new Type(die.GetID(), dwarf, reference_compiler_type.GetTypeName(), -1, nullptr,
                            type_die_ref.GetUID(dwarf), Type::eEncodingIsUID, &decl,
                            reference_compiler_type, Type::eResolveStateFull));
    type_sp->SetEncodingType(pointee_type);
    return type_sp;
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:41,代码来源:DWARFASTParserJava.cpp

示例6: sc

bool
DWARFASTParserGo::CompleteTypeFromDWARF(const DWARFDIE &die, lldb_private::Type *type, CompilerType &compiler_type)
{
    if (!die)
        return false;

    const dw_tag_t tag = die.Tag();

    SymbolFileDWARF *dwarf = die.GetDWARF();
    Log *log = nullptr; // (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
    if (log)
        dwarf->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
            log, "0x%8.8" PRIx64 ": %s '%s' resolving forward declaration...", dwarf->MakeUserID(die.GetOffset()),
            DW_TAG_value_to_name(tag), type->GetName().AsCString());
    assert(compiler_type);
    DWARFAttributes attributes;

    switch (tag)
    {
        case DW_TAG_structure_type:
        {
            {
                if (die.HasChildren())
                {
                    SymbolContext sc(die.GetLLDBCompileUnit());

                    ParseChildMembers(sc, die, compiler_type);
                }
            }
            m_ast.CompleteStructType(compiler_type);
            return (bool)compiler_type;
        }

        default:
            assert(false && "not a forward go type decl!");
            break;
    }

    return false;
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:40,代码来源:DWARFASTParserGo.cpp

示例7: switch

bool
DWARFASTParserJava::CompleteTypeFromDWARF(const DWARFDIE &die, lldb_private::Type *type,
                                          lldb_private::CompilerType &java_type)
{
    switch (die.Tag())
    {
        case DW_TAG_class_type:
            {
                if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 0)
                {
                    if (die.HasChildren())
                        ParseChildMembers(die, java_type);
                    m_ast.CompleteObjectType(java_type);
                    return java_type.IsValid();
                }
            }
            break;
        default:
            assert(false && "Not a forward java type declaration!");
            break;
    }
    return false;
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:23,代码来源:DWARFASTParserJava.cpp

示例8: switch

void
DWARFASTParserGo::ParseChildArrayInfo(const SymbolContext &sc, const DWARFDIE &parent_die, int64_t &first_index,
                                      std::vector<uint64_t> &element_orders, uint32_t &byte_stride,
                                      uint32_t &bit_stride)
{
    if (!parent_die)
        return;

    for (DWARFDIE die = parent_die.GetFirstChild(); die.IsValid(); die = die.GetSibling())
    {
        const dw_tag_t tag = die.Tag();
        switch (tag)
        {
            case DW_TAG_subrange_type:
            {
                DWARFAttributes attributes;
                const size_t num_child_attributes = die.GetAttributes(attributes);
                if (num_child_attributes > 0)
                {
                    uint64_t num_elements = 0;
                    uint32_t i;
                    for (i = 0; i < num_child_attributes; ++i)
                    {
                        const dw_attr_t attr = attributes.AttributeAtIndex(i);
                        DWARFFormValue form_value;
                        if (attributes.ExtractFormValueAtIndex(i, form_value))
                        {
                            switch (attr)
                            {
                                case DW_AT_count:
                                    num_elements = form_value.Unsigned();
                                    break;

                                default:
                                case DW_AT_type:
                                    break;
                            }
                        }
                    }

                    element_orders.push_back(num_elements);
                }
            }
            break;
        }
    }
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:47,代码来源:DWARFASTParserGo.cpp

示例9: GetCompileUnit

//----------------------------------------------------------------------
// LookupAddress
//----------------------------------------------------------------------
DWARFDIE
DWARFDebugInfo::LookupAddress (const dw_addr_t address,
                               const dw_offset_t hint_die_offset)
{
    DWARFDIE die;
    DWARFCompileUnit *cu = nullptr;
    if (hint_die_offset != DW_INVALID_OFFSET)
    {
        cu = GetCompileUnit(hint_die_offset);
    }
    else
    {
        DWARFDebugAranges &cu_aranges = GetCompileUnitAranges ();
        const dw_offset_t cu_offset = cu_aranges.FindAddress (address);
        cu = GetCompileUnit(cu_offset);
    }

    if (cu)
    {
        die = cu->LookupAddress(address);
    }
    else
    {
        // The hint_die_offset may have been a pointer to the actual item that
        // we are looking for
        die = GetDIE(hint_die_offset);
        if (die)
        {
            DWARFDebugInfoEntry* function_die = nullptr;

            if (die.GetDIE()->LookupAddress (address, die.GetDWARF(), die.GetCU(), &function_die, nullptr))
                die.Set (die.GetCU(), function_die);
        }
    }
    return die;
}
开发者ID:JuliaLang,项目名称:lldb,代码行数:39,代码来源:DWARFDebugInfo.cpp

示例10: initialValue

size_t
DWARFASTParserGo::ParseChildMembers(const SymbolContext &sc, const DWARFDIE &parent_die, CompilerType &class_compiler_type)
{
    size_t count = 0;
    uint32_t member_idx = 0;

    ModuleSP module_sp = parent_die.GetDWARF()->GetObjectFile()->GetModule();
    GoASTContext *ast = llvm::dyn_cast_or_null<GoASTContext>(class_compiler_type.GetTypeSystem());
    if (ast == nullptr)
        return 0;

    for (DWARFDIE die = parent_die.GetFirstChild(); die.IsValid(); die = die.GetSibling())
    {
        dw_tag_t tag = die.Tag();

        switch (tag)
        {
            case DW_TAG_member:
            {
                DWARFAttributes attributes;
                const size_t num_attributes = die.GetAttributes(attributes);
                if (num_attributes > 0)
                {
                    Declaration decl;
                    const char *name = NULL;

                    lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
                    uint32_t member_byte_offset = UINT32_MAX;
                    uint32_t i;
                    for (i = 0; i < num_attributes; ++i)
                    {
                        const dw_attr_t attr = attributes.AttributeAtIndex(i);
                        DWARFFormValue form_value;
                        if (attributes.ExtractFormValueAtIndex(i, form_value))
                        {
                            switch (attr)
                            {
                                case DW_AT_name:
                                    name = form_value.AsCString();
                                    break;
                                case DW_AT_type:
                                    encoding_uid = form_value.Reference();
                                    break;
                                case DW_AT_data_member_location:
                                    if (form_value.BlockData())
                                    {
                                        Value initialValue(0);
                                        Value memberOffset(0);
                                        const DWARFDataExtractor &debug_info_data =
                                            die.GetDWARF()->get_debug_info_data();
                                        uint32_t block_length = form_value.Unsigned();
                                        uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
                                        if (DWARFExpression::Evaluate(NULL, // ExecutionContext *
                                                                      NULL, // ClangExpressionVariableList *
                                                                      NULL, // ClangExpressionDeclMap *
                                                                      NULL, // RegisterContext *
                                                                      module_sp, debug_info_data, die.GetCU(),
                                                                      block_offset, block_length, eRegisterKindDWARF,
                                                                      &initialValue, NULL, memberOffset, NULL))
                                        {
                                            member_byte_offset = memberOffset.ResolveValue(NULL).UInt();
                                        }
                                    }
                                    else
                                    {
                                        // With DWARF 3 and later, if the value is an integer constant,
                                        // this form value is the offset in bytes from the beginning
                                        // of the containing entity.
                                        member_byte_offset = form_value.Unsigned();
                                    }
                                    break;

                                default:
                                    break;
                            }
                        }
                    }

                    Type *member_type = die.ResolveTypeUID(encoding_uid);
                    if (member_type)
                    {
                        CompilerType member_go_type = member_type->GetFullCompilerType();
                        ConstString name_const_str(name);
                        m_ast.AddFieldToStruct(class_compiler_type, name_const_str, member_go_type, member_byte_offset);
                    }
                }
                ++member_idx;
            }
            break;

            default:
                break;
        }
    }

    return count;
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:97,代码来源:DWARFASTParserGo.cpp

示例11: DW_TAG_value_to_name

TypeSP
DWARFASTParserGo::ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, const DWARFDIE &die, lldb_private::Log *log,
                                     bool *type_is_new_ptr)
{
    TypeSP type_sp;

    if (type_is_new_ptr)
        *type_is_new_ptr = false;

    if (die)
    {
        SymbolFileDWARF *dwarf = die.GetDWARF();
        if (log)
        {
            dwarf->GetObjectFile()->GetModule()->LogMessage(
                log, "DWARFASTParserGo::ParseTypeFromDWARF (die = 0x%8.8x) %s name = '%s')", die.GetOffset(),
                DW_TAG_value_to_name(die.Tag()), die.GetName());
        }

        Type *type_ptr = dwarf->m_die_to_type.lookup(die.GetDIE());
        TypeList *type_list = dwarf->GetTypeList();
        if (type_ptr == NULL)
        {
            if (type_is_new_ptr)
                *type_is_new_ptr = true;

            const dw_tag_t tag = die.Tag();

            bool is_forward_declaration = false;
            DWARFAttributes attributes;
            const char *type_name_cstr = NULL;
            ConstString type_name_const_str;
            Type::ResolveState resolve_state = Type::eResolveStateUnresolved;
            uint64_t byte_size = 0;
            uint64_t go_kind = 0;
            Declaration decl;

            Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
            CompilerType compiler_type;
            DWARFFormValue form_value;

            dw_attr_t attr;

            switch (tag)
            {
                case DW_TAG_base_type:
                case DW_TAG_pointer_type:
                case DW_TAG_typedef:
                case DW_TAG_unspecified_type:
                {
                    // Set a bit that lets us know that we are currently parsing this
                    dwarf->m_die_to_type[die.GetDIE()] = DIE_IS_BEING_PARSED;

                    const size_t num_attributes = die.GetAttributes(attributes);
                    lldb::user_id_t encoding_uid = LLDB_INVALID_UID;

                    if (num_attributes > 0)
                    {
                        uint32_t i;
                        for (i = 0; i < num_attributes; ++i)
                        {
                            attr = attributes.AttributeAtIndex(i);
                            if (attributes.ExtractFormValueAtIndex(i, form_value))
                            {
                                switch (attr)
                                {
                                    case DW_AT_name:
                                        type_name_cstr = form_value.AsCString();
                                        if (type_name_cstr)
                                            type_name_const_str.SetCString(type_name_cstr);
                                        break;
                                    case DW_AT_byte_size:
                                        byte_size = form_value.Unsigned();
                                        break;
                                    case DW_AT_encoding:
                                        // = form_value.Unsigned();
                                        break;
                                    case DW_AT_type:
                                        encoding_uid = form_value.Reference();
                                        break;
                                    case DW_AT_go_kind:
                                        go_kind = form_value.Unsigned();
                                        break;
                                    default:
                                        // Do we care about DW_AT_go_key or DW_AT_go_elem?
                                        break;
                                }
                            }
                        }
                    }

                    DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\") type => 0x%8.8lx\n", dwarf->MakeUserID(die.GetOffset()),
                                 DW_TAG_value_to_name(tag), type_name_cstr, encoding_uid);

                    switch (tag)
                    {
                        default:
                            break;

                        case DW_TAG_unspecified_type:
//.........这里部分代码省略.........
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:101,代码来源:DWARFASTParserGo.cpp

示例12: length_expression

TypeSP
DWARFASTParserJava::ParseArrayTypeFromDIE(const DWARFDIE &die)
{
    SymbolFileDWARF *dwarf = die.GetDWARF();
    dwarf->m_die_to_type[die.GetDIE()] = DIE_IS_BEING_PARSED;

    ConstString linkage_name;
    DWARFFormValue type_attr_value;
    lldb::addr_t data_offset = LLDB_INVALID_ADDRESS;
    DWARFExpression length_expression(die.GetCU());

    DWARFAttributes attributes;
    const size_t num_attributes = die.GetAttributes(attributes);
    for (uint32_t i = 0; i < num_attributes; ++i)
    {
        DWARFFormValue form_value;
        dw_attr_t attr = attributes.AttributeAtIndex(i);
        if (attributes.ExtractFormValueAtIndex(i, form_value))
        {
            switch (attr)
            {
                case DW_AT_linkage_name:
                    linkage_name.SetCString(form_value.AsCString());
                    break;
                case DW_AT_type:
                    type_attr_value = form_value;
                    break;
                case DW_AT_data_member_location:
                    data_offset = form_value.Unsigned();
                    break;
                case DW_AT_declaration:
                    break;
                default:
                    assert(false && "Unsupported attribute for DW_TAG_array_type");
            }
        }
    }

    for (DWARFDIE child_die = die.GetFirstChild(); child_die.IsValid(); child_die = child_die.GetSibling())
    {
        if (child_die.Tag() == DW_TAG_subrange_type)
        {
            DWARFAttributes attributes;
            const size_t num_attributes = child_die.GetAttributes(attributes);
            for (uint32_t i = 0; i < num_attributes; ++i)
            {
                DWARFFormValue form_value;
                dw_attr_t attr = attributes.AttributeAtIndex(i);
                if (attributes.ExtractFormValueAtIndex(i, form_value))
                {
                    switch (attr)
                    {
                        case DW_AT_count:
                            if (form_value.BlockData())
                                length_expression.CopyOpcodeData(form_value.BlockData(), form_value.Unsigned(),
                                                                 child_die.GetCU()->GetByteOrder(),
                                                                 child_die.GetCU()->GetAddressByteSize());
                            break;
                        default:
                            assert(false && "Unsupported attribute for DW_TAG_subrange_type");
                    }
                }
            }
        }
        else
        {
            assert(false && "Unsupported child for DW_TAG_array_type");
        }
    }

    DIERef type_die_ref(type_attr_value);
    Type *element_type = dwarf->ResolveTypeUID(type_die_ref);
    if (!element_type)
        return nullptr;

    CompilerType element_compiler_type = element_type->GetForwardCompilerType();
    CompilerType array_compiler_type =
        m_ast.CreateArrayType(element_compiler_type, length_expression, data_offset);

    Declaration decl;
    TypeSP type_sp(new Type(die.GetID(), dwarf, array_compiler_type.GetTypeName(), -1, nullptr,
                            type_die_ref.GetUID(dwarf), Type::eEncodingIsUID, &decl,
                            array_compiler_type, Type::eResolveStateFull));
    type_sp->SetEncodingType(element_type);
    return type_sp;
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:86,代码来源:DWARFASTParserJava.cpp

示例13: member_location_expression

void
DWARFASTParserJava::ParseChildMembers(const DWARFDIE &parent_die, CompilerType &compiler_type)
{
    DWARFCompileUnit *dwarf_cu = parent_die.GetCU();
    for (DWARFDIE die = parent_die.GetFirstChild(); die.IsValid(); die = die.GetSibling())
    {
        switch (die.Tag())
        {
            case DW_TAG_member:
            {
                const char *name = nullptr;
                DWARFFormValue encoding_uid;
                uint32_t member_byte_offset = UINT32_MAX;
                DWARFExpression member_location_expression(dwarf_cu);
                bool artificial = true;

                DWARFAttributes attributes;
                size_t num_attributes = die.GetAttributes(attributes);
                for (size_t i = 0; i < num_attributes; ++i)
                {
                    DWARFFormValue form_value;
                    if (attributes.ExtractFormValueAtIndex(i, form_value))
                    {
                        switch (attributes.AttributeAtIndex(i))
                        {
                            case DW_AT_name:
                                name = form_value.AsCString();
                                break;
                            case DW_AT_type:
                                encoding_uid = form_value;
                                break;
                            case DW_AT_data_member_location:
                                if (form_value.BlockData())
                                    member_location_expression.CopyOpcodeData(
                                        form_value.BlockData(), form_value.Unsigned(), dwarf_cu->GetByteOrder(),
                                        dwarf_cu->GetAddressByteSize());
                                else
                                    member_byte_offset = form_value.Unsigned();
                                break;
                            case DW_AT_artificial:
                                artificial = form_value.Boolean();
                                break;
                            case DW_AT_accessibility:
                                // TODO: Handle when needed
                                break;
                            default:
                                assert(false && "Unhandled attribute for DW_TAG_member");
                                break;
                        }
                    }
                }

                if (strcmp(name, ".dynamic_type") == 0)
                    m_ast.SetDynamicTypeId(compiler_type, member_location_expression);
                else
                {
                    if (Type *member_type = die.ResolveTypeUID(DIERef(encoding_uid)))
                        m_ast.AddMemberToObject(compiler_type, ConstString(name), member_type->GetFullCompilerType(),
                                                member_byte_offset);
                }
                break;
            }
            case DW_TAG_inheritance:
            {
                DWARFFormValue encoding_uid;
                uint32_t member_byte_offset = UINT32_MAX;

                DWARFAttributes attributes;
                size_t num_attributes = die.GetAttributes(attributes);
                for (size_t i = 0; i < num_attributes; ++i)
                {
                    DWARFFormValue form_value;
                    if (attributes.ExtractFormValueAtIndex(i, form_value))
                    {
                        switch (attributes.AttributeAtIndex(i))
                        {
                            case DW_AT_type:
                                encoding_uid = form_value;
                                break;
                            case DW_AT_data_member_location:
                                member_byte_offset = form_value.Unsigned();
                                break;
                            case DW_AT_accessibility:
                                // In java all base class is public so we can ignore this attribute
                                break;
                            default:
                                assert(false && "Unhandled attribute for DW_TAG_member");
                                break;
                        }
                    }
                }
                if (Type *base_type = die.ResolveTypeUID(DIERef(encoding_uid)))
                    m_ast.AddBaseClassToObject(compiler_type, base_type->GetFullCompilerType(), member_byte_offset);
                break;
            }
            default:
                break;
        }
    }
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:100,代码来源:DWARFASTParserJava.cpp

示例14: compiler_type

lldb::TypeSP
DWARFASTParserJava::ParseClassTypeFromDIE(const DWARFDIE &die, bool &is_new_type)
{
    SymbolFileDWARF *dwarf = die.GetDWARF();
    dwarf->m_die_to_type[die.GetDIE()] = DIE_IS_BEING_PARSED;

    Declaration decl;
    ConstString name;
    ConstString linkage_name;
    bool is_forward_declaration = false;
    uint32_t byte_size = 0;

    DWARFAttributes attributes;
    const size_t num_attributes = die.GetAttributes(attributes);
    for (uint32_t i = 0; i < num_attributes; ++i)
    {
        DWARFFormValue form_value;
        dw_attr_t attr = attributes.AttributeAtIndex(i);
        if (attributes.ExtractFormValueAtIndex(i, form_value))
        {
            switch (attr)
            {
                case DW_AT_name:
                    name.SetCString(form_value.AsCString());
                    break;
                case DW_AT_declaration:
                    is_forward_declaration = form_value.Boolean();
                    break;
                case DW_AT_byte_size:
                    byte_size = form_value.Unsigned();
                    break;
                case DW_AT_linkage_name:
                    linkage_name.SetCString(form_value.AsCString());
                    break;
                default:
                    assert(false && "Unsupported attribute for DW_TAG_class_type");
            }
        }
    }

    UniqueDWARFASTType unique_ast_entry;
    if (name)
    {
        std::string qualified_name;
        if (die.GetQualifiedName(qualified_name))
        {
            name.SetCString(qualified_name.c_str());
            if (dwarf->GetUniqueDWARFASTTypeMap().Find(name, die, Declaration(), -1, unique_ast_entry))
            {
                if (unique_ast_entry.m_type_sp)
                {
                    dwarf->GetDIEToType()[die.GetDIE()] = unique_ast_entry.m_type_sp.get();
                    is_new_type = false;
                    return unique_ast_entry.m_type_sp;
                }
            }
        }
    }

    if (is_forward_declaration)
    {
        DWARFDeclContext die_decl_ctx;
        die.GetDWARFDeclContext(die_decl_ctx);

        TypeSP type_sp = dwarf->FindDefinitionTypeForDWARFDeclContext(die_decl_ctx);
        if (type_sp)
        {
            // We found a real definition for this type elsewhere so lets use it
            dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
            is_new_type = false;
            return type_sp;
        }
    }

    CompilerType compiler_type(&m_ast, dwarf->GetForwardDeclDieToClangType().lookup(die.GetDIE()));
    if (!compiler_type)
        compiler_type = m_ast.CreateObjectType(name, linkage_name, byte_size);

    is_new_type = true;
    TypeSP type_sp(new Type(die.GetID(), dwarf, name,
                            -1, // byte size isn't specified
                            nullptr, LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, compiler_type,
                            Type::eResolveStateForward));

    // Add our type to the unique type map
    unique_ast_entry.m_type_sp = type_sp;
    unique_ast_entry.m_die = die;
    unique_ast_entry.m_declaration = decl;
    unique_ast_entry.m_byte_size = -1;
    dwarf->GetUniqueDWARFASTTypeMap().Insert(name, unique_ast_entry);

    if (!is_forward_declaration)
    {
        // Leave this as a forward declaration until we need to know the details of the type
        dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] = compiler_type.GetOpaqueQualType();
        dwarf->GetForwardDeclClangTypeToDie()[compiler_type.GetOpaqueQualType()] = die.GetDIERef();
    }
    return type_sp;
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:99,代码来源:DWARFASTParserJava.cpp

示例15:

bool operator != (const DWARFDIE &lhs, const DWARFDIE &rhs)
{
    return lhs.GetDIE() != rhs.GetDIE() || lhs.GetCU() != rhs.GetCU();
}
开发者ID:k06a,项目名称:lldb,代码行数:4,代码来源:DWARFDIE.cpp


注:本文中的DWARFDIE类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。