22#include "llvm/TargetParser/Triple.h"
42 return "Dynamic loader plug-in that watches for shared library "
43 "loads/unloads in Windows processes.";
48 bool should_create = force;
50 const llvm::Triple &triple_ref =
52 if (triple_ref.getOS() == llvm::Triple::Win32)
78 module_list.
Append(module_sp);
92 module_list.
Append(module_sp);
107 FileSpec file_spec(executable->GetPlatformFileSpec());
108 bool is_loaded =
false;
122 LLDB_LOGF(log,
"DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
126 if (!executable.get())
137 if (image_base == load_addr)
144 module_list.
Append(executable);
152 LLDB_LOGF(log,
"DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
155 if (!executable.get())
164 module_list.
Append(executable);
177 if (arch.GetMachine() != llvm::Triple::x86) {
187 if (!disassembler_sp) {
192 if (insn_list ==
nullptr) {
206 if (first_insn ==
nullptr || second_insn ==
nullptr ||
207 strcmp(first_insn->GetMnemonic(&exe_ctx),
"jmpl") != 0 ||
208 strcmp(second_insn->GetMnemonic(&exe_ctx),
"nop") != 0) {
212 assert(first_insn->DoesBranch() && !second_insn->DoesBranch());
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
#define LLDB_LOG_ERROR(log, error,...)
#define LLDB_PLUGIN_DEFINE(PluginName)
A section + offset based address range class.
A section + offset based address class.
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
llvm::Triple & GetTriple()
Architecture triple accessor.
static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch, const char *plugin_name, const char *flavor, Target &target, const AddressRange &disasm_range, bool force_live_memory=false)
void DidAttach() override
Called after attaching a process.
void DidLaunch() override
Called after launching a process.
static llvm::StringRef GetPluginDescriptionStatic()
~DynamicLoaderWindowsDYLD() override
Status CanLoadImage() override
Ask if it is ok to try and load or unload an shared library (image).
static llvm::StringRef GetPluginNameStatic()
void OnLoadModule(lldb::ModuleSP module_sp, const ModuleSpec module_spec, lldb::addr_t module_addr)
lldb::addr_t GetLoadAddress(lldb::ModuleSP executable)
std::map< lldb::ModuleSP, lldb::addr_t > m_loaded_modules
void OnUnloadModule(lldb::addr_t module_addr)
static DynamicLoader * CreateInstance(Process *process, bool force)
lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop) override
Provides a plan to step through the dynamic loader trampoline for the current state of thread.
A plug-in interface definition class for dynamic loaders.
Process * m_process
The process that this dynamic loader plug-in is tracking.
void UpdateLoadedSectionsCommon(lldb::ModuleSP module, lldb::addr_t base_addr, bool base_addr_is_offset)
lldb::ModuleSP GetTargetExecutable()
Checks to see if the target module has changed, updates the target accordingly and returns the target...
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 UnloadSectionsCommon(const lldb::ModuleSP module)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const
A collection class for Module objects.
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
A plug-in interface definition class for debugging a process.
virtual lldb::addr_t GetImageInfoAddress()
Get the image information address for the current process.
virtual Status GetFileLoadAddress(const FileSpec &file, bool &is_loaded, lldb::addr_t &load_addr)
Try to find the load address of a file.
virtual llvm::Error LoadModules()
Sometimes processes know how to retrieve and load shared libraries.
Target & GetTarget()
Get the target object pointer for this module.
bool Success() const
Test for success condition.
void ModulesDidLoad(ModuleList &module_list)
lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr=nullptr)
Find a binary on the system and return its Module, or return an existing Module that is already in th...
void ModulesDidUnload(ModuleList &module_list, bool delete_locations)
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow)
const ArchSpec & GetArchitecture() const
virtual lldb::RegisterContextSP GetRegisterContext()=0
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
std::shared_ptr< lldb_private::Module > ModuleSP