LLDB mainline
|
#include <DynamicLoaderFreeBSDKernel.h>
Classes | |
class | KModImageInfo |
Public Member Functions | |
DynamicLoaderFreeBSDKernel (lldb_private::Process *process, lldb::addr_t kernel_addr) | |
~DynamicLoaderFreeBSDKernel () 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). | |
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 void | DebuggerInit (lldb_private::Debugger &debugger) |
static lldb::addr_t | FindFreeBSDKernel (lldb_private::Process *process) |
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 | |
void | PrivateInitialize (lldb_private::Process *process) |
void | Clear (bool clear_process) |
void | Update () |
void | LoadKernelModules () |
void | ReadAllKmods () |
bool | ReadAllKmods (lldb_private::Address linker_files_head_address, KModImageInfo::collection_type &kmods_list) |
bool | ReadKmodsListHeader () |
bool | ParseKmods (lldb_private::Address linker_files_head_address) |
void | SetNotificationBreakPoint () |
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 lldb_private::UUID | CheckForKernelImageAtAddress (lldb_private::Process *process, lldb::addr_t address, bool *read_error=nullptr) |
static lldb::addr_t | FindKernelAtLoadAddress (lldb_private::Process *process) |
static bool | ReadELFHeader (lldb_private::Process *process, lldb::addr_t address, llvm::ELF::Elf32_Ehdr &header, bool *read_error=nullptr) |
Protected Attributes | |
lldb_private::Process * | m_process |
lldb_private::Address | m_linker_file_list_struct_addr |
lldb_private::Address | m_linker_file_head_addr |
lldb::addr_t | m_kernel_load_address |
KModImageInfo | m_kernel_image_info |
KModImageInfo::collection_type | m_linker_files_list |
std::recursive_mutex | m_mutex |
std::unordered_map< std::string, lldb_private::UUID > | m_kld_name_to_uuid |
Protected Attributes inherited from lldb_private::DynamicLoader | |
Process * | m_process |
The process that this dynamic loader plug-in is tracking. | |
Private Member Functions | |
DynamicLoaderFreeBSDKernel (const DynamicLoaderFreeBSDKernel &)=delete | |
const DynamicLoaderFreeBSDKernel & | operator= (const DynamicLoaderFreeBSDKernel &)=delete |
Definition at line 22 of file DynamicLoaderFreeBSDKernel.h.
DynamicLoaderFreeBSDKernel::DynamicLoaderFreeBSDKernel | ( | lldb_private::Process * | process, |
lldb::addr_t | kernel_addr | ||
) |
Definition at line 247 of file DynamicLoaderFreeBSDKernel.cpp.
References lldb_private::Process::SetCanRunCode().
|
override |
Definition at line 256 of file DynamicLoaderFreeBSDKernel.cpp.
References Clear().
|
privatedelete |
|
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 785 of file DynamicLoaderFreeBSDKernel.cpp.
References error().
|
staticprotected |
Definition at line 178 of file DynamicLoaderFreeBSDKernel.cpp.
References lldb_private::Target::GetArchitecture(), lldb_private::GetLog(), lldb_private::Process::GetTarget(), lldb_private::ArchSpec::GetTriple(), lldb_private::ArchSpec::IsCompatibleMatch(), LLDB_INVALID_ADDRESS, LLDB_LOGF, ReadELFHeader(), lldb_private::Process::ReadModuleFromMemory(), and lldb_private::Target::SetArchitecture().
Referenced by CreateInstance(), and FindKernelAtLoadAddress().
|
protected |
Definition at line 761 of file DynamicLoaderFreeBSDKernel.cpp.
References lldb_private::Address::Clear(), DynamicLoaderFreeBSDKernel::KModImageInfo::Clear(), m_kernel_image_info, m_linker_file_head_addr, m_linker_file_list_struct_addr, m_linker_files_list, m_mutex, and m_process.
Referenced by PrivateInitialize(), and ~DynamicLoaderFreeBSDKernel().
|
static |
Definition at line 100 of file DynamicLoaderFreeBSDKernel.cpp.
References CheckForKernelImageAtAddress(), FindFreeBSDKernel(), lldb_private::Target::GetArchitecture(), lldb_private::Target::GetExecutableModulePointer(), lldb_private::Process::GetTarget(), lldb_private::ArchSpec::GetTriple(), and is_kernel().
Referenced by Terminate().
|
static |
Definition at line 244 of file DynamicLoaderFreeBSDKernel.cpp.
|
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 749 of file DynamicLoaderFreeBSDKernel.cpp.
References m_process, PrivateInitialize(), and Update().
|
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 755 of file DynamicLoaderFreeBSDKernel.cpp.
References m_process, PrivateInitialize(), and Update().
|
static |
Definition at line 127 of file DynamicLoaderFreeBSDKernel.cpp.
References FindKernelAtLoadAddress(), lldb_private::Process::GetImageInfoAddress(), and LLDB_INVALID_ADDRESS.
Referenced by CreateInstance().
|
staticprotected |
Definition at line 135 of file DynamicLoaderFreeBSDKernel.cpp.
References CheckForKernelImageAtAddress(), lldb_private::ObjectFile::GetBaseAddress(), lldb_private::Target::GetExecutableModulePointer(), lldb_private::Address::GetFileAddress(), lldb_private::Module::GetObjectFile(), lldb_private::Process::GetTarget(), is_kernel(), lldb_private::Address::IsValid(), lldb_private::UUID::IsValid(), and LLDB_INVALID_ADDRESS.
Referenced by FindFreeBSDKernel().
|
static |
Definition at line 52 of file DynamicLoaderFreeBSDKernel.cpp.
|
inlineoverridevirtual |
Implements lldb_private::PluginInterface.
Definition at line 56 of file DynamicLoaderFreeBSDKernel.h.
References GetPluginNameStatic().
|
inlinestatic |
Definition at line 35 of file DynamicLoaderFreeBSDKernel.h.
Referenced by ProcessFreeBSDKernel::GetDynamicLoader(), and GetPluginName().
|
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 777 of file DynamicLoaderFreeBSDKernel.cpp.
References lldb_private::GetLog(), and LLDB_LOGF.
|
static |
Definition at line 42 of file DynamicLoaderFreeBSDKernel.cpp.
References lldb_private::PluginManager::RegisterPlugin().
|
protected |
Definition at line 687 of file DynamicLoaderFreeBSDKernel.cpp.
References DynamicLoaderFreeBSDKernel::KModImageInfo::Clear(), lldb::eSymbolTypeData, lldb_private::Symbol::GetAddress(), lldb_private::Target::GetExecutableModule(), DynamicLoaderFreeBSDKernel::KModImageInfo::GetLoadAddress(), lldb_private::GetLog(), DynamicLoaderFreeBSDKernel::KModImageInfo::GetModule(), lldb_private::Process::GetTarget(), is_kernel(), DynamicLoaderFreeBSDKernel::KModImageInfo::IsLoaded(), LLDB_INVALID_ADDRESS, LLDB_LOGF, DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingFileAddress(), DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingMemoryModule(), lldb_private::DynamicLoader::LoadOperatingSystemPlugin(), m_kernel_image_info, m_kernel_load_address, m_linker_file_list_struct_addr, m_process, ReadAllKmods(), DynamicLoaderFreeBSDKernel::KModImageInfo::SetIsKernel(), DynamicLoaderFreeBSDKernel::KModImageInfo::SetLoadAddress(), DynamicLoaderFreeBSDKernel::KModImageInfo::SetModule(), and DynamicLoaderFreeBSDKernel::KModImageInfo::SetName().
Referenced by Update().
|
privatedelete |
|
protected |
Definition at line 529 of file DynamicLoaderFreeBSDKernel.cpp.
References lldb_private::ModuleList::AppendIfNeeded(), lldb_private::Target::GetImages(), lldb_private::GetLog(), lldb_private::Process::GetTarget(), is_kernel(), is_kmod(), LLDB_LOGF, m_kld_name_to_uuid, m_linker_files_list, m_mutex, m_process, lldb_private::ModuleList::Modules(), lldb_private::Target::ModulesDidLoad(), lldb_private::Target::ModulesDidUnload(), and ReadAllKmods().
Referenced by ReadAllKmods().
|
protected |
Definition at line 772 of file DynamicLoaderFreeBSDKernel.cpp.
References Clear(), and m_process.
Referenced by DidAttach(), and DidLaunch().
|
protected |
Definition at line 675 of file DynamicLoaderFreeBSDKernel.cpp.
References lldb_private::Address::IsValid(), m_linker_file_head_addr, m_linker_files_list, m_mutex, ParseKmods(), and ReadKmodsListHeader().
Referenced by LoadKernelModules(), and ParseKmods().
|
protected |
Definition at line 575 of file DynamicLoaderFreeBSDKernel.cpp.
References error(), lldb::eSymbolTypeData, lldb_private::Symbol::GetAddress(), lldb_private::Address::GetLoadAddress(), DynamicLoaderFreeBSDKernel::KModImageInfo::GetModule(), DynamicLoaderFreeBSDKernel::KModImageInfo::GetName(), lldb_private::Process::GetTarget(), LLDB_INVALID_ADDRESS, m_kernel_image_info, m_process, lldb_private::Process::ReadCStringFromMemory(), lldb_private::Process::ReadPointerFromMemory(), lldb_private::Process::ReadSignedIntegerFromMemory(), DynamicLoaderFreeBSDKernel::KModImageInfo::SetLoadAddress(), DynamicLoaderFreeBSDKernel::KModImageInfo::SetName(), and DynamicLoaderFreeBSDKernel::KModImageInfo::SetPath().
|
staticprotected |
Definition at line 156 of file DynamicLoaderFreeBSDKernel.cpp.
References error(), and lldb_private::Process::ReadMemory().
Referenced by CheckForKernelImageAtAddress(), and DynamicLoaderFreeBSDKernel::KModImageInfo::ReadMemoryModule().
|
protected |
Definition at line 503 of file DynamicLoaderFreeBSDKernel.cpp.
References lldb_private::Address::Clear(), error(), lldb_private::Address::GetFileAddress(), lldb_private::Address::GetLoadAddress(), lldb_private::Process::GetTarget(), lldb_private::Address::IsValid(), LLDB_INVALID_ADDRESS, m_linker_file_head_addr, m_linker_file_list_struct_addr, m_mutex, m_process, and lldb_private::Process::ReadPointerFromMemory().
Referenced by ReadAllKmods().
|
protected |
Definition at line 746 of file DynamicLoaderFreeBSDKernel.cpp.
Referenced by Update().
|
static |
Definition at line 48 of file DynamicLoaderFreeBSDKernel.cpp.
References CreateInstance(), and lldb_private::PluginManager::UnregisterPlugin().
|
protected |
Definition at line 258 of file DynamicLoaderFreeBSDKernel.cpp.
References LoadKernelModules(), and SetNotificationBreakPoint().
Referenced by DidAttach(), and DidLaunch().
|
protected |
Definition at line 159 of file DynamicLoaderFreeBSDKernel.h.
Referenced by Clear(), LoadKernelModules(), and ReadAllKmods().
|
protected |
Definition at line 158 of file DynamicLoaderFreeBSDKernel.h.
Referenced by LoadKernelModules().
|
protected |
Definition at line 162 of file DynamicLoaderFreeBSDKernel.h.
Referenced by ParseKmods().
|
protected |
Definition at line 157 of file DynamicLoaderFreeBSDKernel.h.
Referenced by Clear(), ReadAllKmods(), and ReadKmodsListHeader().
|
protected |
Definition at line 156 of file DynamicLoaderFreeBSDKernel.h.
Referenced by Clear(), LoadKernelModules(), and ReadKmodsListHeader().
|
protected |
Definition at line 160 of file DynamicLoaderFreeBSDKernel.h.
Referenced by Clear(), ParseKmods(), and ReadAllKmods().
|
protected |
Definition at line 161 of file DynamicLoaderFreeBSDKernel.h.
Referenced by Clear(), ParseKmods(), ReadAllKmods(), and ReadKmodsListHeader().
|
protected |
Definition at line 155 of file DynamicLoaderFreeBSDKernel.h.
Referenced by Clear(), DidAttach(), DidLaunch(), LoadKernelModules(), ParseKmods(), PrivateInitialize(), ReadAllKmods(), and ReadKmodsListHeader().