|
LLDB mainline
|
#include <DynamicLoaderWindowsDYLD.h>
Public Member Functions | |
| DynamicLoaderWindowsDYLD (Process *process) | |
| ~DynamicLoaderWindowsDYLD () override | |
| void | OnLoadModule (lldb::ModuleSP module_sp, const ModuleSpec module_spec, lldb::addr_t module_addr) |
| void | OnUnloadModule (lldb::addr_t module_addr) |
| void | DidAttach () override |
| Called after attaching a process. | |
| void | DidLaunch () override |
| Called after launching a process. | |
| Status | CanLoadImage () override |
| Ask if it is ok to try and load or unload an shared library (image). | |
| lldb::ThreadPlanSP | GetStepThroughTrampolinePlan (Thread &thread, bool stop) override |
| Provides a plan to step through the dynamic loader trampoline for the current state of thread. | |
| llvm::StringRef | GetPluginName () override |
| Public Member Functions inherited from lldb_private::DynamicLoader | |
| DynamicLoader (Process *process) | |
| Construct with 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 void | FindEquivalentSymbols (const 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 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, lldb_private::FileSpec &shared_cache_path, std::optional< uint64_t > &size) |
| 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. | |
| virtual void | CalculateDynamicSaveCoreRanges (lldb_private::Process &process, std::vector< lldb_private::MemoryRegionInfo > &ranges, llvm::function_ref< bool(const lldb_private::Thread &)> save_thread_predicate) |
| Returns a list of memory ranges that should be saved in the core file, specific for this dynamic loader. | |
| Public Member Functions inherited from lldb_private::PluginInterface | |
| PluginInterface ()=default | |
| virtual | ~PluginInterface ()=default |
| 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 DynamicLoader * | CreateInstance (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 | |
| lldb::addr_t | GetLoadAddress (lldb::ModuleSP executable) |
| Returns the load address for the given executable module. | |
| Protected Member Functions inherited from lldb_private::DynamicLoader | |
| lldb::ModuleSP | FindModuleViaTarget (const FileSpec &file) |
| Find a module in the target that matches the given 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) |
Protected Attributes | |
| llvm::DenseMap< lldb::addr_t, lldb::ModuleWP > | m_loaded_modules |
| Maps load addresses to their corresponding modules. | |
| Protected Attributes inherited from lldb_private::DynamicLoader | |
| Process * | m_process |
| The process that this dynamic loader plug-in is tracking. | |
Definition at line 17 of file DynamicLoaderWindowsDYLD.h.
| DynamicLoaderWindowsDYLD::DynamicLoaderWindowsDYLD | ( | Process * | process | ) |
Definition at line 29 of file DynamicLoaderWindowsDYLD.cpp.
References lldb_private::DynamicLoader::DynamicLoader(), and DynamicLoaderWindowsDYLD().
Referenced by CreateInstance(), and DynamicLoaderWindowsDYLD().
|
overridedefault |
|
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 187 of file DynamicLoaderWindowsDYLD.cpp.
References lldb_private::Status.
|
static |
Definition at line 48 of file DynamicLoaderWindowsDYLD.cpp.
References lldb_private::DynamicLoader::DynamicLoader(), DynamicLoaderWindowsDYLD(), lldb_private::Target::GetArchitecture(), lldb_private::Process::GetTarget(), and lldb_private::ArchSpec::GetTriple().
Referenced by Initialize(), and Terminate().
|
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 136 of file DynamicLoaderWindowsDYLD.cpp.
References lldb_private::ModuleList::Append(), lldb_private::DynamicLoader, error(), GetLoadAddress(), lldb_private::GetLog(), lldb_private::DynamicLoader::GetTargetExecutable(), LLDB_INVALID_ADDRESS, LLDB_LOG_ERROR, LLDB_LOGF, lldb_private::DynamicLoader::m_process, and lldb_private::DynamicLoader::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 166 of file DynamicLoaderWindowsDYLD.cpp.
References lldb_private::ModuleList::Append(), lldb_private::DynamicLoader, error(), GetLoadAddress(), lldb_private::GetLog(), lldb_private::DynamicLoader::GetTargetExecutable(), LLDB_INVALID_ADDRESS, LLDB_LOG_ERROR, LLDB_LOGF, lldb_private::DynamicLoader::m_process, and lldb_private::DynamicLoader::UpdateLoadedSections().
|
protected |
Returns the load address for the given executable module.
The lookup proceeds in two stages:
m_loaded_modules is scanned for an existing entry whose ModuleSP matches executable. Because the same ModuleSP can be inserted more than once under different base addresses (e.g. a DLL loaded into several processes, or a module that was unloaded and reloaded at a different address), the scan returns the first valid (non-LLDB_INVALID_ADDRESS) entry it finds.Process::GetFileLoadAddress is called. On a remote target the remote platform is responsible for resolving the address. A successful result is inserted into m_loaded_modules so that subsequent calls hit the cache.| executable | The module whose load address is requested. |
LLDB_INVALID_ADDRESS if it could not be determined. Definition at line 111 of file DynamicLoaderWindowsDYLD.cpp.
References LLDB_INVALID_ADDRESS, m_loaded_modules, lldb_private::DynamicLoader::m_process, and lldb_private::Status::Success().
Referenced by DidAttach(), and DidLaunch().
|
static |
Definition at line 43 of file DynamicLoaderWindowsDYLD.cpp.
Referenced by Initialize().
|
inlineoverridevirtual |
Implements lldb_private::PluginInterface.
Definition at line 40 of file DynamicLoaderWindowsDYLD.h.
References GetPluginNameStatic().
|
inlinestatic |
Definition at line 25 of file DynamicLoaderWindowsDYLD.h.
Referenced by lldb_private::ProcessWindows::GetDynamicLoader(), GetPluginName(), and Initialize().
|
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 190 of file DynamicLoaderWindowsDYLD.cpp.
References lldb_private::Disassembler::DisassembleRange(), lldb_private::eVoteNoOpinion, lldb_private::InstructionList::GetInstructionAtIndex(), lldb_private::DynamicLoader::m_process, and pc.
|
static |
Definition at line 34 of file DynamicLoaderWindowsDYLD.cpp.
References CreateInstance(), GetPluginDescriptionStatic(), GetPluginNameStatic(), and lldb_private::PluginManager::RegisterPlugin().
| void DynamicLoaderWindowsDYLD::OnLoadModule | ( | lldb::ModuleSP | module_sp, |
| const ModuleSpec | module_spec, | ||
| lldb::addr_t | module_addr ) |
Definition at line 64 of file DynamicLoaderWindowsDYLD.cpp.
References lldb_private::ModuleList::Append(), error(), m_loaded_modules, lldb_private::DynamicLoader::m_process, and lldb_private::DynamicLoader::UpdateLoadedSectionsCommon().
| void DynamicLoaderWindowsDYLD::OnUnloadModule | ( | lldb::addr_t | module_addr | ) |
|
static |
Definition at line 39 of file DynamicLoaderWindowsDYLD.cpp.
References CreateInstance(), and lldb_private::PluginManager::UnregisterPlugin().
|
protected |
Maps load addresses to their corresponding modules.
Weak pointers are used intentionally: on Windows, a Module holds a memory-mapped view of the DLL file, and an open memory mapping locks the file on disk. Holding a strong reference (ModuleSP) here would prevent the mapping from being released even after the Target drops its own reference, keeping the file locked and blocking recompilation during an active debug session.
Definition at line 74 of file DynamicLoaderWindowsDYLD.h.
Referenced by GetLoadAddress(), OnLoadModule(), and OnUnloadModule().