diff options
Diffstat (limited to 'source/Plugins/DynamicLoader')
8 files changed, 198 insertions, 195 deletions
diff --git a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 2308129..2849317 100644 --- a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -104,11 +104,6 @@ DynamicLoaderHexagonDYLD::GetPluginDescriptionStatic() "loads/unloads in Hexagon processes."; } -void -DynamicLoaderHexagonDYLD::GetPluginCommandHelp(const char *command, Stream *strm) -{ -} - uint32_t DynamicLoaderHexagonDYLD::GetPluginVersion() { @@ -177,7 +172,7 @@ DynamicLoaderHexagonDYLD::DidAttach() // Map the loaded sections of this executable if ( load_offset != LLDB_INVALID_ADDRESS ) - UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset); + UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true); // AD: confirm this? // Load into LLDB all of the currently loaded executables in the stub @@ -248,18 +243,6 @@ DynamicLoaderHexagonDYLD::GetTargetExecutable() return executable; } -Error -DynamicLoaderHexagonDYLD::ExecutePluginCommand(Args &command, Stream *strm) -{ - return Error(); -} - -Log * -DynamicLoaderHexagonDYLD::EnablePluginLogging(Stream *strm, Args &command) -{ - return NULL; -} - //AD: Needs to be updated? Error DynamicLoaderHexagonDYLD::CanLoadImage() @@ -268,7 +251,10 @@ DynamicLoaderHexagonDYLD::CanLoadImage() } void -DynamicLoaderHexagonDYLD::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr, addr_t base_addr) +DynamicLoaderHexagonDYLD::UpdateLoadedSections(ModuleSP module, + addr_t link_map_addr, + addr_t base_addr, + bool base_addr_is_offset) { Target &target = m_process->GetTarget(); const SectionList *sections = GetSectionListFromModule(module); @@ -442,7 +428,7 @@ DynamicLoaderHexagonDYLD::RefreshModules() for (I = m_rendezvous.loaded_begin(); I != E; ++I) { FileSpec file(I->path.c_str(), true); - ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr); + ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr, true); if (module_sp.get()) { loaded_modules.AppendIfNeeded( module_sp ); @@ -571,7 +557,7 @@ DynamicLoaderHexagonDYLD::LoadAllCurrentModules() { const char *module_path = I->path.c_str(); FileSpec file(module_path, false); - ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr); + ModuleSP module_sp = LoadModuleAtAddress(file, I->link_addr, I->base_addr, true); if (module_sp.get()) { module_list.Append(module_sp); @@ -591,7 +577,10 @@ DynamicLoaderHexagonDYLD::LoadAllCurrentModules() /// Helper for the entry breakpoint callback. Resolves the load addresses /// of all dependent modules. ModuleSP -DynamicLoaderHexagonDYLD::LoadModuleAtAddress(const FileSpec &file, addr_t link_map_addr, addr_t base_addr) +DynamicLoaderHexagonDYLD::LoadModuleAtAddress(const FileSpec &file, + addr_t link_map_addr, + addr_t base_addr, + bool base_addr_is_offset) { Target &target = m_process->GetTarget(); ModuleList &modules = target.GetImages(); @@ -602,12 +591,12 @@ DynamicLoaderHexagonDYLD::LoadModuleAtAddress(const FileSpec &file, addr_t link_ // check if module is currently loaded if ((module_sp = modules.FindFirstModule (module_spec))) { - UpdateLoadedSections(module_sp, link_map_addr, base_addr); + UpdateLoadedSections(module_sp, link_map_addr, base_addr, true); } // try to load this module from disk else if ((module_sp = target.GetSharedModule(module_spec))) { - UpdateLoadedSections(module_sp, link_map_addr, base_addr); + UpdateLoadedSections(module_sp, link_map_addr, base_addr, true); } return module_sp; diff --git a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h index aafa385..e10d4ee 100644 --- a/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h +++ b/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h @@ -7,12 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_DynamicLoaderHexagon_H_ -#define liblldb_DynamicLoaderHexagon_H_ +#ifndef liblldb_DynamicLoaderHexagonDYLD_h_ +#define liblldb_DynamicLoaderHexagonDYLD_h_ // C Includes // C++ Includes // Other libraries and framework includes +// Project includes #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Target/DynamicLoader.h" @@ -21,6 +22,9 @@ class DynamicLoaderHexagonDYLD : public lldb_private::DynamicLoader { public: + DynamicLoaderHexagonDYLD(lldb_private::Process *process); + + ~DynamicLoaderHexagonDYLD() override; static void Initialize(); @@ -37,48 +41,34 @@ public: static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force); - DynamicLoaderHexagonDYLD(lldb_private::Process *process); - - virtual - ~DynamicLoaderHexagonDYLD(); - //------------------------------------------------------------------ // DynamicLoader protocol //------------------------------------------------------------------ - virtual void - DidAttach(); + void + DidAttach() override; - virtual void - DidLaunch(); + void + DidLaunch() override; - virtual lldb::ThreadPlanSP + lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, - bool stop_others); + bool stop_others) override; - virtual lldb_private::Error - CanLoadImage(); + lldb_private::Error + CanLoadImage() override; - virtual lldb::addr_t - GetThreadLocalData (const lldb::ModuleSP module, const lldb::ThreadSP thread); + lldb::addr_t + GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread) override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); + lldb_private::ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion(); - - virtual void - GetPluginCommandHelp(const char *command, lldb_private::Stream *strm); - - virtual lldb_private::Error - ExecutePluginCommand(lldb_private::Args &command, lldb_private::Stream *strm); - - virtual lldb_private::Log * - EnablePluginLogging(lldb_private::Stream *strm, lldb_private::Args &command); + uint32_t + GetPluginVersion() override; protected: /// Runtime linker rendezvous structure. @@ -124,18 +114,22 @@ protected: void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr, - lldb::addr_t base_addr); + lldb::addr_t base_addr, + bool base_addr_is_offset) override; /// Removes the loaded sections from the target in @p module. /// /// @param module The module to traverse. void - UnloadSections(const lldb::ModuleSP module); + UnloadSections(const lldb::ModuleSP module) override; /// Locates or creates a module given by @p file and updates/loads the /// resulting module at the virtual base address @p base_addr. lldb::ModuleSP - LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr); + LoadModuleAtAddress(const lldb_private::FileSpec &file, + lldb::addr_t link_map_addr, + lldb::addr_t base_addr, + bool base_addr_is_offset) override; /// Callback routine invoked when we hit the breakpoint on process entry. /// @@ -173,10 +167,10 @@ protected: FindRendezvousBreakpointAddress( ); private: - DISALLOW_COPY_AND_ASSIGN(DynamicLoaderHexagonDYLD); - const lldb_private::SectionList * GetSectionListFromModule(const lldb::ModuleSP module) const; + + DISALLOW_COPY_AND_ASSIGN(DynamicLoaderHexagonDYLD); }; -#endif // liblldb_DynamicLoaderHexagonDYLD_H_ +#endif // liblldb_DynamicLoaderHexagonDYLD_h_ diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index 8b1dd28..09e874a 100644 --- a/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -17,6 +17,7 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -290,19 +291,13 @@ DYLDRendezvous::SOEntryIsMainExecutable(const SOEntry &entry) // FreeBSD and on Android it is the full path to the executable. auto triple = m_process->GetTarget().GetArchitecture().GetTriple(); - auto os_type = triple.getOS(); - auto env_type = triple.getEnvironment(); - - switch (os_type) { + switch (triple.getOS()) { case llvm::Triple::FreeBSD: return entry.file_spec == m_exe_file_spec; case llvm::Triple::Linux: - switch (env_type) { - case llvm::Triple::Android: - return entry.file_spec == m_exe_file_spec; - default: - return !entry.file_spec; - } + if (triple.isAndroid()) + return entry.file_spec == m_exe_file_spec; + return !entry.file_spec; default: return false; } @@ -372,6 +367,25 @@ DYLDRendezvous::ReadStringFromMemory(addr_t addr) return str; } +// Returns true if the load bias reported by the linker is incorrect for the given entry. This +// function is used to handle cases where we want to work around a bug in the system linker. +static bool +isLoadBiasIncorrect(Target& target, const std::string& file_path) +{ + // On Android L (API 21, 22) the load address of the "/system/bin/linker" isn't filled in + // correctly. + uint32_t os_major = 0, os_minor = 0, os_update = 0; + if (target.GetArchitecture().GetTriple().isAndroid() && + target.GetPlatform()->GetOSVersion(os_major, os_minor, os_update) && + (os_major == 21 || os_major == 22) && + (file_path == "/system/bin/linker" || file_path == "/system/bin/linker64")) + { + return true; + } + + return false; +} + bool DYLDRendezvous::ReadSOEntryFromMemory(lldb::addr_t addr, SOEntry &entry) { @@ -413,11 +427,9 @@ DYLDRendezvous::ReadSOEntryFromMemory(lldb::addr_t addr, SOEntry &entry) std::string file_path = ReadStringFromMemory(entry.path_addr); entry.file_spec.SetFile(file_path, false); - // On Android L (5.0, 5.1) the load address of the "/system/bin/linker" isn't filled in - // correctly. To get the correct load address we fetch the load address of the file from the - // proc file system. - if (arch.GetTriple().getEnvironment() == llvm::Triple::Android && entry.base_addr == 0 && - (file_path == "/system/bin/linker" || file_path == "/system/bin/linker64")) + // If the load bias reported by the linker is incorrect then fetch the load address of the file + // from the proc file system. + if (isLoadBiasIncorrect(m_process->GetTarget(), file_path)) { lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; bool is_loaded = false; diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 8724fc0..6ba7b47 100644 --- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -62,11 +62,6 @@ DynamicLoaderPOSIXDYLD::GetPluginDescriptionStatic() "loads/unloads in POSIX processes."; } -void -DynamicLoaderPOSIXDYLD::GetPluginCommandHelp(const char *command, Stream *strm) -{ -} - uint32_t DynamicLoaderPOSIXDYLD::GetPluginVersion() { @@ -96,7 +91,8 @@ DynamicLoaderPOSIXDYLD::DynamicLoaderPOSIXDYLD(Process *process) m_load_offset(LLDB_INVALID_ADDRESS), m_entry_point(LLDB_INVALID_ADDRESS), m_auxv(), - m_dyld_bid(LLDB_INVALID_BREAK_ID) + m_dyld_bid(LLDB_INVALID_BREAK_ID), + m_vdso_base(LLDB_INVALID_ADDRESS) { } @@ -131,6 +127,8 @@ DynamicLoaderPOSIXDYLD::DidAttach() if (log) log->Printf ("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " executable '%s', load_offset 0x%" PRIx64, __FUNCTION__, m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID, executable_sp ? executable_sp->GetFileSpec().GetPath().c_str () : "<null executable>", load_offset); + EvalVdsoStatus(); + // if we dont have a load address we cant re-base bool rebase_exec = (load_offset == LLDB_INVALID_ADDRESS) ? false : true; @@ -165,7 +163,7 @@ DynamicLoaderPOSIXDYLD::DidAttach() m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID, executable_sp->GetFileSpec().GetPath().c_str ()); - UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset); + UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset, true); // When attaching to a target, there are two possible states: // (1) We already crossed the entry point and therefore the rendezvous @@ -218,12 +216,13 @@ DynamicLoaderPOSIXDYLD::DidLaunch() executable = GetTargetExecutable(); load_offset = ComputeLoadOffset(); + EvalVdsoStatus(); if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) { ModuleList module_list; module_list.Append(executable); - UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset); + UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true); if (log) log->Printf ("DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()", __FUNCTION__); @@ -234,29 +233,19 @@ DynamicLoaderPOSIXDYLD::DidLaunch() } Error -DynamicLoaderPOSIXDYLD::ExecutePluginCommand(Args &command, Stream *strm) -{ - return Error(); -} - -Log * -DynamicLoaderPOSIXDYLD::EnablePluginLogging(Stream *strm, Args &command) -{ - return NULL; -} - -Error DynamicLoaderPOSIXDYLD::CanLoadImage() { return Error(); } void -DynamicLoaderPOSIXDYLD::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr, addr_t base_addr) +DynamicLoaderPOSIXDYLD::UpdateLoadedSections(ModuleSP module, + addr_t link_map_addr, + addr_t base_addr, + bool base_addr_is_offset) { m_loaded_modules[module] = link_map_addr; - - UpdateLoadedSectionsCommon(module, base_addr); + UpdateLoadedSectionsCommon(module, base_addr, base_addr_is_offset); } void @@ -414,7 +403,7 @@ DynamicLoaderPOSIXDYLD::RefreshModules() E = m_rendezvous.loaded_end(); for (I = m_rendezvous.loaded_begin(); I != E; ++I) { - ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr); + ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true); if (module_sp.get()) { loaded_modules.AppendIfNeeded(module_sp); @@ -432,8 +421,7 @@ DynamicLoaderPOSIXDYLD::RefreshModules() for (I = m_rendezvous.unloaded_begin(); I != E; ++I) { ModuleSpec module_spec{I->file_spec}; - ModuleSP module_sp = - loaded_modules.FindFirstModule (module_spec); + ModuleSP module_sp = loaded_modules.FindFirstModule (module_spec); if (module_sp.get()) { @@ -519,11 +507,18 @@ DynamicLoaderPOSIXDYLD::LoadAllCurrentModules() // that ourselves here. ModuleSP executable = GetTargetExecutable(); m_loaded_modules[executable] = m_rendezvous.GetLinkMapAddress(); - - + if (m_vdso_base != LLDB_INVALID_ADDRESS) + { + FileSpec file_spec("[vdso]", false); + ModuleSP module_sp = LoadModuleAtAddress(file_spec, LLDB_INVALID_ADDRESS, m_vdso_base, false); + if (module_sp.get()) + { + module_list.Append(module_sp); + } + } for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) { - ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr); + ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true); if (module_sp.get()) { module_list.Append(module_sp); @@ -568,6 +563,16 @@ DynamicLoaderPOSIXDYLD::ComputeLoadOffset() return m_load_offset; } +void +DynamicLoaderPOSIXDYLD::EvalVdsoStatus() +{ + AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR); + + if (I != m_auxv->end()) + m_vdso_base = I->value; + +} + addr_t DynamicLoaderPOSIXDYLD::GetEntryPoint() { diff --git a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h index 68d3059..cb97bbf 100644 --- a/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ b/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -1,4 +1,4 @@ -//===-- DynamicLoaderPOSIX.h ------------------------------------*- C++ -*-===// +//===-- DynamicLoaderPOSIXDYLD.h --------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,12 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_DynamicLoaderPOSIX_H_ -#define liblldb_DynamicLoaderPOSIX_H_ +#ifndef liblldb_DynamicLoaderPOSIXDYLD_h_ +#define liblldb_DynamicLoaderPOSIXDYLD_h_ // C Includes // C++ Includes // Other libraries and framework includes +// Project includes #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Target/DynamicLoader.h" @@ -23,6 +24,9 @@ class AuxVector; class DynamicLoaderPOSIXDYLD : public lldb_private::DynamicLoader { public: + DynamicLoaderPOSIXDYLD(lldb_private::Process *process); + + ~DynamicLoaderPOSIXDYLD() override; static void Initialize(); @@ -39,48 +43,34 @@ public: static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force); - DynamicLoaderPOSIXDYLD(lldb_private::Process *process); - - virtual - ~DynamicLoaderPOSIXDYLD(); - //------------------------------------------------------------------ // DynamicLoader protocol //------------------------------------------------------------------ - virtual void - DidAttach(); + void + DidAttach() override; - virtual void - DidLaunch(); + void + DidLaunch() override; - virtual lldb::ThreadPlanSP + lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, - bool stop_others); + bool stop_others) override; - virtual lldb_private::Error - CanLoadImage(); + lldb_private::Error + CanLoadImage() override; - virtual lldb::addr_t - GetThreadLocalData (const lldb::ModuleSP module, const lldb::ThreadSP thread); + lldb::addr_t + GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread) override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); - - virtual uint32_t - GetPluginVersion(); - - virtual void - GetPluginCommandHelp(const char *command, lldb_private::Stream *strm); + lldb_private::ConstString + GetPluginName() override; - virtual lldb_private::Error - ExecutePluginCommand(lldb_private::Args &command, lldb_private::Stream *strm); - - virtual lldb_private::Log * - EnablePluginLogging(lldb_private::Stream *strm, lldb_private::Args &command); + uint32_t + GetPluginVersion() override; protected: /// Runtime linker rendezvous structure. @@ -98,12 +88,16 @@ protected: /// Rendezvous breakpoint. lldb::break_id_t m_dyld_bid; + /// Contains AT_SYSINFO_EHDR, which means a vDSO has been + /// mapped to the address space + lldb::addr_t m_vdso_base; + /// Loaded module list. (link map for each module) std::map<lldb::ModuleWP, lldb::addr_t, std::owner_less<lldb::ModuleWP>> m_loaded_modules; /// Enables a breakpoint on a function called by the runtime /// linker each time a module is loaded or unloaded. - void + virtual void SetRendezvousBreakpoint(); /// Callback routine which updates the current list of loaded modules based @@ -126,16 +120,17 @@ protected: /// @param link_map_addr The virtual address of the link map for the @p module. /// /// @param base_addr The virtual base address @p module is loaded at. - virtual void + void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr, - lldb::addr_t base_addr); + lldb::addr_t base_addr, + bool base_addr_is_offset) override; /// Removes the loaded sections from the target in @p module. /// /// @param module The module to traverse. - virtual void - UnloadSections(const lldb::ModuleSP module); + void + UnloadSections(const lldb::ModuleSP module) override; /// Resolves the entry point for the current inferior process and sets a /// breakpoint at that address. @@ -155,7 +150,7 @@ protected: /// Helper for the entry breakpoint callback. Resolves the load addresses /// of all dependent modules. - void + virtual void LoadAllCurrentModules(); /// Computes a value for m_load_offset returning the computed address on @@ -168,6 +163,11 @@ protected: lldb::addr_t GetEntryPoint(); + /// Evaluate if Aux vectors contain vDSO information + /// in case they do, read and assign the address to m_vdso_base + void + EvalVdsoStatus(); + /// Loads Module from inferior process. void ResolveExecutableModule(lldb::ModuleSP &module_sp); @@ -176,4 +176,4 @@ private: DISALLOW_COPY_AND_ASSIGN(DynamicLoaderPOSIXDYLD); }; -#endif // liblldb_DynamicLoaderPOSIXDYLD_H_ +#endif // liblldb_DynamicLoaderPOSIXDYLD_h_ diff --git a/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h b/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h index ea33164..a7fdf4d 100644 --- a/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h +++ b/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h @@ -12,12 +12,8 @@ // C Includes // C++ Includes -#include <map> -#include <vector> -#include <string> - // Other libraries and framework includes - +// Project includes #include "lldb/Target/DynamicLoader.h" #include "lldb/Host/FileSpec.h" #include "lldb/Core/UUID.h" @@ -27,6 +23,10 @@ class DynamicLoaderStatic : public lldb_private::DynamicLoader { public: + DynamicLoaderStatic(lldb_private::Process *process); + + ~DynamicLoaderStatic() override; + //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -45,37 +45,33 @@ public: static lldb_private::DynamicLoader * CreateInstance (lldb_private::Process *process, bool force); - DynamicLoaderStatic (lldb_private::Process *process); - - virtual - ~DynamicLoaderStatic (); //------------------------------------------------------------------ /// Called after attaching a process. /// /// Allow DynamicLoader plug-ins to execute some code after /// attaching to a process. //------------------------------------------------------------------ - virtual void - DidAttach (); + void + DidAttach() override; - virtual void - DidLaunch (); + void + DidLaunch() override; - virtual lldb::ThreadPlanSP - GetStepThroughTrampolinePlan (lldb_private::Thread &thread, - bool stop_others); + lldb::ThreadPlanSP + GetStepThroughTrampolinePlan(lldb_private::Thread &thread, + bool stop_others) override; - virtual lldb_private::Error - CanLoadImage (); + lldb_private::Error + CanLoadImage() override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); + lldb_private::ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion(); + uint32_t + GetPluginVersion() override; private: void @@ -84,4 +80,4 @@ private: DISALLOW_COPY_AND_ASSIGN (DynamicLoaderStatic); }; -#endif // liblldb_DynamicLoaderStatic_h_ +#endif // liblldb_DynamicLoaderStatic_h_ diff --git a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp index 56b56ab..dd391b4 100644 --- a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -21,40 +21,39 @@ using namespace lldb_private; DynamicLoaderWindowsDYLD::DynamicLoaderWindowsDYLD(Process *process) : DynamicLoader(process) { - } DynamicLoaderWindowsDYLD::~DynamicLoaderWindowsDYLD() { - } -void DynamicLoaderWindowsDYLD::Initialize() +void +DynamicLoaderWindowsDYLD::Initialize() { - PluginManager::RegisterPlugin(GetPluginNameStatic(), - GetPluginDescriptionStatic(), - CreateInstance); + PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); } -void DynamicLoaderWindowsDYLD::Terminate() +void +DynamicLoaderWindowsDYLD::Terminate() { - } -ConstString DynamicLoaderWindowsDYLD::GetPluginNameStatic() +ConstString +DynamicLoaderWindowsDYLD::GetPluginNameStatic() { static ConstString g_plugin_name("windows-dyld"); return g_plugin_name; } -const char *DynamicLoaderWindowsDYLD::GetPluginDescriptionStatic() +const char * +DynamicLoaderWindowsDYLD::GetPluginDescriptionStatic() { return "Dynamic loader plug-in that watches for shared library " "loads/unloads in Windows processes."; } - -DynamicLoader *DynamicLoaderWindowsDYLD::CreateInstance(Process *process, bool force) +DynamicLoader * +DynamicLoaderWindowsDYLD::CreateInstance(Process *process, bool force) { bool should_create = force; if (!should_create) @@ -65,32 +64,35 @@ DynamicLoader *DynamicLoaderWindowsDYLD::CreateInstance(Process *process, bool f } if (should_create) - return new DynamicLoaderWindowsDYLD (process); + return new DynamicLoaderWindowsDYLD(process); return nullptr; } -void DynamicLoaderWindowsDYLD::DidAttach() +void +DynamicLoaderWindowsDYLD::DidAttach() { - } -void DynamicLoaderWindowsDYLD::DidLaunch() +void +DynamicLoaderWindowsDYLD::DidLaunch() { - } -Error DynamicLoaderWindowsDYLD::CanLoadImage() +Error +DynamicLoaderWindowsDYLD::CanLoadImage() { return Error(); } -ConstString DynamicLoaderWindowsDYLD::GetPluginName() +ConstString +DynamicLoaderWindowsDYLD::GetPluginName() { return GetPluginNameStatic(); } -uint32_t DynamicLoaderWindowsDYLD::GetPluginVersion() +uint32_t +DynamicLoaderWindowsDYLD::GetPluginVersion() { return 1; } diff --git a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h index d12b999..8c47981 100644 --- a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h +++ b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h @@ -1,4 +1,4 @@ -//===-- DynamicLoaderWindowsDYLDh ----------------------------------*- C++ -*-===// +//===-- DynamicLoaderWindowsDYLD.h ------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,9 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_H_ -#define liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_H_ +#ifndef liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_h_ +#define liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/lldb-forward.h" #include "lldb/Target/DynamicLoader.h" @@ -18,9 +22,10 @@ namespace lldb_private class DynamicLoaderWindowsDYLD : public DynamicLoader { - public: +public: DynamicLoaderWindowsDYLD(Process *process); - virtual ~DynamicLoaderWindowsDYLD(); + + ~DynamicLoaderWindowsDYLD() override; static void Initialize(); static void Terminate(); @@ -29,15 +34,15 @@ class DynamicLoaderWindowsDYLD : public DynamicLoader static DynamicLoader *CreateInstance(Process *process, bool force); - void DidAttach () override; - void DidLaunch () override; - Error CanLoadImage () override; + void DidAttach() override; + void DidLaunch() override; + Error CanLoadImage() override; lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop) override; ConstString GetPluginName() override; uint32_t GetPluginVersion() override; }; -} +} // namespace lldb_private -#endif +#endif // liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_h_ |