LLDB  mainline
Classes | Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
lldb_private::AppleObjCTrampolineHandler Class Reference

#include <AppleObjCTrampolineHandler.h>

Collaboration diagram for lldb_private::AppleObjCTrampolineHandler:
Collaboration graph
[legend]

Classes

class  AppleObjCVTables
 
struct  DispatchFunction
 

Public Member Functions

 AppleObjCTrampolineHandler (const lldb::ProcessSP &process_sp, const lldb::ModuleSP &objc_module_sp)
 
 ~AppleObjCTrampolineHandler ()
 
lldb::ThreadPlanSP GetStepThroughDispatchPlan (Thread &thread, bool stop_others)
 
FunctionCallerGetLookupImplementationFunctionCaller ()
 
bool AddrIsMsgForward (lldb::addr_t addr) const
 
lldb::addr_t SetupDispatchFunction (Thread &thread, ValueList &dispatch_values)
 
const DispatchFunctionFindDispatchFunction (lldb::addr_t addr)
 
void ForEachDispatchFunction (std::function< void(lldb::addr_t, const DispatchFunction &)>)
 

Private Types

using MsgsendMap = std::map< lldb::addr_t, int >
 

Private Attributes

MsgsendMap m_msgSend_map
 
MsgsendMap m_opt_dispatch_map
 
lldb::ProcessWP m_process_wp
 
lldb::ModuleSP m_objc_module_sp
 
std::string m_lookup_implementation_function_code
 
std::unique_ptr< UtilityFunctionm_impl_code
 
std::mutex m_impl_function_mutex
 
lldb::addr_t m_impl_fn_addr
 
lldb::addr_t m_impl_stret_fn_addr
 
lldb::addr_t m_msg_forward_addr
 
lldb::addr_t m_msg_forward_stret_addr
 
std::unique_ptr< AppleObjCVTablesm_vtables_up
 

Static Private Attributes

static const DispatchFunction g_dispatch_functions []
 
static const char * g_opt_dispatch_names []
 
static const char * g_lookup_implementation_function_name
 These hold the code for the function that finds the implementation of an ObjC message send given the class & selector and the kind of dispatch. More...
 
static const char * g_lookup_implementation_function_common_code
 
static const char * g_lookup_implementation_with_stret_function_code
 
static const char * g_lookup_implementation_no_stret_function_code
 

Detailed Description

Definition at line 21 of file AppleObjCTrampolineHandler.h.

Member Typedef Documentation

◆ MsgsendMap

Definition at line 150 of file AppleObjCTrampolineHandler.h.

Constructor & Destructor Documentation

◆ AppleObjCTrampolineHandler()

AppleObjCTrampolineHandler::AppleObjCTrampolineHandler ( const lldb::ProcessSP &  process_sp,
const lldb::ModuleSP &  objc_module_sp 
)

◆ ~AppleObjCTrampolineHandler()

AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler ( )
default

Member Function Documentation

◆ AddrIsMsgForward()

bool lldb_private::AppleObjCTrampolineHandler::AddrIsMsgForward ( lldb::addr_t  addr) const
inline

◆ FindDispatchFunction()

const AppleObjCTrampolineHandler::DispatchFunction * AppleObjCTrampolineHandler::FindDispatchFunction ( lldb::addr_t  addr)

Definition at line 775 of file AppleObjCTrampolineHandler.cpp.

References g_dispatch_functions, and m_msgSend_map.

Referenced by GetStepThroughDispatchPlan().

◆ ForEachDispatchFunction()

void AppleObjCTrampolineHandler::ForEachDispatchFunction ( std::function< void(lldb::addr_t, const DispatchFunction &)>  )

◆ GetLookupImplementationFunctionCaller()

FunctionCaller * AppleObjCTrampolineHandler::GetLookupImplementationFunctionCaller ( )

◆ GetStepThroughDispatchPlan()

ThreadPlanSP AppleObjCTrampolineHandler::GetStepThroughDispatchPlan ( Thread thread,
bool  stop_others 
)

