本文整理汇总了C++中DWARFDie::getSibling方法的典型用法代码示例。如果您正苦于以下问题:C++ DWARFDie::getSibling方法的具体用法?C++ DWARFDie::getSibling怎么用?C++ DWARFDie::getSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DWARFDie
的用法示例。
在下文中一共展示了DWARFDie::getSibling方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getInlinedChainForAddress
void DWARFDie::getInlinedChainForAddress(
const uint64_t Address, SmallVectorImpl<DWARFDie> &InlinedChain) const {
if (isNULL())
return;
DWARFDie DIE(*this);
while (DIE) {
// Append current DIE to inlined chain only if it has correct tag
// (e.g. it is not a lexical block).
if (DIE.isSubroutineDIE())
InlinedChain.push_back(DIE);
// Try to get child which also contains provided address.
DWARFDie Child = DIE.getFirstChild();
while (Child) {
if (Child.addressRangeContainsAddress(Address)) {
// Assume there is only one such child.
break;
}
Child = Child.getSibling();
}
DIE = Child;
}
// Reverse the obtained chain to make the root of inlined chain last.
std::reverse(InlinedChain.begin(), InlinedChain.end());
}
示例2: updateAddressDieMap
void DWARFUnit::updateAddressDieMap(DWARFDie Die) {
if (Die.isSubroutineDIE()) {
auto DIERangesOrError = Die.getAddressRanges();
if (DIERangesOrError) {
for (const auto &R : DIERangesOrError.get()) {
// Ignore 0-sized ranges.
if (R.LowPC == R.HighPC)
continue;
auto B = AddrDieMap.upper_bound(R.LowPC);
if (B != AddrDieMap.begin() && R.LowPC < (--B)->second.first) {
// The range is a sub-range of existing ranges, we need to split the
// existing range.
if (R.HighPC < B->second.first)
AddrDieMap[R.HighPC] = B->second;
if (R.LowPC > B->first)
AddrDieMap[B->first].first = R.LowPC;
}
AddrDieMap[R.LowPC] = std::make_pair(R.HighPC, Die);
}
} else
llvm::consumeError(DIERangesOrError.takeError());
}
// Parent DIEs are added to the AddrDieMap prior to the Children DIEs to
// simplify the logic to update AddrDieMap. The child's range will always
// be equal or smaller than the parent's range. With this assumption, when
// adding one range into the map, it will at most split a range into 3
// sub-ranges.
for (DWARFDie Child = Die.getFirstChild(); Child; Child = Child.getSibling())
updateAddressDieMap(Child);
}
示例3: dump
void DWARFDie::dump(raw_ostream &OS, unsigned RecurseDepth,
unsigned Indent) const {
if (!isValid())
return;
DataExtractor debug_info_data = U->getDebugInfoExtractor();
const uint32_t Offset = getOffset();
uint32_t offset = Offset;
if (debug_info_data.isValidOffset(offset)) {
uint32_t abbrCode = debug_info_data.getULEB128(&offset);
WithColor(OS, syntax::Address).get() << format("\n0x%8.8x: ", Offset);
if (abbrCode) {
auto AbbrevDecl = getAbbreviationDeclarationPtr();
if (AbbrevDecl) {
auto tagString = TagString(getTag());
if (!tagString.empty())
WithColor(OS, syntax::Tag).get().indent(Indent) << tagString;
else
WithColor(OS, syntax::Tag).get().indent(Indent)
<< format("DW_TAG_Unknown_%x", getTag());
OS << format(" [%u] %c\n", abbrCode,
AbbrevDecl->hasChildren() ? '*' : ' ');
// Dump all data in the DIE for the attributes.
for (const auto &AttrSpec : AbbrevDecl->attributes()) {
if (AttrSpec.Form == DW_FORM_implicit_const) {
// We are dumping .debug_info section ,
// implicit_const attribute values are not really stored here,
// but in .debug_abbrev section. So we just skip such attrs.
continue;
}
dumpAttribute(OS, *this, &offset, AttrSpec.Attr, AttrSpec.Form,
Indent);
}
DWARFDie child = getFirstChild();
if (RecurseDepth > 0 && child) {
while (child) {
child.dump(OS, RecurseDepth-1, Indent+2);
child = child.getSibling();
}
}
} else {
OS << "Abbreviation code not found in 'debug_abbrev' class for code: "
<< abbrCode << '\n';
}
} else {
OS.indent(Indent) << "NULL\n";
}
}
}
示例4: dump
void DWARFDie::dump(raw_ostream &OS, unsigned Indent,
DIDumpOptions DumpOpts) const {
if (!isValid())
return;
DWARFDataExtractor debug_info_data = U->getDebugInfoExtractor();
const uint32_t Offset = getOffset();
uint32_t offset = Offset;
if (DumpOpts.ShowParents) {
DIDumpOptions ParentDumpOpts = DumpOpts;
ParentDumpOpts.ShowParents = false;
ParentDumpOpts.ShowChildren = false;
Indent = dumpParentChain(getParent(), OS, Indent, ParentDumpOpts);
}
if (debug_info_data.isValidOffset(offset)) {
uint32_t abbrCode = debug_info_data.getULEB128(&offset);
if (DumpOpts.ShowAddresses)
WithColor(OS, HighlightColor::Address).get()
<< format("\n0x%8.8x: ", Offset);
if (abbrCode) {
auto AbbrevDecl = getAbbreviationDeclarationPtr();
if (AbbrevDecl) {
WithColor(OS, HighlightColor::Tag).get().indent(Indent)
<< formatv("{0}", getTag());
if (DumpOpts.Verbose)
OS << format(" [%u] %c", abbrCode,
AbbrevDecl->hasChildren() ? '*' : ' ');
OS << '\n';
// Dump all data in the DIE for the attributes.
for (const auto &AttrSpec : AbbrevDecl->attributes()) {
if (AttrSpec.Form == DW_FORM_implicit_const) {
// We are dumping .debug_info section ,
// implicit_const attribute values are not really stored here,
// but in .debug_abbrev section. So we just skip such attrs.
continue;
}
dumpAttribute(OS, *this, &offset, AttrSpec.Attr, AttrSpec.Form,
Indent, DumpOpts);
}
DWARFDie child = getFirstChild();
if (DumpOpts.ShowChildren && DumpOpts.RecurseDepth > 0 && child) {
DumpOpts.RecurseDepth--;
DIDumpOptions ChildDumpOpts = DumpOpts;
ChildDumpOpts.ShowParents = false;
while (child) {
child.dump(OS, Indent + 2, ChildDumpOpts);
child = child.getSibling();
}
}
} else {
OS << "Abbreviation code not found in 'debug_abbrev' class for code: "
<< abbrCode << '\n';
}
} else {
OS.indent(Indent) << "NULL\n";
}
}
}