1 //===-- DynamicLoaderWindowsDYLD.cpp --------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "DynamicLoaderWindowsDYLD.h"
11 
12 #include "lldb/Core/PluginManager.h"
13 #include "lldb/Target/Process.h"
14 #include "lldb/Target/Target.h"
15 
16 #include "llvm/ADT/Triple.h"
17 
18 using namespace lldb;
19 using namespace lldb_private;
20 
21 DynamicLoaderWindowsDYLD::DynamicLoaderWindowsDYLD(Process *process)
22     : DynamicLoader(process)
23 {
24 }
25 
26 DynamicLoaderWindowsDYLD::~DynamicLoaderWindowsDYLD()
27 {
28 }
29 
30 void
31 DynamicLoaderWindowsDYLD::Initialize()
32 {
33     PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance);
34 }
35 
36 void
37 DynamicLoaderWindowsDYLD::Terminate()
38 {
39 }
40 
41 ConstString
42 DynamicLoaderWindowsDYLD::GetPluginNameStatic()
43 {
44     static ConstString g_plugin_name("windows-dyld");
45     return g_plugin_name;
46 }
47 
48 const char *
49 DynamicLoaderWindowsDYLD::GetPluginDescriptionStatic()
50 {
51     return "Dynamic loader plug-in that watches for shared library "
52            "loads/unloads in Windows processes.";
53 }
54 
55 DynamicLoader *
56 DynamicLoaderWindowsDYLD::CreateInstance(Process *process, bool force)
57 {
58     bool should_create = force;
59     if (!should_create)
60     {
61         const llvm::Triple &triple_ref = process->GetTarget().GetArchitecture().GetTriple();
62         if (triple_ref.getOS() == llvm::Triple::Win32)
63             should_create = true;
64     }
65 
66     if (should_create)
67         return new DynamicLoaderWindowsDYLD(process);
68 
69     return nullptr;
70 }
71 
72 void
73 DynamicLoaderWindowsDYLD::DidAttach()
74 {
75 }
76 
77 void
78 DynamicLoaderWindowsDYLD::DidLaunch()
79 {
80 }
81 
82 Error
83 DynamicLoaderWindowsDYLD::CanLoadImage()
84 {
85     return Error();
86 }
87 
88 ConstString
89 DynamicLoaderWindowsDYLD::GetPluginName()
90 {
91     return GetPluginNameStatic();
92 }
93 
94 uint32_t
95 DynamicLoaderWindowsDYLD::GetPluginVersion()
96 {
97     return 1;
98 }
99 
100 ThreadPlanSP
101 DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(Thread &thread, bool stop)
102 {
103     return ThreadPlanSP();
104 }
105