Definition at line 792 of file AppleObjCTrampolineHandler.cpp.

References lldb_private::Thread::CalculateProcess(), lldb_private::Address::CalculateSymbolContextSymbol(), lldb_private::Thread::CalculateTarget(), lldb::eBasicTypeVoid, lldb::eDescriptionLevelFull, lldb::eEncodingSint, lldb_private::AppleObjCTrampolineHandler::DispatchFunction::eFixUpFixed, lldb_private::AppleObjCTrampolineHandler::DispatchFunction::eFixUpNone, lldb_private::AppleObjCTrampolineHandler::DispatchFunction::eFixUpToFix, lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::eOBJC_TRAMPOLINE_STRET, error(), FindDispatchFunction(), lldb_private::AppleObjCTrampolineHandler::DispatchFunction::fixedup, g_opt_dispatch_names, lldb_private::ObjCLanguageRuntime::Get(), lldb_private::ABI::GetArgumentValues(), lldb_private::TypeSystemClang::GetBasicType(), lldb_private::TypeSystemClang::GetBuiltinTypeForEncodingAndBitSize(), lldb_private::StreamString::GetData(), lldb_private::ScratchTypeSystemClang::GetForTarget(), lldb_private::GetLog(), lldb_private::Symbol::GetName(), lldb_private::CompilerType::GetPointerType(), lldb_private::Thread::GetProcess(), lldb_private::Thread::GetRegisterContext(), lldb_private::Value::GetScalar(), lldb_private::Thread::GetStackFrameAtIndex(), lldb_private::ConstString::GetStringRef(), lldb_private::ValueList::GetValueAtIndex(), lldb_private::Log::GetVerbose(), lldb_private::AppleObjCTrampolineHandler::DispatchFunction::is_super, lldb_private::AppleObjCTrampolineHandler::DispatchFunction::is_super2, lldb_private::Scalar::IsValid(), LLDB_INVALID_ADDRESS, LLDB_LOG, LLDB_LOGF, lldb_private::Value::LoadAddress, lldb_private::ObjCLanguageRuntime::LookupInMethodCache(), m_opt_dispatch_map, m_vtables_up, lldb_private::ValueList::PushValue(), lldb_private::Target::ResolveLoadAddress(), lldb_private::Value::ResolveValue(), lldb_private::Value::Scalar, lldb_private::Value::SetCompilerType(), lldb_private::Value::SetValueType(), lldb_private::Step, lldb_private::AppleObjCTrampolineHandler::DispatchFunction::stret_return, lldb_private::Scalar::ULongLong(), and arm64_dwarf::x0.

◆ SetupDispatchFunction()

lldb::addr_t AppleObjCTrampolineHandler::SetupDispatchFunction ( Thread thread,
ValueList dispatch_values 
)

Member Data Documentation

◆ g_dispatch_functions

const AppleObjCTrampolineHandler::DispatchFunction AppleObjCTrampolineHandler::g_dispatch_functions
staticprivate

◆ g_lookup_implementation_function_common_code

const char * AppleObjCTrampolineHandler::g_lookup_implementation_function_common_code
staticprivate

Definition at line 64 of file AppleObjCTrampolineHandler.h.

Referenced by AppleObjCTrampolineHandler().

◆ g_lookup_implementation_function_name

const char * AppleObjCTrampolineHandler::g_lookup_implementation_function_name
staticprivate
Initial value:
=
"__lldb_objc_find_implementation_for_selector"

These hold the code for the function that finds the implementation of an ObjC message send given the class & selector and the kind of dispatch.

There are two variants depending on whether the platform uses a separate _stret passing convention (e.g. Intel) or not (e.g. ARM). The difference is only at the very end of the function, so the code is broken into the common prefix and the suffix, which get composed appropriately before the function gets compiled.

Definition at line 63 of file AppleObjCTrampolineHandler.h.

Referenced by SetupDispatchFunction().

◆ g_lookup_implementation_no_stret_function_code

