本文整理汇总了C++中DWARFUnit::setRangesSection方法的典型用法代码示例。如果您正苦于以下问题:C++ DWARFUnit::setRangesSection方法的具体用法?C++ DWARFUnit::setRangesSection怎么用?C++ DWARFUnit::setRangesSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DWARFUnit
的用法示例。
在下文中一共展示了DWARFUnit::setRangesSection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseDWO
bool DWARFUnit::parseDWO() {
if (DWO.get())
return false;
extractDIEsIfNeeded(true);
if (DieArray.empty())
return false;
const char *DWOFileName =
DieArray[0].getAttributeValueAsString(this, DW_AT_GNU_dwo_name, nullptr);
if (!DWOFileName)
return false;
const char *CompilationDir =
DieArray[0].getAttributeValueAsString(this, DW_AT_comp_dir, nullptr);
SmallString<16> AbsolutePath;
if (sys::path::is_relative(DWOFileName) && CompilationDir != nullptr) {
sys::path::append(AbsolutePath, CompilationDir);
}
sys::path::append(AbsolutePath, DWOFileName);
DWO = llvm::make_unique<DWOHolder>(AbsolutePath);
DWARFUnit *DWOCU = DWO->getUnit();
// Verify that compile unit in .dwo file is valid.
if (!DWOCU || DWOCU->getDWOId() != getDWOId()) {
DWO.reset();
return false;
}
// Share .debug_addr and .debug_ranges section with compile unit in .dwo
DWOCU->setAddrOffsetSection(AddrOffsetSection, AddrOffsetSectionBase);
uint32_t DWORangesBase = DieArray[0].getRangesBaseAttribute(this, 0);
DWOCU->setRangesSection(RangeSection, DWORangesBase);
return true;
}
示例2: parseDWO
bool DWARFUnit::parseDWO() {
if (DWO.get() != 0)
return false;
extractDIEsIfNeeded(true);
if (DieArray.empty())
return false;
const char *DWOFileName =
DieArray[0].getAttributeValueAsString(this, DW_AT_GNU_dwo_name, 0);
if (DWOFileName == 0)
return false;
const char *CompilationDir =
DieArray[0].getAttributeValueAsString(this, DW_AT_comp_dir, 0);
SmallString<16> AbsolutePath;
if (sys::path::is_relative(DWOFileName) && CompilationDir != 0) {
sys::path::append(AbsolutePath, CompilationDir);
}
sys::path::append(AbsolutePath, DWOFileName);
ErrorOr<object::ObjectFile *> DWOFile =
object::ObjectFile::createObjectFile(AbsolutePath);
if (!DWOFile)
return false;
// Reset DWOHolder.
DWO.reset(new DWOHolder(DWOFile.get()));
DWARFUnit *DWOCU = DWO->getUnit();
// Verify that compile unit in .dwo file is valid.
if (DWOCU == 0 || DWOCU->getDWOId() != getDWOId()) {
DWO.reset();
return false;
}
// Share .debug_addr and .debug_ranges section with compile unit in .dwo
DWOCU->setAddrOffsetSection(AddrOffsetSection, AddrOffsetSectionBase);
DWOCU->setRangesSection(RangeSection, RangeSectionBase);
return true;
}