Index: lldb/trunk/cmake/LLDBDependencies.cmake =================================================================== --- lldb/trunk/cmake/LLDBDependencies.cmake +++ lldb/trunk/cmake/LLDBDependencies.cmake @@ -19,6 +19,7 @@ lldbPluginDynamicLoaderStatic lldbPluginDynamicLoaderPosixDYLD lldbPluginDynamicLoaderHexagonDYLD + lldbPluginDynamicLoaderWindowsDYLD lldbPluginObjectFileELF lldbPluginObjectFileJIT Index: lldb/trunk/source/API/SystemInitializerFull.cpp =================================================================== --- lldb/trunk/source/API/SystemInitializerFull.cpp +++ lldb/trunk/source/API/SystemInitializerFull.cpp @@ -58,7 +58,6 @@ #if defined(_MSC_VER) #include "lldb/Host/windows/windows.h" -#include "Plugins/Process/Windows/DynamicLoaderWindows.h" #include "Plugins/Process/Windows/ProcessWindows.h" #endif @@ -264,7 +263,6 @@ RenderScriptRuntime::Initialize(); #if defined(_MSC_VER) - DynamicLoaderWindows::Initialize(); ProcessWindows::Initialize(); #endif #if defined(__FreeBSD__) @@ -369,9 +367,6 @@ ProcessKDP::Terminate(); SymbolVendorMacOSX::Terminate(); #endif -#if defined(_MSC_VER) - DynamicLoaderWindows::Terminate(); -#endif #if defined(__FreeBSD__) ProcessFreeBSD::Terminate(); Index: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp =================================================================== --- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp +++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp @@ -17,6 +17,7 @@ #include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h" +#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h" #include "Plugins/Instruction/ARM/EmulateInstructionARM.h" #include "Plugins/Instruction/MIPS/EmulateInstructionMIPS.h" #include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h" @@ -106,6 +107,7 @@ ObjectFileELF::Initialize(); ObjectFilePECOFF::Initialize(); DynamicLoaderPOSIXDYLD::Initialize(); + DynamicLoaderWindowsDYLD::Initialize(); platform_freebsd::PlatformFreeBSD::Initialize(); platform_linux::PlatformLinux::Initialize(); PlatformWindows::Initialize(); @@ -152,6 +154,7 @@ ObjectFileELF::Terminate(); ObjectFilePECOFF::Terminate(); DynamicLoaderPOSIXDYLD::Terminate(); + DynamicLoaderWindowsDYLD::Terminate(); platform_freebsd::PlatformFreeBSD::Terminate(); platform_linux::PlatformLinux::Terminate(); PlatformWindows::Terminate(); Index: lldb/trunk/source/Plugins/DynamicLoader/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/CMakeLists.txt +++ lldb/trunk/source/Plugins/DynamicLoader/CMakeLists.txt @@ -2,8 +2,8 @@ add_subdirectory(POSIX-DYLD) add_subdirectory(Static) add_subdirectory(Hexagon-DYLD) +add_subdirectory(Windows-DYLD) if (CMAKE_SYSTEM_NAME MATCHES "Darwin") add_subdirectory(Darwin-Kernel) endif() - Index: lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt +++ lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt @@ -0,0 +1,5 @@ +set(LLVM_NO_RTTI 1) + +add_lldb_library(lldbPluginDynamicLoaderWindowsDYLD + DynamicLoaderWindowsDYLD.cpp + ) Index: lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h +++ lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h @@ -0,0 +1,43 @@ +//===-- DynamicLoaderWindowsDYLDh ----------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_H_ +#define liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_H_ + +#include "lldb/lldb-forward.h" +#include "lldb/Target/DynamicLoader.h" + +namespace lldb_private +{ + +class DynamicLoaderWindowsDYLD : public DynamicLoader +{ + public: + DynamicLoaderWindowsDYLD(Process *process); + virtual ~DynamicLoaderWindowsDYLD(); + + static void Initialize(); + static void Terminate(); + static ConstString GetPluginNameStatic(); + static const char *GetPluginDescriptionStatic(); + + static DynamicLoader *CreateInstance(Process *process, bool force); + + void DidAttach () override; + void DidLaunch () override; + Error CanLoadImage () override; + lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop) override; + + ConstString GetPluginName() override; + uint32_t GetPluginVersion() override; +}; + +} + +#endif Index: lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -0,0 +1,102 @@ +//===-- DynamicLoaderWindowsDYLD.cpp --------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "DynamicLoaderWindowsDYLD.h" + +#include "lldb/Core/PluginManager.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" + +#include "llvm/ADT/Triple.h" + +using namespace lldb; +using namespace lldb_private; + +DynamicLoaderWindowsDYLD::DynamicLoaderWindowsDYLD(Process *process) + : DynamicLoader(process) +{ + +} + +DynamicLoaderWindowsDYLD::~DynamicLoaderWindowsDYLD() +{ + +} + +void DynamicLoaderWindowsDYLD::Initialize() +{ + PluginManager::RegisterPlugin(GetPluginNameStatic(), + GetPluginDescriptionStatic(), + CreateInstance); +} + +void DynamicLoaderWindowsDYLD::Terminate() +{ + +} + +ConstString DynamicLoaderWindowsDYLD::GetPluginNameStatic() +{ + static ConstString g_plugin_name("windows-dyld"); + return g_plugin_name; +} + +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) +{ + bool should_create = force; + if (!should_create) + { + const llvm::Triple &triple_ref = process->GetTarget().GetArchitecture().GetTriple(); + if (triple_ref.getOS() == llvm::Triple::Win32) + should_create = true; + } + + if (should_create) + return new DynamicLoaderWindowsDYLD (process); + + return nullptr; +} + +void DynamicLoaderWindowsDYLD::DidAttach() +{ + +} + +void DynamicLoaderWindowsDYLD::DidLaunch() +{ + +} + +Error DynamicLoaderWindowsDYLD::CanLoadImage() +{ + return Error(); +} + +ConstString DynamicLoaderWindowsDYLD::GetPluginName() +{ + return GetPluginNameStatic(); +} + +uint32_t DynamicLoaderWindowsDYLD::GetPluginVersion() +{ + return 1; +} + +ThreadPlanSP +DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread, bool stop) +{ + return ThreadPlanSP(); +} Index: lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt +++ lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt @@ -5,7 +5,6 @@ set(PROC_WINDOWS_SOURCES DebuggerThread.cpp - DynamicLoaderWindows.cpp LocalDebugDelegate.cpp ProcessWindows.cpp ProcessWindowsLog.cpp Index: lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h +++ lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h @@ -1,43 +0,0 @@ -//===-- DynamicLoaderWindows.h ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_Plugins_Process_Windows_DynamicLoaderWindows_H_ -#define liblldb_Plugins_Process_Windows_DynamicLoaderWindows_H_ - -#include "lldb/lldb-forward.h" -#include "lldb/Target/DynamicLoader.h" - -namespace lldb_private -{ - -class DynamicLoaderWindows : public DynamicLoader -{ - public: - DynamicLoaderWindows(Process *process); - virtual ~DynamicLoaderWindows(); - - static void Initialize(); - static void Terminate(); - static ConstString GetPluginNameStatic(); - static const char *GetPluginDescriptionStatic(); - - static DynamicLoader *CreateInstance(Process *process, bool force); - - void DidAttach () override; - void DidLaunch () override; - Error CanLoadImage () override; - lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop) override; - - ConstString GetPluginName() override; - uint32_t GetPluginVersion() override; -}; - -} - -#endif Index: lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp +++ lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp @@ -1,102 +0,0 @@ -//===-- DynamicLoaderWindows.cpp --------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "DynamicLoaderWindows.h" -#include "ProcessWindowsLog.h" - -#include "lldb/Core/PluginManager.h" -#include "lldb/Target/Process.h" -#include "lldb/Target/Target.h" - -#include "llvm/ADT/Triple.h" - -using namespace lldb; -using namespace lldb_private; - -DynamicLoaderWindows::DynamicLoaderWindows(Process *process) - : DynamicLoader(process) -{ - -} - -DynamicLoaderWindows::~DynamicLoaderWindows() -{ -} - -void DynamicLoaderWindows::Initialize() -{ - PluginManager::RegisterPlugin(GetPluginNameStatic(), - GetPluginDescriptionStatic(), - CreateInstance); -} - -void DynamicLoaderWindows::Terminate() -{ - -} - -ConstString DynamicLoaderWindows::GetPluginNameStatic() -{ - static ConstString g_plugin_name("windows-dyld"); - return g_plugin_name; -} - -const char *DynamicLoaderWindows::GetPluginDescriptionStatic() -{ - return "Dynamic loader plug-in that watches for shared library " - "loads/unloads in Windows processes."; -} - - -DynamicLoader *DynamicLoaderWindows::CreateInstance(Process *process, bool force) -{ - bool should_create = force; - if (!should_create) - { - const llvm::Triple &triple_ref = process->GetTarget().GetArchitecture().GetTriple(); - if (triple_ref.getOS() == llvm::Triple::Win32) - should_create = true; - } - - if (should_create) - return new DynamicLoaderWindows (process); - - return nullptr; -} - -void DynamicLoaderWindows::DidAttach() -{ - -} - -void DynamicLoaderWindows::DidLaunch() -{ - -} - -Error DynamicLoaderWindows::CanLoadImage() -{ - return Error(); -} - -ConstString DynamicLoaderWindows::GetPluginName() -{ - return GetPluginNameStatic(); -} - -uint32_t DynamicLoaderWindows::GetPluginVersion() -{ - return 1; -} - -ThreadPlanSP -DynamicLoaderWindows::GetStepThroughTrampolinePlan(Thread &thread, bool stop) -{ - return ThreadPlanSP(); -} \ No newline at end of file