1 //===-- DynamicLoader.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 "lldb/lldb-private.h" 11 #include "lldb/Target/DynamicLoader.h" 12 #include "lldb/Target/Process.h" 13 #include "lldb/Core/PluginManager.h" 14 15 using namespace lldb; 16 using namespace lldb_private; 17 18 DynamicLoader* 19 DynamicLoader::FindPlugin (Process *process, const char *plugin_name) 20 { 21 DynamicLoaderCreateInstance create_callback = NULL; 22 if (plugin_name) 23 { 24 create_callback = PluginManager::GetDynamicLoaderCreateCallbackForPluginName (plugin_name); 25 if (create_callback) 26 { 27 std::auto_ptr<DynamicLoader> instance_ap(create_callback(process, true)); 28 if (instance_ap.get()) 29 return instance_ap.release(); 30 } 31 } 32 else 33 { 34 for (uint32_t idx = 0; (create_callback = PluginManager::GetDynamicLoaderCreateCallbackAtIndex(idx)) != NULL; ++idx) 35 { 36 std::auto_ptr<DynamicLoader> instance_ap(create_callback(process, false)); 37 if (instance_ap.get()) 38 return instance_ap.release(); 39 } 40 } 41 return NULL; 42 } 43 44 45 //---------------------------------------------------------------------- 46 // DynamicLoader constructor 47 //---------------------------------------------------------------------- 48 DynamicLoader::DynamicLoader(Process *process) : 49 m_process (process) 50 { 51 } 52 53 //---------------------------------------------------------------------- 54 // Destructor 55 //---------------------------------------------------------------------- 56 DynamicLoader::~DynamicLoader() 57 { 58 } 59 60 //---------------------------------------------------------------------- 61 // Accessosors to the global setting as to whether to stop at image 62 // (shared library) loading/unloading. 63 //---------------------------------------------------------------------- 64 bool 65 DynamicLoader::GetStopWhenImagesChange () const 66 { 67 return m_process->GetStopOnSharedLibraryEvents(); 68 } 69 70 void 71 DynamicLoader::SetStopWhenImagesChange (bool stop) 72 { 73 m_process->SetStopOnSharedLibraryEvents (stop); 74 } 75 76