forked from OSchip/llvm-project
[lldb] Fixup code addresses in the Objective-C language runtime
Upstream the calls to ABI::FixCodeAddress in the Objective-C language runtime. Differential revision: https://reviews.llvm.org/D112662
This commit is contained in:
parent
2999b7307f
commit
8bac9e3686
|
@ -9,6 +9,7 @@
|
||||||
#include "AppleObjCClassDescriptorV2.h"
|
#include "AppleObjCClassDescriptorV2.h"
|
||||||
|
|
||||||
#include "lldb/Expression/FunctionCaller.h"
|
#include "lldb/Expression/FunctionCaller.h"
|
||||||
|
#include "lldb/Target/ABI.h"
|
||||||
#include "lldb/Utility/Log.h"
|
#include "lldb/Utility/Log.h"
|
||||||
|
|
||||||
using namespace lldb;
|
using namespace lldb;
|
||||||
|
@ -73,6 +74,10 @@ bool ClassDescriptorV2::objc_class_t::Read(Process *process,
|
||||||
m_flags = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3);
|
m_flags = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3);
|
||||||
m_data_ptr = data_NEVER_USE & GetClassDataMask(process);
|
m_data_ptr = data_NEVER_USE & GetClassDataMask(process);
|
||||||
|
|
||||||
|
if (ABISP abi_sp = process->GetABI()) {
|
||||||
|
m_isa = abi_sp->FixCodeAddress(m_isa);
|
||||||
|
m_superclass = abi_sp->FixCodeAddress(m_superclass);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +110,8 @@ bool ClassDescriptorV2::class_rw_t::Read(Process *process, lldb::addr_t addr) {
|
||||||
m_flags = extractor.GetU32_unchecked(&cursor);
|
m_flags = extractor.GetU32_unchecked(&cursor);
|
||||||
m_version = extractor.GetU32_unchecked(&cursor);
|
m_version = extractor.GetU32_unchecked(&cursor);
|
||||||
m_ro_ptr = extractor.GetAddress_unchecked(&cursor);
|
m_ro_ptr = extractor.GetAddress_unchecked(&cursor);
|
||||||
|
if (ABISP abi_sp = process->GetABI())
|
||||||
|
m_ro_ptr = abi_sp->FixCodeAddress(m_ro_ptr);
|
||||||
m_method_list_ptr = extractor.GetAddress_unchecked(&cursor);
|
m_method_list_ptr = extractor.GetAddress_unchecked(&cursor);
|
||||||
m_properties_ptr = extractor.GetAddress_unchecked(&cursor);
|
m_properties_ptr = extractor.GetAddress_unchecked(&cursor);
|
||||||
m_firstSubclass = extractor.GetAddress_unchecked(&cursor);
|
m_firstSubclass = extractor.GetAddress_unchecked(&cursor);
|
||||||
|
@ -120,6 +127,8 @@ bool ClassDescriptorV2::class_rw_t::Read(Process *process, lldb::addr_t addr) {
|
||||||
process->GetByteOrder(),
|
process->GetByteOrder(),
|
||||||
process->GetAddressByteSize());
|
process->GetAddressByteSize());
|
||||||
m_ro_ptr = extractor.GetAddress_unchecked(&cursor);
|
m_ro_ptr = extractor.GetAddress_unchecked(&cursor);
|
||||||
|
if (ABISP abi_sp = process->GetABI())
|
||||||
|
m_ro_ptr = abi_sp->FixCodeAddress(m_ro_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -231,6 +240,8 @@ bool ClassDescriptorV2::method_list_t::Read(Process *process,
|
||||||
DataBufferHeap buffer(size, '\0');
|
DataBufferHeap buffer(size, '\0');
|
||||||
Status error;
|
Status error;
|
||||||
|
|
||||||
|
if (ABISP abi_sp = process->GetABI())
|
||||||
|
addr = abi_sp->FixCodeAddress(addr);
|
||||||
process->ReadMemory(addr, buffer.GetBytes(), size, error);
|
process->ReadMemory(addr, buffer.GetBytes(), size, error);
|
||||||
if (error.Fail()) {
|
if (error.Fail()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "lldb/Expression/DiagnosticManager.h"
|
#include "lldb/Expression/DiagnosticManager.h"
|
||||||
#include "lldb/Expression/FunctionCaller.h"
|
#include "lldb/Expression/FunctionCaller.h"
|
||||||
#include "lldb/Expression/UtilityFunction.h"
|
#include "lldb/Expression/UtilityFunction.h"
|
||||||
|
#include "lldb/Target/ABI.h"
|
||||||
#include "lldb/Target/ExecutionContext.h"
|
#include "lldb/Target/ExecutionContext.h"
|
||||||
#include "lldb/Target/Process.h"
|
#include "lldb/Target/Process.h"
|
||||||
#include "lldb/Target/Thread.h"
|
#include "lldb/Target/Thread.h"
|
||||||
|
@ -134,6 +135,10 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
|
||||||
target_addr_value);
|
target_addr_value);
|
||||||
m_impl_function->DeallocateFunctionResults(exc_ctx, m_args_addr);
|
m_impl_function->DeallocateFunctionResults(exc_ctx, m_args_addr);
|
||||||
lldb::addr_t target_addr = target_addr_value.GetScalar().ULongLong();
|
lldb::addr_t target_addr = target_addr_value.GetScalar().ULongLong();
|
||||||
|
|
||||||
|
if (ABISP abi_sp = GetThread().GetProcess()->GetABI()) {
|
||||||
|
target_addr = abi_sp->FixCodeAddress(target_addr);
|
||||||
|
}
|
||||||
Address target_so_addr;
|
Address target_so_addr;
|
||||||
target_so_addr.SetOpcodeLoadAddress(target_addr, exc_ctx.GetTargetPtr());
|
target_so_addr.SetOpcodeLoadAddress(target_addr, exc_ctx.GetTargetPtr());
|
||||||
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "lldb/Symbol/TypeList.h"
|
#include "lldb/Symbol/TypeList.h"
|
||||||
#include "lldb/Symbol/Variable.h"
|
#include "lldb/Symbol/Variable.h"
|
||||||
#include "lldb/Target/Target.h"
|
#include "lldb/Target/Target.h"
|
||||||
|
#include "lldb/Target/ABI.h"
|
||||||
#include "lldb/Utility/Log.h"
|
#include "lldb/Utility/Log.h"
|
||||||
#include "lldb/Utility/Timer.h"
|
#include "lldb/Utility/Timer.h"
|
||||||
|
|
||||||
|
@ -273,10 +274,17 @@ ObjCLanguageRuntime::ClassDescriptorSP
|
||||||
ObjCLanguageRuntime::GetClassDescriptorFromISA(ObjCISA isa) {
|
ObjCLanguageRuntime::GetClassDescriptorFromISA(ObjCISA isa) {
|
||||||
if (isa) {
|
if (isa) {
|
||||||
UpdateISAToDescriptorMap();
|
UpdateISAToDescriptorMap();
|
||||||
|
|
||||||
ObjCLanguageRuntime::ISAToDescriptorIterator pos =
|
ObjCLanguageRuntime::ISAToDescriptorIterator pos =
|
||||||
m_isa_to_descriptor.find(isa);
|
m_isa_to_descriptor.find(isa);
|
||||||
if (pos != m_isa_to_descriptor.end())
|
if (pos != m_isa_to_descriptor.end())
|
||||||
return pos->second;
|
return pos->second;
|
||||||
|
|
||||||
|
if (ABISP abi_sp = m_process->GetABI()) {
|
||||||
|
pos = m_isa_to_descriptor.find(abi_sp->FixCodeAddress(isa));
|
||||||
|
if (pos != m_isa_to_descriptor.end())
|
||||||
|
return pos->second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ClassDescriptorSP();
|
return ClassDescriptorSP();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue