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