[Lldb-commits] [lldb] r241697 - Move WindowsDYLD to the Plugins/DynamicLoader directory.

Stephane Sezer sas at cd80.net
Wed Jul 8 11:07:13 PDT 2015


Author: sas
Date: Wed Jul  8 13:07:13 2015
New Revision: 241697

URL: http://llvm.org/viewvc/llvm-project?rev=241697&view=rev
Log:
Move WindowsDYLD to the Plugins/DynamicLoader directory.

Summary:
This commit moves the Windows DyanamicLoader to the common DynamicLoader
directory. This is required to remote debug Windows targets.

This commit also initializes the Windows DYLD plugin in
SystemInitializerCommon (similarly to both POSIX and MacOSX DYLD
plugins) so that we can automatically instantiate this class when
connected to a windows process.

Test Plan: Build.

Reviewers: zturner

Subscribers: lldb-commits, abdulras

Differential Revision: http://reviews.llvm.org/D10882

Added:
    lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/
    lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt
    lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
      - copied, changed from r241688, lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h
      - copied, changed from r241688, lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h
Removed:
    lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h
Modified:
    lldb/trunk/cmake/LLDBDependencies.cmake
    lldb/trunk/source/API/SystemInitializerFull.cpp
    lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
    lldb/trunk/source/Plugins/DynamicLoader/CMakeLists.txt
    lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt

Modified: lldb/trunk/cmake/LLDBDependencies.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=241697&r1=241696&r2=241697&view=diff
==============================================================================
--- lldb/trunk/cmake/LLDBDependencies.cmake (original)
+++ lldb/trunk/cmake/LLDBDependencies.cmake Wed Jul  8 13:07:13 2015
@@ -19,6 +19,7 @@ set( LLDB_USED_LIBS
   lldbPluginDynamicLoaderStatic
   lldbPluginDynamicLoaderPosixDYLD
   lldbPluginDynamicLoaderHexagonDYLD
+  lldbPluginDynamicLoaderWindowsDYLD
 
   lldbPluginObjectFileELF
   lldbPluginObjectFileJIT

Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=241697&r1=241696&r2=241697&view=diff
==============================================================================
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Wed Jul  8 13:07:13 2015
@@ -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 @@ SystemInitializerFull::Initialize()
     RenderScriptRuntime::Initialize();
 
 #if defined(_MSC_VER)
-    DynamicLoaderWindows::Initialize();
     ProcessWindows::Initialize();
 #endif
 #if defined(__FreeBSD__)
@@ -369,9 +367,6 @@ SystemInitializerFull::Terminate()
     ProcessKDP::Terminate();
     SymbolVendorMacOSX::Terminate();
 #endif
-#if defined(_MSC_VER)
-    DynamicLoaderWindows::Terminate();
-#endif
 
 #if defined(__FreeBSD__)
     ProcessFreeBSD::Terminate();

Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=241697&r1=241696&r2=241697&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Wed Jul  8 13:07:13 2015
@@ -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 @@ SystemInitializerCommon::Initialize()
     ObjectFileELF::Initialize();
     ObjectFilePECOFF::Initialize();
     DynamicLoaderPOSIXDYLD::Initialize();
+    DynamicLoaderWindowsDYLD::Initialize();
     platform_freebsd::PlatformFreeBSD::Initialize();
     platform_linux::PlatformLinux::Initialize();
     PlatformWindows::Initialize();
@@ -152,6 +154,7 @@ SystemInitializerCommon::Terminate()
     ObjectFileELF::Terminate();
     ObjectFilePECOFF::Terminate();
     DynamicLoaderPOSIXDYLD::Terminate();
+    DynamicLoaderWindowsDYLD::Terminate();
     platform_freebsd::PlatformFreeBSD::Terminate();
     platform_linux::PlatformLinux::Terminate();
     PlatformWindows::Terminate();

Modified: lldb/trunk/source/Plugins/DynamicLoader/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/CMakeLists.txt?rev=241697&r1=241696&r2=241697&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/CMakeLists.txt Wed Jul  8 13:07:13 2015
@@ -2,8 +2,8 @@ add_subdirectory(MacOSX-DYLD)
 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()
-

Added: lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt?rev=241697&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt (added)
+++ lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/CMakeLists.txt Wed Jul  8 13:07:13 2015
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginDynamicLoaderWindowsDYLD
+  DynamicLoaderWindowsDYLD.cpp
+  )

