lldb::SBAddress SBValue::GetAddress() { Address addr; if (m_opaque_sp) { Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get(); if (target) { lldb::addr_t value = LLDB_INVALID_ADDRESS; 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) module->ResolveFileAddress(value, addr); } else if (addr_type == eAddressTypeLoad) { // no need to check the return value on this.. if it can actually do the resolve // addr will be in the form (section,offset), otherwise it will simply be returned // as (NULL, value) addr.SetLoadAddress(value, target); } } } LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetAddress () => (%s,%llu)", m_opaque_sp.get(), (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"), addr.GetOffset()); return SBAddress(new Address(addr)); }
uint32_t InstructionList::GetIndexOfInstructionAtLoadAddress (lldb::addr_t load_addr, Target &target) { Address address; address.SetLoadAddress(load_addr, &target); return GetIndexOfInstructionAtAddress(address); }
uint32_t InstructionList::GetIndexOfInstructionAtLoadAddress (lldb::addr_t load_addr, Target &target) { Address address; address.SetLoadAddress(load_addr, &target); size_t num_instructions = m_instructions.size(); uint32_t index = UINT32_MAX; for (size_t i = 0; i < num_instructions; i++) { if (m_instructions[i]->GetAddress() == address) { index = i; break; } } return index; }
lldb::SBAddress SBValue::GetAddress() { Address addr; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); if (value_sp) { TargetSP target_sp (value_sp->GetTargetSP()); if (target_sp) { lldb::addr_t value = LLDB_INVALID_ADDRESS; 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) module_sp->ResolveFileAddress(value, addr); } else if (addr_type == eAddressTypeLoad) { // no need to check the return value on this.. if it can actually do the resolve // addr will be in the form (section,offset), otherwise it will simply be returned // as (NULL, value) addr.SetLoadAddress(value, target_sp.get()); } } } Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")", value_sp.get(), (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"), addr.GetOffset()); return SBAddress(new Address(addr)); }