本文整理汇总了C++中Address::GetLoadAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ Address::GetLoadAddress方法的具体用法?C++ Address::GetLoadAddress怎么用?C++ Address::GetLoadAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Address
的用法示例。
在下文中一共展示了Address::GetLoadAddress方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: api_locker
lldb::addr_t
SBValue::GetLoadAddress()
{
lldb::addr_t value = LLDB_INVALID_ADDRESS;
if (m_opaque_sp)
{
Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
if (target)
{
Mutex::Locker api_locker (target->GetAPIMutex());
const bool scalar_is_load_address = true;
AddressType addr_type;
value = m_opaque_sp->GetAddressOf(scalar_is_load_address, &addr_type);
if (addr_type == eAddressTypeFile)
{
Module* module = m_opaque_sp->GetModule();
if (!module)
value = LLDB_INVALID_ADDRESS;
else
{
Address addr;
module->ResolveFileAddress(value, addr);
value = addr.GetLoadAddress(m_opaque_sp->GetUpdatePoint().GetTargetSP().get());
}
}
else if (addr_type == eAddressTypeHost || addr_type == eAddressTypeInvalid)
value = LLDB_INVALID_ADDRESS;
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetLoadAddress () => (%llu)", m_opaque_sp.get(), value);
return value;
}
示例2: findSymbolAddress
// Find the load address of a symbol
static lldb::addr_t findSymbolAddress( Process *proc, ConstString findName )
{
assert( proc != nullptr );
ModuleSP module = proc->GetTarget().GetExecutableModule();
assert( module.get() != nullptr );
ObjectFile *exe = module->GetObjectFile();
assert( exe != nullptr );
lldb_private::Symtab *symtab = exe->GetSymtab( );
assert( symtab != nullptr );
for ( size_t i = 0; i < symtab->GetNumSymbols( ); i++ )
{
const Symbol* sym = symtab->SymbolAtIndex( i );
assert( sym != nullptr );
const ConstString &symName = sym->GetName( );
if ( ConstString::Compare( findName, symName ) == 0 )
{
Address addr = sym->GetAddress();
return addr.GetLoadAddress( & proc->GetTarget() );
}
}
return LLDB_INVALID_ADDRESS;
}
示例3: FindMetadata
bool DYLDRendezvous::FindMetadata(const char *name, PThreadField field,
uint32_t &value) {
Target &target = m_process->GetTarget();
SymbolContextList list;
if (!target.GetImages().FindSymbolsWithNameAndType(ConstString(name),
eSymbolTypeAny, list))
return false;
Address address = list[0].symbol->GetAddress();
addr_t addr = address.GetLoadAddress(&target);
if (addr == LLDB_INVALID_ADDRESS)
return false;
Status error;
value = (uint32_t)m_process->ReadUnsignedIntegerFromMemory(
addr + field * sizeof(uint32_t), sizeof(uint32_t), 0, error);
if (error.Fail())
return false;
if (field == eSize)
value /= 8; // convert bits to bytes
return true;
}
示例4: GetImageInfoAddress
addr_t ProcessFreeBSD::GetImageInfoAddress() {
Target *target = &GetTarget();
ObjectFile *obj_file = target->GetExecutableModule()->GetObjectFile();
Address addr = obj_file->GetImageInfoAddress(target);
if (addr.IsValid())
return addr.GetLoadAddress(target);
return LLDB_INVALID_ADDRESS;
}
示例5: GetTarget
lldb::addr_t
ProcessElfCore::GetImageInfoAddress()
{
ObjectFile *obj_file = GetTarget().GetExecutableModule()->GetObjectFile();
Address addr = obj_file->GetImageInfoAddress(&GetTarget());
if (addr.IsValid())
return addr.GetLoadAddress(&GetTarget());
return LLDB_INVALID_ADDRESS;
}
示例6: GetTarget
lldb::addr_t
ProcessWindows::GetImageInfoAddress()
{
Target &target = GetTarget();
ObjectFile *obj_file = target.GetExecutableModule()->GetObjectFile();
Address addr = obj_file->GetImageInfoAddress(&target);
if (addr.IsValid())
return addr.GetLoadAddress(&target);
else
return LLDB_INVALID_ADDRESS;
}
示例7: SetInstruction
bool EmulateInstruction::SetInstruction(const Opcode &opcode,
const Address &inst_addr,
Target *target) {
m_opcode = opcode;
m_addr = LLDB_INVALID_ADDRESS;
if (inst_addr.IsValid()) {
if (target != nullptr)
m_addr = inst_addr.GetLoadAddress(target);
if (m_addr == LLDB_INVALID_ADDRESS)
m_addr = inst_addr.GetFileAddress();
}
return true;
}
示例8: ThreadPlan
ThreadPlanRunToAddress::ThreadPlanRunToAddress
(
Thread &thread,
Address &address,
bool stop_others
) :
ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to address plan", thread, eVoteNoOpinion, eVoteNoOpinion),
m_stop_others (stop_others),
m_addresses (),
m_break_ids ()
{
m_addresses.push_back (address.GetLoadAddress(&m_thread.GetProcess().GetTarget()));
SetInitialBreakpoints();
}
示例9: StoppointLocation
BreakpointLocation::BreakpointLocation
(
break_id_t loc_id,
Breakpoint &owner,
Address &addr,
lldb::tid_t tid,
bool hardware
) :
StoppointLocation (loc_id, addr.GetLoadAddress(owner.GetTarget().GetProcessSP().get()), hardware),
m_address (addr),
m_owner (owner),
m_options_ap (),
m_bp_site_sp ()
{
SetThreadID (tid);
}
示例10: ContainsLoadAddress
bool AddressRange::ContainsLoadAddress(const Address &addr,
Target *target) const {
if (addr.GetSection() == m_base_addr.GetSection())
return (addr.GetOffset() - m_base_addr.GetOffset()) < GetByteSize();
addr_t load_base_addr = GetBaseAddress().GetLoadAddress(target);
if (load_base_addr == LLDB_INVALID_ADDRESS)
return false;
addr_t load_addr = addr.GetLoadAddress(target);
if (load_addr == LLDB_INVALID_ADDRESS)
return false;
if (load_base_addr <= load_addr)
return (load_addr - load_base_addr) < GetByteSize();
return false;
}
示例11: Materialize
void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map,
lldb::addr_t process_address, Status &err) override {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
const lldb::addr_t load_addr = process_address + m_offset;
if (log) {
log->Printf("EntitySymbol::Materialize [address = 0x%" PRIx64
", m_symbol = %s]",
(uint64_t)load_addr, m_symbol.GetName().AsCString());
}
const Address sym_address = m_symbol.GetAddress();
ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope();
lldb::TargetSP target_sp;
if (exe_scope)
target_sp = map.GetBestExecutionContextScope()->CalculateTarget();
if (!target_sp) {
err.SetErrorStringWithFormat(
"couldn't resolve symbol %s because there is no target",
m_symbol.GetName().AsCString());
return;
}
lldb::addr_t resolved_address = sym_address.GetLoadAddress(target_sp.get());
if (resolved_address == LLDB_INVALID_ADDRESS)
resolved_address = sym_address.GetFileAddress();
Status pointer_write_error;
map.WritePointerToMemory(load_addr, resolved_address, pointer_write_error);
if (!pointer_write_error.Success()) {
err.SetErrorStringWithFormat(
"couldn't write the address of symbol %s: %s",
m_symbol.GetName().AsCString(), pointer_write_error.AsCString());
return;
}
}
示例12: GetSymbolAddress
addr_t JITLoaderGDB::GetSymbolAddress(ModuleList &module_list,
const ConstString &name,
SymbolType symbol_type) const {
SymbolContextList target_symbols;
Target &target = m_process->GetTarget();
if (!module_list.FindSymbolsWithNameAndType(name, symbol_type,
target_symbols))
return LLDB_INVALID_ADDRESS;
SymbolContext sym_ctx;
target_symbols.GetContextAtIndex(0, sym_ctx);
const Address jit_descriptor_addr = sym_ctx.symbol->GetAddress();
if (!jit_descriptor_addr.IsValid())
return LLDB_INVALID_ADDRESS;
const addr_t jit_addr = jit_descriptor_addr.GetLoadAddress(&target);
return jit_addr;
}
示例13: value_sp
lldb::addr_t
SBValue::GetLoadAddress()
{
lldb::addr_t value = LLDB_INVALID_ADDRESS;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
TargetSP target_sp (value_sp->GetTargetSP());
if (target_sp)
{
const bool scalar_is_load_address = true;
AddressType addr_type;
value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
if (addr_type == eAddressTypeFile)
{
ModuleSP module_sp (value_sp->GetModule());
if (!module_sp)
value = LLDB_INVALID_ADDRESS;
else
{
Address addr;
module_sp->ResolveFileAddress(value, addr);
value = addr.GetLoadAddress(target_sp.get());
}
}
else if (addr_type == eAddressTypeHost || addr_type == eAddressTypeInvalid)
value = LLDB_INVALID_ADDRESS;
}
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")", value_sp.get(), value);
return value;
}
示例14: pointer
/// Locates the address of the rendezvous structure. Returns the address on
/// success and LLDB_INVALID_ADDRESS on failure.
static addr_t
ResolveRendezvousAddress(Process *process)
{
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
addr_t info_location;
addr_t info_addr;
Error error;
if (!process)
{
if (log)
log->Printf ("%s null process provided", __FUNCTION__);
return LLDB_INVALID_ADDRESS;
}
// Try to get it from our process. This might be a remote process and might
// grab it via some remote-specific mechanism.
info_location = process->GetImageInfoAddress();
if (log)
log->Printf ("%s info_location = 0x%" PRIx64, __FUNCTION__, info_location);
// If the process fails to return an address, fall back to seeing if the local object file can help us find it.
if (info_location == LLDB_INVALID_ADDRESS)
{
Target *target = &process->GetTarget();
if (target)
{
ObjectFile *obj_file = target->GetExecutableModule()->GetObjectFile();
Address addr = obj_file->GetImageInfoAddress(target);
if (addr.IsValid())
{
info_location = addr.GetLoadAddress(target);
if (log)
log->Printf ("%s resolved via direct object file approach to 0x%" PRIx64, __FUNCTION__, info_location);
}
else
{
if (log)
log->Printf ("%s FAILED - direct object file approach did not yield a valid address", __FUNCTION__);
}
}
}
if (info_location == LLDB_INVALID_ADDRESS)
{
if (log)
log->Printf ("%s FAILED - invalid info address", __FUNCTION__);
return LLDB_INVALID_ADDRESS;
}
if (log)
log->Printf ("%s reading pointer (%" PRIu32 " bytes) from 0x%" PRIx64, __FUNCTION__, process->GetAddressByteSize(), info_location);
info_addr = process->ReadPointerFromMemory(info_location, error);
if (error.Fail())
{
if (log)
log->Printf ("%s FAILED - could not read from the info location: %s", __FUNCTION__, error.AsCString ());
return LLDB_INVALID_ADDRESS;
}
if (info_addr == 0)
{
if (log)
log->Printf ("%s FAILED - the rendezvous address contained at 0x%" PRIx64 " returned a null value", __FUNCTION__, info_location);
return LLDB_INVALID_ADDRESS;
}
return info_addr;
}
示例15: AuxVector
void
DynamicLoaderPOSIXDYLD::DidAttach()
{
Log *log (GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
if (log)
log->Printf ("DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64, __FUNCTION__, m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID);
m_auxv.reset(new AuxVector(m_process));
if (log)
log->Printf ("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " reloaded auxv data", __FUNCTION__, m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID);
// ask the process if it can load any of its own modules
m_process->LoadModules ();
ModuleSP executable_sp = GetTargetExecutable ();
ResolveExecutableModule (executable_sp);
// find the main process load offset
addr_t load_offset = ComputeLoadOffset ();
if (log)
log->Printf ("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " executable '%s', load_offset 0x%" PRIx64, __FUNCTION__, m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID, executable_sp ? executable_sp->GetFileSpec().GetPath().c_str () : "<null executable>", load_offset);
// if we dont have a load address we cant re-base
bool rebase_exec = (load_offset == LLDB_INVALID_ADDRESS) ? false : true;
// if we have a valid executable
if (executable_sp.get())
{
lldb_private::ObjectFile * obj = executable_sp->GetObjectFile();
if (obj)
{
// don't rebase if the module already has a load address
Target & target = m_process->GetTarget ();
Address addr = obj->GetImageInfoAddress (&target);
if (addr.GetLoadAddress (&target) != LLDB_INVALID_ADDRESS)
rebase_exec = false;
}
}
else
{
// no executable, nothing to re-base
rebase_exec = false;
}
// if the target executable should be re-based
if (rebase_exec)
{
ModuleList module_list;
module_list.Append(executable_sp);
if (log)
log->Printf ("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " added executable '%s' to module load list",
__FUNCTION__,
m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID,
executable_sp->GetFileSpec().GetPath().c_str ());
UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset);
// When attaching to a target, there are two possible states:
// (1) We already crossed the entry point and therefore the rendezvous
// structure is ready to be used and we can load the list of modules
// and place the rendezvous breakpoint.
// (2) We didn't cross the entry point yet, so these structures are not
// ready; we should behave as if we just launched the target and
// call ProbeEntry(). This will place a breakpoint on the entry
// point which itself will be hit after the rendezvous structure is
// set up and will perform actions described in (1).
if (m_rendezvous.Resolve())
{
if (log)
log->Printf ("DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64 " rendezvous could resolve: attach assuming dynamic loader info is available now", __FUNCTION__, m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID);
LoadAllCurrentModules();
SetRendezvousBreakpoint();
}
else
{
if (log)
log->Printf ("DynamicLoaderPOSIXDYLD::%s() pid %" PRIu64 " rendezvous could not yet resolve: adding breakpoint to catch future rendezvous setup", __FUNCTION__, m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID);
ProbeEntry();
}
m_process->GetTarget().ModulesDidLoad(module_list);
if (log)
{
log->Printf ("DynamicLoaderPOSIXDYLD::%s told the target about the modules that loaded:", __FUNCTION__);
for (auto module_sp : module_list.Modules ())
{
log->Printf ("-- [module] %s (pid %" PRIu64 ")",
module_sp ? module_sp->GetFileSpec().GetPath().c_str () : "<null>",
m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID);
}
}
}
}