本文整理汇总了C++中Address::GetModule方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::GetModule方法的具体用法?C++ Address::GetModule怎么用?C++ Address::GetModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::GetModule方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lhs_module_sp
bool lldb_private::operator>(const Address &lhs, const Address &rhs) {
ModuleSP lhs_module_sp(lhs.GetModule());
ModuleSP rhs_module_sp(rhs.GetModule());
Module *lhs_module = lhs_module_sp.get();
Module *rhs_module = rhs_module_sp.get();
if (lhs_module == rhs_module) {
// Addresses are in the same module, just compare the file addresses
return lhs.GetFileAddress() > rhs.GetFileAddress();
} else {
// The addresses are from different modules, just use the module
// pointer value to get consistent ordering
return lhs_module > rhs_module;
}
}
示例2: CalculateSymbolContext
bool
Variable::LocationIsValidForAddress (const Address &address)
{
// Be sure to resolve the address to section offset prior to
// calling this function.
if (address.IsSectionOffset())
{
SymbolContext sc;
CalculateSymbolContext(&sc);
if (sc.module_sp == address.GetModule())
{
// Is the variable is described by a single location?
if (!m_location.IsLocationList())
{
// Yes it is, the location is valid.
return true;
}
if (sc.function)
{
addr_t loclist_base_file_addr = sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
if (loclist_base_file_addr == LLDB_INVALID_ADDRESS)
return false;
// It is a location list. We just need to tell if the location
// list contains the current address when converted to a load
// address
return m_location.LocationListContainsAddress (loclist_base_file_addr,
address.GetFileAddress());
}
}
}
return false;
}
示例3: module_sp
uint32_t
ModuleList::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) const
{
// The address is already section offset so it has a module
uint32_t resolved_flags = 0;
ModuleSP module_sp (so_addr.GetModule());
if (module_sp)
{
resolved_flags = module_sp->ResolveSymbolContextForAddress (so_addr,
resolve_scope,
sc);
}
else
{
Mutex::Locker locker(m_modules_mutex);
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
resolved_flags = (*pos)->ResolveSymbolContextForAddress (so_addr,
resolve_scope,
sc);
if (resolved_flags != 0)
break;
}
}
return resolved_flags;
}
示例4: target_sp
static bool
GetByteOrderAndAddressSize (ExecutionContextScope *exe_scope, const Address &address, ByteOrder& byte_order, uint32_t& addr_size)
{
byte_order = eByteOrderInvalid;
addr_size = 0;
if (exe_scope == NULL)
return false;
TargetSP target_sp (exe_scope->CalculateTarget());
if (target_sp)
{
byte_order = target_sp->GetArchitecture().GetByteOrder();
addr_size = target_sp->GetArchitecture().GetAddressByteSize();
}
if (byte_order == eByteOrderInvalid || addr_size == 0)
{
ModuleSP module_sp (address.GetModule());
if (module_sp)
{
byte_order = module_sp->GetArchitecture().GetByteOrder();
addr_size = module_sp->GetArchitecture().GetAddressByteSize();
}
}
return byte_order != eByteOrderInvalid && addr_size != 0;
}
示例5: CompareModulePointerAndOffset
int Address::CompareModulePointerAndOffset(const Address &a, const Address &b) {
ModuleSP a_module_sp(a.GetModule());
ModuleSP b_module_sp(b.GetModule());
Module *a_module = a_module_sp.get();
Module *b_module = b_module_sp.get();
if (a_module < b_module)
return -1;
if (a_module > b_module)
return +1;
// Modules are the same, just compare the file address since they should
// be unique
addr_t a_file_addr = a.GetFileAddress();
addr_t b_file_addr = b.GetFileAddress();
if (a_file_addr < b_file_addr)
return -1;
if (a_file_addr > b_file_addr)
return +1;
return 0;
}
示例6: FDEToUnwindPlan
bool
DWARFCallFrameInfo::GetUnwindPlan (Address addr, UnwindPlan& unwind_plan)
{
FDEEntryMap::Entry fde_entry;
// Make sure that the Address we're searching for is the same object file
// as this DWARFCallFrameInfo, we only store File offsets in m_fde_index.
ModuleSP module_sp = addr.GetModule();
if (module_sp.get() == nullptr || module_sp->GetObjectFile() == nullptr || module_sp->GetObjectFile() != &m_objfile)
return false;
if (GetFDEEntryByFileAddress (addr.GetFileAddress(), fde_entry) == false)
return false;
return FDEToUnwindPlan (fde_entry.data, addr, unwind_plan);
}
示例7: module_sp
bool
Variable::DumpLocationForAddress (Stream *s, const Address &address)
{
// Be sure to resolve the address to section offset prior to
// calling this function.
if (address.IsSectionOffset())
{
SymbolContext sc;
CalculateSymbolContext(&sc);
if (sc.module_sp == address.GetModule())
{
ABI *abi = nullptr;
if (m_owner_scope)
{
ModuleSP module_sp (m_owner_scope->CalculateSymbolContextModule());
if (module_sp)
abi = ABI::FindPlugin (module_sp->GetArchitecture()).get();
}
const addr_t file_addr = address.GetFileAddress();
if (sc.function)
{
if (sc.function->GetAddressRange().ContainsFileAddress(address))
{
addr_t loclist_base_file_addr = sc.function->GetAddressRange().GetBaseAddress().GetFileAddress();
if (loclist_base_file_addr == LLDB_INVALID_ADDRESS)
return false;
return m_location.DumpLocationForAddress (s,
eDescriptionLevelBrief,
loclist_base_file_addr,
file_addr,
abi);
}
}
return m_location.DumpLocationForAddress (s,
eDescriptionLevelBrief,
LLDB_INVALID_ADDRESS,
file_addr,
abi);
}
}
return false;
}
示例8: GetFDEIndex
bool
DWARFCallFrameInfo::GetAddressRange (Address addr, AddressRange &range)
{
// Make sure that the Address we're searching for is the same object file
// as this DWARFCallFrameInfo, we only store File offsets in m_fde_index.
ModuleSP module_sp = addr.GetModule();
if (module_sp.get() == nullptr || module_sp->GetObjectFile() == nullptr || module_sp->GetObjectFile() != &m_objfile)
return false;
if (m_section_sp.get() == nullptr || m_section_sp->IsEncrypted())
return false;
GetFDEIndex();
FDEEntryMap::Entry *fde_entry = m_fde_index.FindEntryThatContains (addr.GetFileAddress());
if (!fde_entry)
return false;
range = AddressRange(fde_entry->base, fde_entry->size, m_objfile.GetSectionList());
return true;
}
示例9: module_sp
static bool
ReadAddress (ExecutionContextScope *exe_scope, const Address &address, uint32_t pointer_size, Address &deref_so_addr)
{
if (exe_scope == NULL)
return false;
bool success = false;
addr_t deref_addr = ReadUIntMax64 (exe_scope, address, pointer_size, success);
if (success)
{
ExecutionContext exe_ctx;
exe_scope->CalculateExecutionContext(exe_ctx);
// If we have any sections that are loaded, try and resolve using the
// section load list
Target *target = exe_ctx.GetTargetPtr();
if (target && !target->GetSectionLoadList().IsEmpty())
{
if (target->GetSectionLoadList().ResolveLoadAddress (deref_addr, deref_so_addr))
return true;
}
else
{
// If we were not running, yet able to read an integer, we must
// have a module
ModuleSP module_sp (address.GetModule());
assert (module_sp);
if (module_sp->ResolveFileAddress(deref_addr, deref_so_addr))
return true;
}
// We couldn't make "deref_addr" into a section offset value, but we were
// able to read the address, so we return a section offset address with
// no section and "deref_addr" as the offset (address).
deref_so_addr.SetRawAddress(deref_addr);
return true;
}
return false;
}