LLDB mainline
|
#include <DynamicLoaderHexagonDYLD.h>
Public Member Functions | |
DynamicLoaderHexagonDYLD (lldb_private::Process *process) | |
~DynamicLoaderHexagonDYLD () override | |
void | DidAttach () override |
Called after attaching a process. | |
void | DidLaunch () override |
Called after launching a process. | |
lldb::ThreadPlanSP | GetStepThroughTrampolinePlan (lldb_private::Thread &thread, bool stop_others) override |
Provides a plan to step through the dynamic loader trampoline for the current state of thread. | |
lldb_private::Status | CanLoadImage () override |
Ask if it is ok to try and load or unload an shared library (image). | |
lldb::addr_t | GetThreadLocalData (const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr) override |
Retrieves the per-module TLS block for a given thread. | |
llvm::StringRef | GetPluginName () override |
Public Member Functions inherited from lldb_private::DynamicLoader | |
DynamicLoader (Process *process) | |
Construct with a process. | |
virtual void | DidAttach ()=0 |
Called after attaching a process. | |
virtual void | DidLaunch ()=0 |
Called after launching a process. | |
virtual bool | ProcessDidExec () |
Helper function that can be used to detect when a process has called exec and is now a new and different process. | |
bool | GetStopWhenImagesChange () const |
Get whether the process should stop when images change. | |
void | SetStopWhenImagesChange (bool stop) |
Set whether the process should stop when images change. | |
virtual lldb::ThreadPlanSP | GetStepThroughTrampolinePlan (Thread &thread, bool stop_others)=0 |
Provides a plan to step through the dynamic loader trampoline for the current state of thread. | |
virtual void | FindEquivalentSymbols (Symbol *original_symbol, ModuleList &module_list, SymbolContextList &equivalent_symbols) |
Some dynamic loaders provide features where there are a group of symbols "equivalent to" a given symbol one of which will be chosen when the symbol is bound. | |
virtual Status | CanLoadImage ()=0 |
Ask if it is ok to try and load or unload an shared library (image). | |
virtual bool | AlwaysRelyOnEHUnwindInfo (SymbolContext &sym_ctx) |
Ask if the eh_frame information for the given SymbolContext should be relied on even when it's the first frame in a stack unwind. | |
virtual lldb::addr_t | GetThreadLocalData (const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr) |
Retrieves the per-module TLS block for a given thread. | |
virtual lldb::ModuleSP | LoadModuleAtAddress (const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset) |
Locates or creates a module given by file and updates/loads the resulting module at the virtual base address base_addr . | |
virtual bool | GetSharedCacheInformation (lldb::addr_t &base_address, UUID &uuid, LazyBool &using_shared_cache, LazyBool &private_shared_cache) |
Get information about the shared cache for a process, if possible. | |
virtual bool | IsFullyInitialized () |
Return whether the dynamic loader is fully initialized and it's safe to call its APIs. | |
virtual std::optional< lldb_private::Address > | GetStartAddress () |
Return the start address in the dynamic loader module. | |
Public Member Functions inherited from lldb_private::PluginInterface | |
PluginInterface ()=default | |
virtual | ~PluginInterface ()=default |
virtual llvm::StringRef | GetPluginName ()=0 |
PluginInterface (const PluginInterface &)=delete | |
PluginInterface & | operator= (const PluginInterface &)=delete |
Static Public Member Functions | |
static void | Initialize () |
static void | Terminate () |
static llvm::StringRef | GetPluginNameStatic () |
static llvm::StringRef | GetPluginDescriptionStatic () |
static lldb_private::DynamicLoader * | CreateInstance (lldb_private::Process *process, bool force) |
Static Public Member Functions inherited from lldb_private::DynamicLoader | |
static DynamicLoader * | FindPlugin (Process *process, llvm::StringRef plugin_name) |
Find a dynamic loader plugin for a given process. | |
static lldb::ModuleSP | LoadBinaryWithUUIDAndAddress (Process *process, llvm::StringRef name, UUID uuid, lldb::addr_t value, bool value_is_offset, bool force_symbol_search, bool notify, bool set_address_in_target, bool allow_memory_image_last_resort) |
Find/load a binary into lldb given a UUID and the address where it is loaded in memory, or a slide to be applied to the file address. | |
Protected Member Functions | |
bool | SetRendezvousBreakpoint () |
Enables a breakpoint on a function called by the runtime linker each time a module is loaded or unloaded. | |
void | RefreshModules () |
Helper method for RendezvousBreakpointHit. | |
void | UpdateLoadedSections (lldb::ModuleSP module, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset) override |
Updates the load address of every allocatable section in module . | |
void | UnloadSections (const lldb::ModuleSP module) override |
Removes the loaded sections from the target in module . | |
void | LoadAllCurrentModules () |
Helper for the entry breakpoint callback. | |
lldb::addr_t | ComputeLoadOffset () |
Computes a value for m_load_offset returning the computed address on success and LLDB_INVALID_ADDRESS on failure. | |
lldb::addr_t | GetEntryPoint () |
Computes a value for m_entry_point returning the computed address on success and LLDB_INVALID_ADDRESS on failure. | |
lldb::ModuleSP | GetTargetExecutable () |
Checks to see if the target module has changed, updates the target accordingly and returns the target executable module. | |
lldb::addr_t | FindRendezvousBreakpointAddress () |
return the address of the Rendezvous breakpoint | |
Protected Member Functions inherited from lldb_private::DynamicLoader | |
lldb::ModuleSP | FindModuleViaTarget (const FileSpec &file) |
lldb::ModuleSP | GetTargetExecutable () |
Checks to see if the target module has changed, updates the target accordingly and returns the target executable module. | |
virtual void | UpdateLoadedSections (lldb::ModuleSP module, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset) |
Updates the load address of every allocatable section in module . | |
void | UpdateLoadedSectionsCommon (lldb::ModuleSP module, lldb::addr_t base_addr, bool base_addr_is_offset) |
virtual void | UnloadSections (const lldb::ModuleSP module) |
Removes the loaded sections from the target in module . | |
void | UnloadSectionsCommon (const lldb::ModuleSP module) |
const lldb_private::SectionList * | GetSectionListFromModule (const lldb::ModuleSP module) const |
int64_t | ReadUnsignedIntWithSizeInBytes (lldb::addr_t addr, int size_in_bytes) |
lldb::addr_t | ReadPointer (lldb::addr_t addr) |
void | LoadOperatingSystemPlugin (bool flush) |
Static Protected Member Functions | |
static bool | RendezvousBreakpointHit (void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id) |
Callback routine which updates the current list of loaded modules based on the information supplied by the runtime linker. | |
static bool | EntryBreakpointHit (void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id) |
Callback routine invoked when we hit the breakpoint on process entry. | |
Protected Attributes | |
HexagonDYLDRendezvous | m_rendezvous |
Runtime linker rendezvous structure. | |
lldb::addr_t | m_load_offset |
Virtual load address of the inferior process. | |
lldb::addr_t | m_entry_point |
Virtual entry address of the inferior process. | |
lldb::break_id_t | m_dyld_bid |
Rendezvous breakpoint. | |
std::map< lldb::ModuleWP, lldb::addr_t, std::owner_less< lldb::ModuleWP > > | m_loaded_modules |
Loaded module list. (link map for each module) | |
Protected Attributes inherited from lldb_private::DynamicLoader | |
Process * | m_process |
The process that this dynamic loader plug-in is tracking. | |
Private Member Functions | |
const lldb_private::SectionList * | GetSectionListFromModule (const lldb::ModuleSP module) const |
Definition at line 17 of file DynamicLoaderHexagonDYLD.h.
DynamicLoaderHexagonDYLD::DynamicLoaderHexagonDYLD | ( | lldb_private::Process * | process | ) |
Definition at line 102 of file DynamicLoaderHexagonDYLD.cpp.
|
override |
Definition at line 107 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::Process::GetTarget(), LLDB_INVALID_BREAK_ID, m_dyld_bid, lldb_private::DynamicLoader::m_process, and lldb_private::Target::RemoveBreakpointByID().
|
overridevirtual |
Ask if it is ok to try and load or unload an shared library (image).
The dynamic loader often knows when it would be ok to try and load or unload a shared library. This function call allows the dynamic loader plug-ins to check any current dyld state to make sure it is an ok time to load a shared library.
Implements lldb_private::DynamicLoader.
Definition at line 205 of file DynamicLoaderHexagonDYLD.cpp.
|
protected |
Computes a value for m_load_offset returning the computed address on success and LLDB_INVALID_ADDRESS on failure.
Definition at line 491 of file DynamicLoaderHexagonDYLD.cpp.
Referenced by DidAttach().
|
static |
Definition at line 87 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::Target::GetArchitecture(), lldb_private::Process::GetTarget(), and lldb_private::ArchSpec::GetTriple().
Referenced by Initialize().
|
overridevirtual |
Called after attaching a process.
Allow DynamicLoader plug-ins to execute some code after attaching to a process.
Implements lldb_private::DynamicLoader.
Definition at line 114 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::ModuleList::Append(), ComputeLoadOffset(), lldb_private::Process::GetTarget(), GetTargetExecutable(), LLDB_INVALID_ADDRESS, LoadAllCurrentModules(), lldb_private::DynamicLoader::m_process, lldb_private::Target::ModulesDidLoad(), lldb_private::Process::SetCanInterpretFunctionCalls(), lldb_private::Process::SetCanJIT(), SetRendezvousBreakpoint(), and UpdateLoadedSections().
|
overridevirtual |
Called after launching a process.
Allow DynamicLoader plug-ins to execute some code after the process has stopped for the first time on launch.
Implements lldb_private::DynamicLoader.
Definition at line 159 of file DynamicLoaderHexagonDYLD.cpp.
|
staticprotected |
Callback routine invoked when we hit the breakpoint on process entry.
This routine is responsible for resolving the load addresses of all dependent modules required by the inferior and setting up the rendezvous breakpoint.
|
protected |
return the address of the Rendezvous breakpoint
|
protected |
Computes a value for m_entry_point returning the computed address on success and LLDB_INVALID_ADDRESS on failure.
Definition at line 508 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::Target::GetExecutableModule(), lldb_private::Address::GetFileAddress(), lldb_private::Module::GetObjectFile(), lldb_private::Process::GetTarget(), LLDB_INVALID_ADDRESS, m_entry_point, and lldb_private::DynamicLoader::m_process.
|
static |
Definition at line 82 of file DynamicLoaderHexagonDYLD.cpp.
Referenced by Initialize().
|
inlineoverridevirtual |
Implements lldb_private::PluginInterface.
Definition at line 50 of file DynamicLoaderHexagonDYLD.h.
References GetPluginNameStatic().
|
inlinestatic |
Definition at line 27 of file DynamicLoaderHexagonDYLD.h.
Referenced by GetPluginName(), and Initialize().
|
private |
Definition at line 529 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::ObjectFile::GetSectionList().
Referenced by UnloadSections(), and UpdateLoadedSections().
|
overridevirtual |
Provides a plan to step through the dynamic loader trampoline for the current state of thread.
[in] | stop_others | Whether the plan should be set to stop other threads. |
Implements lldb_private::DynamicLoader.
Definition at line 402 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::Mangled::ePreferMangled, lldb::eSymbolTypeCode, lldb_private::ModuleList::FindSymbolsWithNameAndType(), lldb_private::SymbolContext::GetAddressRange(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Target::GetImages(), lldb_private::Address::GetLoadAddress(), lldb_private::Symbol::GetMangled(), lldb_private::Mangled::GetName(), lldb_private::Thread::GetProcess(), lldb_private::SymbolContextList::GetSize(), lldb_private::Thread::GetStackFrameAtIndex(), lldb_private::StackFrame::GetSymbolContext(), lldb_private::Symbol::IsTrampoline(), LLDB_INVALID_ADDRESS, and lldb_private::SymbolContext::symbol.
|
protected |
Checks to see if the target module has changed, updates the target accordingly and returns the target executable module.
Definition at line 163 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::eLoadDependentsNo, lldb_private::Target::GetExecutableModule(), lldb_private::Target::GetExecutableModulePointer(), lldb_private::Target::GetOrCreateModule(), lldb_private::Process::GetTarget(), lldb_private::FileSystem::Instance(), lldb_private::DynamicLoader::m_process, and lldb_private::Target::SetExecutableModule().
Referenced by DidAttach(), and LoadAllCurrentModules().
|
overridevirtual |
Retrieves the per-module TLS block for a given thread.
[in] | module | The module to query TLS data for. |
[in] | thread | The specific thread to query TLS data for. |
Reimplemented from lldb_private::DynamicLoader.
Definition at line 552 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::ConstString::AsCString(), HexagonDYLDRendezvous::ThreadInfo::dtv_offset, HexagonDYLDRendezvous::ThreadInfo::dtv_slot_size, lldb_private::GetLog(), lldb_private::Module::GetObjectName(), HexagonDYLDRendezvous::GetThreadInfo(), LLDB_INVALID_ADDRESS, LLDB_LOGF, m_loaded_modules, lldb_private::DynamicLoader::m_process, m_rendezvous, HexagonDYLDRendezvous::ThreadInfo::modid_offset, ReadInt(), lldb_private::DynamicLoader::ReadPointer(), HexagonDYLDRendezvous::ThreadInfo::tls_offset, and HexagonDYLDRendezvous::ThreadInfo::valid.
|
static |
Definition at line 75 of file DynamicLoaderHexagonDYLD.cpp.
References CreateInstance(), GetPluginDescriptionStatic(), GetPluginNameStatic(), and lldb_private::PluginManager::RegisterPlugin().
|
protected |
Helper for the entry breakpoint callback.
Resolves the load addresses of all dependent modules.
Definition at line 451 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::ModuleList::Append(), HexagonDYLDRendezvous::begin(), HexagonDYLDRendezvous::end(), HexagonDYLDRendezvous::GetLinkMapAddress(), lldb_private::GetLog(), lldb_private::Process::GetTarget(), GetTargetExecutable(), LLDB_LOGF, lldb_private::DynamicLoader::LoadModuleAtAddress(), m_loaded_modules, lldb_private::DynamicLoader::m_process, m_rendezvous, lldb_private::Target::ModulesDidLoad(), and HexagonDYLDRendezvous::Resolve().
Referenced by DidAttach().
|
protected |
Helper method for RendezvousBreakpointHit.
Updates LLDB's current set of loaded modules.
Definition at line 340 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::ModuleList::Append(), lldb_private::ModuleList::AppendIfNeeded(), lldb_private::ModuleList::FindFirstModule(), lldb_private::Target::GetImages(), lldb_private::GetLog(), lldb_private::Process::GetTarget(), lldb_private::FileSystem::Instance(), LLDB_LOGF, HexagonDYLDRendezvous::loaded_begin(), HexagonDYLDRendezvous::loaded_end(), lldb_private::DynamicLoader::LoadModuleAtAddress(), lldb_private::DynamicLoader::m_process, m_rendezvous, HexagonDYLDRendezvous::ModulesDidLoad(), lldb_private::Target::ModulesDidLoad(), HexagonDYLDRendezvous::ModulesDidUnload(), lldb_private::Target::ModulesDidUnload(), lldb_private::ModuleList::Remove(), HexagonDYLDRendezvous::Resolve(), lldb_private::FileSystem::Resolve(), HexagonDYLDRendezvous::unloaded_begin(), HexagonDYLDRendezvous::unloaded_end(), and UnloadSections().
Referenced by RendezvousBreakpointHit().
|
staticprotected |
Callback routine which updates the current list of loaded modules based on the information supplied by the runtime linker.
Definition at line 305 of file DynamicLoaderHexagonDYLD.cpp.
References findSymbolAddress(), lldb_private::GetLog(), lldb_private::DynamicLoader::GetStopWhenImagesChange(), HexagonDYLDRendezvous::IsValid(), LLDB_INVALID_ADDRESS, LLDB_LOGF, lldb_private::DynamicLoader::m_process, m_rendezvous, RefreshModules(), and HexagonDYLDRendezvous::SetRendezvousAddress().
Referenced by SetRendezvousBreakpoint().
|
protected |
Enables a breakpoint on a function called by the runtime linker each time a module is loaded or unloaded.
Definition at line 257 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::Target::CreateBreakpoint(), findSymbolAddress(), lldb_private::Target::GetBreakpointByID(), lldb_private::Stoppoint::GetID(), lldb_private::GetLog(), lldb_private::Process::GetTarget(), LLDB_INVALID_ADDRESS, LLDB_INVALID_BREAK_ID, LLDB_LOGF, m_dyld_bid, lldb_private::DynamicLoader::m_process, m_rendezvous, RendezvousBreakpointHit(), HexagonDYLDRendezvous::SetBreakAddress(), lldb_private::Breakpoint::SetBreakpointKind(), and lldb_private::Breakpoint::SetCallback().
Referenced by DidAttach().
|
static |
Definition at line 80 of file DynamicLoaderHexagonDYLD.cpp.
|
overrideprotectedvirtual |
Removes the loaded sections from the target in module
.
module | The module to traverse. |
Reimplemented from lldb_private::DynamicLoader.
Definition at line 241 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::SectionList::GetSectionAtIndex(), GetSectionListFromModule(), lldb_private::SectionList::GetSize(), lldb_private::Process::GetTarget(), m_loaded_modules, lldb_private::DynamicLoader::m_process, and lldb_private::Target::SetSectionUnloaded().
Referenced by RefreshModules().
|
overrideprotectedvirtual |
Updates the load address of every allocatable section in module
.
module | The module to traverse. |
link_map_addr | The virtual address of the link map for the module . |
base_addr | The virtual base address module is loaded at. |
Reimplemented from lldb_private::DynamicLoader.
Definition at line 207 of file DynamicLoaderHexagonDYLD.cpp.
References lldb_private::SectionList::GetSectionAtIndex(), GetSectionListFromModule(), lldb_private::SectionList::GetSize(), lldb_private::Process::GetTarget(), m_loaded_modules, lldb_private::DynamicLoader::m_process, and lldb_private::Target::SetSectionLoadAddress().
Referenced by DidAttach().
|
protected |
Rendezvous breakpoint.
Definition at line 63 of file DynamicLoaderHexagonDYLD.h.
Referenced by SetRendezvousBreakpoint(), and ~DynamicLoaderHexagonDYLD().
|
protected |
Virtual entry address of the inferior process.
Definition at line 60 of file DynamicLoaderHexagonDYLD.h.
Referenced by GetEntryPoint().
|
protected |
Virtual load address of the inferior process.
Definition at line 57 of file DynamicLoaderHexagonDYLD.h.
|
protected |
Loaded module list. (link map for each module)
Definition at line 67 of file DynamicLoaderHexagonDYLD.h.
Referenced by GetThreadLocalData(), LoadAllCurrentModules(), UnloadSections(), and UpdateLoadedSections().
|
protected |
Runtime linker rendezvous structure.
Definition at line 54 of file DynamicLoaderHexagonDYLD.h.
Referenced by GetThreadLocalData(), LoadAllCurrentModules(), RefreshModules(), RendezvousBreakpointHit(), and SetRendezvousBreakpoint().