2010-06-09 00:52:24 +08:00
|
|
|
//===-- DynamicLoader.cpp ---------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/lldb-private.h"
|
|
|
|
#include "lldb/Target/DynamicLoader.h"
|
|
|
|
#include "lldb/Core/PluginManager.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
DynamicLoader*
|
|
|
|
DynamicLoader::FindPlugin (Process *process, const char *plugin_name)
|
|
|
|
{
|
|
|
|
DynamicLoaderCreateInstance create_callback = NULL;
|
|
|
|
if (plugin_name)
|
|
|
|
{
|
|
|
|
create_callback = PluginManager::GetDynamicLoaderCreateCallbackForPluginName (plugin_name);
|
|
|
|
if (create_callback)
|
|
|
|
{
|
2011-02-16 12:46:07 +08:00
|
|
|
std::auto_ptr<DynamicLoader> instance_ap(create_callback(process, true));
|
2010-06-09 00:52:24 +08:00
|
|
|
if (instance_ap.get())
|
|
|
|
return instance_ap.release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (uint32_t idx = 0; (create_callback = PluginManager::GetDynamicLoaderCreateCallbackAtIndex(idx)) != NULL; ++idx)
|
|
|
|
{
|
2011-02-16 12:46:07 +08:00
|
|
|
std::auto_ptr<DynamicLoader> instance_ap(create_callback(process, false));
|
2010-06-09 00:52:24 +08:00
|
|
|
if (instance_ap.get())
|
|
|
|
return instance_ap.release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// DynamicLoader constructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
DynamicLoader::DynamicLoader(Process *process) :
|
|
|
|
m_process (process),
|
|
|
|
m_stop_when_images_change(false) // Stop the process by default when a process' images change
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Destructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
DynamicLoader::~DynamicLoader()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2010-09-18 11:37:20 +08:00
|
|
|
// Accessosors to the global setting as to whether to stop at image
|
2010-06-09 00:52:24 +08:00
|
|
|
// (shared library) loading/unloading.
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
bool
|
|
|
|
DynamicLoader::GetStopWhenImagesChange () const
|
|
|
|
{
|
|
|
|
return m_stop_when_images_change;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DynamicLoader::SetStopWhenImagesChange (bool stop)
|
|
|
|
{
|
|
|
|
m_stop_when_images_change = stop;
|
|
|
|
}
|
|
|
|
|