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


C++ DWARFCompileUnit::ClearDIEs方法代码示例

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


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

示例1: scoped_timer


//.........这里部分代码省略.........
                    dw_tag_t tag = die->Tag();
                    
                    is_variable = tag == DW_TAG_variable;

                    for (i=0; i<num_attributes; ++i)
                    {
                        dw_attr_t attr = attributes.AttributeAtIndex(i);
                        DWARFFormValue form_value;
                        switch (attr)
                        {
                        case DW_AT_name:
                            if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value))
                                name = form_value.AsCString(debug_str);
                            break;

                        case DW_AT_MIPS_linkage_name:
                            if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value))
                                mangled = form_value.AsCString(debug_str);
                            break;

                        case DW_AT_low_pc:
                        case DW_AT_ranges:
                        case DW_AT_entry_pc:
                            if (tag == DW_TAG_subprogram)
                                add_die = true;
                            break;

                        case DW_AT_location:
                            if (tag == DW_TAG_variable)
                            {
                                const DWARFDebugInfoEntry* parent_die = die->GetParent();
                                while ( parent_die != NULL )
                                {
                                    switch (parent_die->Tag())
                                    {
                                    case DW_TAG_subprogram:
                                    case DW_TAG_lexical_block:
                                    case DW_TAG_inlined_subroutine:
                                        // Even if this is a function level static, we don't add it. We could theoretically
                                        // add these if we wanted to by introspecting into the DW_AT_location and seeing
                                        // if the location describes a hard coded address, but we don't want the performance
                                        // penalty of that right now.
                                        add_die = false;
//                                      if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value))
//                                      {
//                                          // If we have valid block data, then we have location expression bytes
//                                          // that are fixed (not a location list).
//                                          const uint8_t *block_data = form_value.BlockData();
//                                          if (block_data)
//                                          {
//                                              uint32_t block_length = form_value.Unsigned();
//                                              if (block_length == 1 + attributes.CompileUnitAtIndex(i)->GetAddressByteSize())
//                                              {
//                                                  if (block_data[0] == DW_OP_addr)
//                                                      add_die = true;
//                                              }
//                                          }
//                                      }
                                        parent_die = NULL;  // Terminate the while loop.
                                        break;

                                    case DW_TAG_compile_unit:
                                        add_die = true;
                                        parent_die = NULL;  // Terminate the while loop.
                                        break;

                                    default:
                                        parent_die = parent_die->GetParent();   // Keep going in the while loop.
                                        break;
                                    }
                                }
                            }
                            break;
                        }
                    }
                }

                if (add_die && (name || mangled))
                {
                    pubnames_set.AddDescriptor(die->GetOffset() - cu_offset, mangled ? mangled : name);
                }
            }

            if (pubnames_set.NumDescriptors() > 0)
            {
                m_sets.push_back(pubnames_set);
            }
            
            // Keep memory down by clearing DIEs if this generate function
            // caused them to be parsed
            if (clear_dies)
                cu->ClearDIEs (true);
        }
    }
    if (m_sets.empty())
        return false;
    if (log)
        Dump (log.get());
    return true;
}
开发者ID:fbsd,项目名称:old_lldb,代码行数:101,代码来源:DWARFDebugPubnames.cpp


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