本文整理汇总了C++中SgAsmGenericSection::get_mapped_actual_va方法的典型用法代码示例。如果您正苦于以下问题:C++ SgAsmGenericSection::get_mapped_actual_va方法的具体用法?C++ SgAsmGenericSection::get_mapped_actual_va怎么用?C++ SgAsmGenericSection::get_mapped_actual_va使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgAsmGenericSection
的用法示例。
在下文中一共展示了SgAsmGenericSection::get_mapped_actual_va方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
SgAsmGenericSection *
SgAsmGenericFile::best_section_by_va(const SgAsmGenericSectionPtrList §ions, rose_addr_t va)
{
SgAsmGenericSection *best = NULL;
rose_addr_t file_offset = 0;
for (SgAsmGenericSectionPtrList::const_iterator si=sections.begin(); si!=sections.end(); ++si) {
SgAsmGenericSection *section = *si;
if (!section->is_mapped() || va<section->get_mapped_actual_va() ||
va>=section->get_mapped_actual_va()+section->get_mapped_size()) {
// section does not contain virtual address
} else if (!best) {
best = section;
file_offset = section->get_offset() + (va - section->get_mapped_actual_va());
} else if (file_offset != section->get_offset() + (va - section->get_mapped_actual_va())) {
return NULL; // error
} else if (best->get_mapped_size() > section->get_mapped_size()) {
best = section;
} else if (best->get_name()->get_string().empty() && !section->get_name()->get_string().empty()) {
best = section;
} else {
// prefer section defined earlier
}
}
return best;
}
示例2: SgAsmGenericSectionPtrList
/** Returns sections having a preferred or actual mapping that includes the specified virtual address. If @p use_preferred is
* set, then the condition is evaluated by looking at the section's preferred mapping, otherwise the actual mapping is used.
* If an actual mapping is used, the specified virtual address must be part of the actual mapped section, not merely in the
* memory region that was also mapped to satisfy alignment constraints. */
SgAsmGenericSectionPtrList
SgAsmGenericHeader::get_sections_by_va(rose_addr_t va, bool use_preferred) const
{
if (use_preferred) {
if (va < get_base_va())
return SgAsmGenericSectionPtrList();
rose_addr_t rva = va - get_base_va();
return get_sections_by_rva(rva);
}
SgAsmGenericSectionPtrList retval;
for (size_t i=0; i<p_sections->get_sections().size(); i++) {
SgAsmGenericSection *section = p_sections->get_sections()[i];
if (section->is_mapped() &&
va>=section->get_mapped_actual_va() && va<section->get_mapped_actual_va()+section->get_mapped_size())
retval.push_back(section);
}
return retval;
}
示例3: isSgAsmFunction
/** Returns the base address of an addressable IR node. */
uint64_t
SgAsmIntegerValueExpression::virtualAddress(SgNode *node)
{
if (!node)
return 0;
if (isSgAsmFunction(node))
return isSgAsmFunction(node)->get_entry_va();
if (isSgAsmStatement(node)) // instructions, block, function, staticdata, ...
return isSgAsmStatement(node)->get_address();
if (isSgAsmGenericSymbol(node))
return isSgAsmGenericSymbol(node)->get_value();
if (isSgAsmPEImportItem(node))
return isSgAsmPEImportItem(node)->get_bound_rva().get_va();
if (isSgAsmPERVASizePair(node))
return isSgAsmPERVASizePair(node)->get_e_rva().get_va();
if (isSgAsmGenericSection(node)) {
SgAsmGenericSection *section = isSgAsmGenericSection(node);
if (section->is_mapped())
return section->get_mapped_actual_va();
return 0;
}
ASSERT_not_reachable("need addressable node type, got " + stringifyVariantT(node->variantT(), "V_"));
}