LLDB mainline
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
DynamicLoaderFreeBSDKernel Class Reference

#include <DynamicLoaderFreeBSDKernel.h>

Inheritance diagram for DynamicLoaderFreeBSDKernel:
Inheritance graph
[legend]

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::AddressGetStartAddress ()
 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
 
PluginInterfaceoperator= (const PluginInterface &)=delete
 

Static Public Member Functions

static void Initialize ()
 
static void Terminate ()
 
static llvm::StringRef GetPluginNameStatic ()
 
static llvm::StringRef GetPluginDescriptionStatic ()
 
static lldb_private::DynamicLoaderCreateInstance (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 DynamicLoaderFindPlugin (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::SectionListGetSectionListFromModule (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::Processm_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::UUIDm_kld_name_to_uuid
 
- Protected Attributes inherited from lldb_private::DynamicLoader
Processm_process
 The process that this dynamic loader plug-in is tracking.
 

Private Member Functions

 DynamicLoaderFreeBSDKernel (const DynamicLoaderFreeBSDKernel &)=delete
 
const DynamicLoaderFreeBSDKerneloperator= (const DynamicLoaderFreeBSDKernel &)=delete
 

Detailed Description

Definition at line 22 of file DynamicLoaderFreeBSDKernel.h.

Constructor & Destructor Documentation

◆ DynamicLoaderFreeBSDKernel() [1/2]

DynamicLoaderFreeBSDKernel::DynamicLoaderFreeBSDKernel ( lldb_private::Process process,
lldb::addr_t  kernel_addr 
)

◆ ~DynamicLoaderFreeBSDKernel()

DynamicLoaderFreeBSDKernel::~DynamicLoaderFreeBSDKernel ( )
override

Definition at line 256 of file DynamicLoaderFreeBSDKernel.cpp.

References Clear().

◆ DynamicLoaderFreeBSDKernel() [2/2]

DynamicLoaderFreeBSDKernel::DynamicLoaderFreeBSDKernel ( const DynamicLoaderFreeBSDKernel )
privatedelete

Member Function Documentation

◆ CanLoadImage()

Status DynamicLoaderFreeBSDKernel::CanLoadImage ( )
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.

Returns
true if it is currently ok to try and load a shared library into the process, false otherwise.

Implements lldb_private::DynamicLoader.

Definition at line 785 of file DynamicLoaderFreeBSDKernel.cpp.

References error().

◆ CheckForKernelImageAtAddress()

lldb_private::UUID DynamicLoaderFreeBSDKernel::CheckForKernelImageAtAddress ( lldb_private::Process process,
lldb::addr_t  address,
bool *  read_error = nullptr 
)
staticprotected

◆ Clear()

void DynamicLoaderFreeBSDKernel::Clear ( bool  clear_process)
protected

◆ CreateInstance()

DynamicLoader * DynamicLoaderFreeBSDKernel::CreateInstance ( lldb_private::Process process,
bool  force 
)
static

◆ DebuggerInit()

void DynamicLoaderFreeBSDKernel::DebuggerInit ( lldb_private::Debugger debugger)
static

Definition at line 244 of file DynamicLoaderFreeBSDKernel.cpp.

◆ DidAttach()

void DynamicLoaderFreeBSDKernel::DidAttach ( )
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().

◆ DidLaunch()

void DynamicLoaderFreeBSDKernel::DidLaunch ( )
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().

◆ FindFreeBSDKernel()

addr_t DynamicLoaderFreeBSDKernel::FindFreeBSDKernel ( lldb_private::Process process)
static

◆ FindKernelAtLoadAddress()

addr_t DynamicLoaderFreeBSDKernel::FindKernelAtLoadAddress ( lldb_private::Process process)
staticprotected

◆ GetPluginDescriptionStatic()

llvm::StringRef DynamicLoaderFreeBSDKernel::GetPluginDescriptionStatic ( )
static

Definition at line 52 of file DynamicLoaderFreeBSDKernel.cpp.

◆ GetPluginName()

llvm::StringRef DynamicLoaderFreeBSDKernel::GetPluginName ( )
inlineoverridevirtual

Implements lldb_private::PluginInterface.

Definition at line 56 of file DynamicLoaderFreeBSDKernel.h.

References GetPluginNameStatic().

◆ GetPluginNameStatic()

static llvm::StringRef DynamicLoaderFreeBSDKernel::GetPluginNameStatic ( )
inlinestatic

◆ GetStepThroughTrampolinePlan()

ThreadPlanSP DynamicLoaderFreeBSDKernel::GetStepThroughTrampolinePlan ( lldb_private::Thread thread,
bool  stop_others 
)
overridevirtual

Provides a plan to step through the dynamic loader trampoline for the current state of thread.

Parameters
[in]stop_othersWhether the plan should be set to stop other threads.
Returns
A pointer to the plan (caller owned) or NULL if we are not at such a trampoline.

Implements lldb_private::DynamicLoader.

Definition at line 777 of file DynamicLoaderFreeBSDKernel.cpp.

References lldb_private::GetLog(), and LLDB_LOGF.

◆ Initialize()

void DynamicLoaderFreeBSDKernel::Initialize ( )
static

◆ LoadKernelModules()

void DynamicLoaderFreeBSDKernel::LoadKernelModules ( )
protected

◆ operator=()

const DynamicLoaderFreeBSDKernel & DynamicLoaderFreeBSDKernel::operator= ( const DynamicLoaderFreeBSDKernel )
privatedelete

◆ ParseKmods()

bool DynamicLoaderFreeBSDKernel::ParseKmods ( lldb_private::Address  linker_files_head_address)
protected

◆ PrivateInitialize()

void DynamicLoaderFreeBSDKernel::PrivateInitialize ( lldb_private::Process process)
protected

Definition at line 772 of file DynamicLoaderFreeBSDKernel.cpp.

References Clear(), and m_process.

Referenced by DidAttach(), and DidLaunch().

◆ ReadAllKmods() [1/2]

void DynamicLoaderFreeBSDKernel::ReadAllKmods ( )
protected

◆ ReadAllKmods() [2/2]

bool DynamicLoaderFreeBSDKernel::ReadAllKmods ( lldb_private::Address  linker_files_head_address,
KModImageInfo::collection_type kmods_list 
)
protected

◆ ReadELFHeader()

bool DynamicLoaderFreeBSDKernel::ReadELFHeader ( lldb_private::Process process,
lldb::addr_t  address,
llvm::ELF::Elf32_Ehdr &  header,
bool *  read_error = nullptr 
)
staticprotected

◆ ReadKmodsListHeader()

bool DynamicLoaderFreeBSDKernel::ReadKmodsListHeader ( )
protected

◆ SetNotificationBreakPoint()

void DynamicLoaderFreeBSDKernel::SetNotificationBreakPoint ( )
protected

Definition at line 746 of file DynamicLoaderFreeBSDKernel.cpp.

Referenced by Update().

◆ Terminate()

void DynamicLoaderFreeBSDKernel::Terminate ( )
static

◆ Update()

void DynamicLoaderFreeBSDKernel::Update ( )
protected

Definition at line 258 of file DynamicLoaderFreeBSDKernel.cpp.

References LoadKernelModules(), and SetNotificationBreakPoint().

Referenced by DidAttach(), and DidLaunch().

Member Data Documentation

◆ m_kernel_image_info

KModImageInfo DynamicLoaderFreeBSDKernel::m_kernel_image_info
protected

Definition at line 159 of file DynamicLoaderFreeBSDKernel.h.

Referenced by Clear(), LoadKernelModules(), and ReadAllKmods().

◆ m_kernel_load_address

lldb::addr_t DynamicLoaderFreeBSDKernel::m_kernel_load_address
protected

Definition at line 158 of file DynamicLoaderFreeBSDKernel.h.

Referenced by LoadKernelModules().

◆ m_kld_name_to_uuid

std::unordered_map<std::string, lldb_private::UUID> DynamicLoaderFreeBSDKernel::m_kld_name_to_uuid
protected

Definition at line 162 of file DynamicLoaderFreeBSDKernel.h.

Referenced by ParseKmods().

◆ m_linker_file_head_addr

lldb_private::Address DynamicLoaderFreeBSDKernel::m_linker_file_head_addr
protected

Definition at line 157 of file DynamicLoaderFreeBSDKernel.h.

Referenced by Clear(), ReadAllKmods(), and ReadKmodsListHeader().

◆ m_linker_file_list_struct_addr

lldb_private::Address DynamicLoaderFreeBSDKernel::m_linker_file_list_struct_addr
protected

Definition at line 156 of file DynamicLoaderFreeBSDKernel.h.

Referenced by Clear(), LoadKernelModules(), and ReadKmodsListHeader().

◆ m_linker_files_list

KModImageInfo::collection_type DynamicLoaderFreeBSDKernel::m_linker_files_list
protected

Definition at line 160 of file DynamicLoaderFreeBSDKernel.h.

Referenced by Clear(), ParseKmods(), and ReadAllKmods().

◆ m_mutex

std::recursive_mutex DynamicLoaderFreeBSDKernel::m_mutex
protected

Definition at line 161 of file DynamicLoaderFreeBSDKernel.h.

Referenced by Clear(), ParseKmods(), ReadAllKmods(), and ReadKmodsListHeader().

◆ m_process

lldb_private::Process* DynamicLoaderFreeBSDKernel::m_process
protected

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