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

llvm-svn: 241697
This commit is contained in:
Stephane Sezer 2015-07-08 18:07:13 +00:00
parent e008391ea2
commit 38a1b7ea58
8 changed files with 34 additions and 31 deletions

View File

@ -19,6 +19,7 @@ set( LLDB_USED_LIBS
lldbPluginDynamicLoaderStatic
lldbPluginDynamicLoaderPosixDYLD
lldbPluginDynamicLoaderHexagonDYLD
lldbPluginDynamicLoaderWindowsDYLD
lldbPluginObjectFileELF
lldbPluginObjectFileJIT

View File

@ -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();

View File

@ -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();

View File

@ -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()

View File

@ -0,0 +1,5 @@
set(LLVM_NO_RTTI 1)
add_lldb_library(lldbPluginDynamicLoaderWindowsDYLD
DynamicLoaderWindowsDYLD.cpp
)

View File

@ -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::CreateInstance(Process *process, bool force
}
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();
}
}

View File

@ -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();

View File

@ -5,7 +5,6 @@ include_directories(../Utility)
set(PROC_WINDOWS_SOURCES
DebuggerThread.cpp
DynamicLoaderWindows.cpp
LocalDebugDelegate.cpp
ProcessWindows.cpp
ProcessWindowsLog.cpp