Copied: lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp (from r241688, lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp?p2=lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp&p1=lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp&r1=241688&r2=241697&rev=241697&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp Wed Jul  8 13:07:13 2015
@@ -1,4 +1,4 @@
-//===-- DynamicLoaderWindows.cpp --------------------------------*- C++ -*-===//
+//===-- DynamicLoaderWindowsDYLD.cpp --------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "DynamicLoaderWindows.h"
-#include "ProcessWindowsLog.h"
+#include "DynamicLoaderWindowsDYLD.h"
 
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/Process.h"
@@ -19,42 +18,43 @@
 using namespace lldb;
 using namespace lldb_private;
 
-DynamicLoaderWindows::DynamicLoaderWindows(Process *process)
+DynamicLoaderWindowsDYLD::DynamicLoaderWindowsDYLD(Process *process)
     : DynamicLoader(process)
 {
 
 }
 
-DynamicLoaderWindows::~DynamicLoaderWindows()
+DynamicLoaderWindowsDYLD::~DynamicLoaderWindowsDYLD()
 {
+
 }
 
-void DynamicLoaderWindows::Initialize()
+void DynamicLoaderWindowsDYLD::Initialize()
 {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(),
                                   CreateInstance);
 }
 
-void DynamicLoaderWindows::Terminate()
+void DynamicLoaderWindowsDYLD::Terminate()
 {
 
 }
 
-ConstString DynamicLoaderWindows::GetPluginNameStatic()
+ConstString DynamicLoaderWindowsDYLD::GetPluginNameStatic()
 {
     static ConstString g_plugin_name("windows-dyld");
     return g_plugin_name;
 }
 
-const char *DynamicLoaderWindows::GetPluginDescriptionStatic()
+const char *DynamicLoaderWindowsDYLD::GetPluginDescriptionStatic()
 {
     return "Dynamic loader plug-in that watches for shared library "
            "loads/unloads in Windows processes.";
 }
 
 
-DynamicLoader *DynamicLoaderWindows::CreateInstance(Process *process, bool force)
+DynamicLoader *DynamicLoaderWindowsDYLD::CreateInstance(Process *process, bool force)
 {
     bool should_create = force;
     if (!should_create)
@@ -65,38 +65,38 @@ DynamicLoader *DynamicLoaderWindows::Cre
     }
 
     if (should_create)
-        return new DynamicLoaderWindows (process);
+        return new DynamicLoaderWindowsDYLD (process);
 
     return nullptr;
 }
 
-void DynamicLoaderWindows::DidAttach()
+void DynamicLoaderWindowsDYLD::DidAttach()
 {
 
 }
 
-void DynamicLoaderWindows::DidLaunch()
+void DynamicLoaderWindowsDYLD::DidLaunch()
 {
 
 }
 
-Error DynamicLoaderWindows::CanLoadImage()
+Error DynamicLoaderWindowsDYLD::CanLoadImage()
 {
     return Error();
 }
 
-ConstString DynamicLoaderWindows::GetPluginName()
+ConstString DynamicLoaderWindowsDYLD::GetPluginName()
 {
     return GetPluginNameStatic();
 }
 
-uint32_t DynamicLoaderWindows::GetPluginVersion()
+uint32_t DynamicLoaderWindowsDYLD::GetPluginVersion()
 {
     return 1;
 }
 
 ThreadPlanSP
-DynamicLoaderWindows::GetStepThroughTrampolinePlan(Thread &thread, bool stop)
+DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread, bool stop)
 {
     return ThreadPlanSP();
-}
\ No newline at end of file
+}

Copied: lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h (from r241688, lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h?p2=lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h&p1=lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h&r1=241688&r2=241697&rev=241697&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h Wed Jul  8 13:07:13 2015
@@ -1,4 +1,4 @@
-//===-- DynamicLoaderWindows.h ----------------------------------*- C++ -*-===//
+//===-- DynamicLoaderWindowsDYLDh ----------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef liblldb_Plugins_Process_Windows_DynamicLoaderWindows_H_
-#define liblldb_Plugins_Process_Windows_DynamicLoaderWindows_H_
+#ifndef liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_H_
+#define liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_H_
 
 #include "lldb/lldb-forward.h"
 #include "lldb/Target/DynamicLoader.h"
@@ -16,11 +16,11 @@
 namespace lldb_private
 {
 
-class DynamicLoaderWindows : public DynamicLoader
+class DynamicLoaderWindowsDYLD : public DynamicLoader
 {
   public:
-    DynamicLoaderWindows(Process *process);
-    virtual ~DynamicLoaderWindows();
+    DynamicLoaderWindowsDYLD(Process *process);
+    virtual ~DynamicLoaderWindowsDYLD();
 
     static void Initialize();
     static void Terminate();

Modified: lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt?rev=241697&r1=241696&r2=241697&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt Wed Jul  8 13:07:13 2015
@@ -5,7 +5,6 @@ include_directories(../Utility)
 
 set(PROC_WINDOWS_SOURCES
   DebuggerThread.cpp
-  DynamicLoaderWindows.cpp
   LocalDebugDelegate.cpp
   ProcessWindows.cpp
   ProcessWindowsLog.cpp

Removed: lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp?rev=241696&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.cpp (removed)
@@ -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

Removed: lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h?rev=241696&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DynamicLoaderWindows.h (removed)
@@ -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





More information about the lldb-commits mailing list