const char * AppleObjCTrampolineHandler::g_lookup_implementation_no_stret_function_code
staticprivate
Initial value:
=
R"(
return_struct.impl_addr =
class_getMethodImplementation (return_struct.class_addr,
return_struct.sel_addr);
if (debug)
printf ("\n*** getMethodImpletation for addr: 0x%p sel: 0x%p result: 0x%p.\n",
return_struct.class_addr, return_struct.sel_addr, return_struct.impl_addr);
return return_struct.impl_addr;
}
)"

Definition at line 66 of file AppleObjCTrampolineHandler.h.

Referenced by AppleObjCTrampolineHandler().

◆ g_lookup_implementation_with_stret_function_code

const char* lldb_private::AppleObjCTrampolineHandler::g_lookup_implementation_with_stret_function_code
staticprivate

Definition at line 65 of file AppleObjCTrampolineHandler.h.

Referenced by AppleObjCTrampolineHandler().

◆ g_opt_dispatch_names

const char * AppleObjCTrampolineHandler::g_opt_dispatch_names
staticprivate
Initial value:
= {
"objc_alloc",
"objc_autorelease",
"objc_release",
"objc_retain",
"objc_alloc_init",
"objc_allocWithZone",
"objc_opt_class",
"objc_opt_isKindOfClass",
"objc_opt_new",
"objc_opt_respondsToSelector",
"objc_opt_self",
}

Definition at line 148 of file AppleObjCTrampolineHandler.h.

Referenced by AppleObjCTrampolineHandler(), and GetStepThroughDispatchPlan().

◆ m_impl_code

std::unique_ptr<UtilityFunction> lldb_private::AppleObjCTrampolineHandler::m_impl_code
private

◆ m_impl_fn_addr

lldb::addr_t lldb_private::AppleObjCTrampolineHandler::m_impl_fn_addr
private

Definition at line 160 of file AppleObjCTrampolineHandler.h.

Referenced by AppleObjCTrampolineHandler().

◆ m_impl_function_mutex

std::mutex lldb_private::AppleObjCTrampolineHandler::m_impl_function_mutex
private

Definition at line 159 of file AppleObjCTrampolineHandler.h.

Referenced by SetupDispatchFunction().

◆ m_impl_stret_fn_addr

lldb::addr_t lldb_private::AppleObjCTrampolineHandler::m_impl_stret_fn_addr
private

Definition at line 161 of file AppleObjCTrampolineHandler.h.

Referenced by AppleObjCTrampolineHandler().

◆ m_lookup_implementation_function_code

std::string lldb_private::AppleObjCTrampolineHandler::m_lookup_implementation_function_code
private

◆ m_msg_forward_addr

lldb::addr_t lldb_private::AppleObjCTrampolineHandler::m_msg_forward_addr
private

Definition at line 162 of file AppleObjCTrampolineHandler.h.

Referenced by AddrIsMsgForward(), and AppleObjCTrampolineHandler().

◆ m_msg_forward_stret_addr

lldb::addr_t lldb_private::AppleObjCTrampolineHandler::m_msg_forward_stret_addr
private

Definition at line 163 of file AppleObjCTrampolineHandler.h.

Referenced by AddrIsMsgForward(), and AppleObjCTrampolineHandler().

◆ m_msgSend_map

MsgsendMap lldb_private::AppleObjCTrampolineHandler::m_msgSend_map
private

◆ m_objc_module_sp

lldb::ModuleSP lldb_private::AppleObjCTrampolineHandler::m_objc_module_sp
private

◆ m_opt_dispatch_map

MsgsendMap lldb_private::AppleObjCTrampolineHandler::m_opt_dispatch_map
private

◆ m_process_wp

lldb::ProcessWP lldb_private::AppleObjCTrampolineHandler::m_process_wp
private

Definition at line 155 of file AppleObjCTrampolineHandler.h.

Referenced by AppleObjCTrampolineHandler().

◆ m_vtables_up

std::unique_ptr<AppleObjCVTables> lldb_private::AppleObjCTrampolineHandler::m_vtables_up
private

The documentation for this class was generated from the following files: