summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/Module.h3
-rw-r--r--lldb/include/lldb/Core/ModuleList.h78
-rw-r--r--lldb/include/lldb/Host/Symbols.h2
-rw-r--r--lldb/include/lldb/Target/Platform.h9
-rw-r--r--lldb/include/lldb/Target/Target.h47
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp8
-rw-r--r--lldb/source/Core/Module.cpp47
-rw-r--r--lldb/source/Core/ModuleList.cpp134
-rw-r--r--lldb/source/Core/SearchFilter.cpp8
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp6
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp7
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp14
-rw-r--r--lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp7
-rw-r--r--lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp5
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp6
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp2
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp32
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h3
-rw-r--r--lldb/source/Target/ObjCLanguageRuntime.cpp2
-rw-r--r--lldb/source/Target/Platform.cpp6
-rw-r--r--lldb/source/Target/Process.cpp2
-rw-r--r--lldb/source/Target/Target.cpp63
23 files changed, 367 insertions, 126 deletions
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 8cd7a16e40c..23730334332 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -532,6 +532,9 @@ public:
bool
IsLoadedInTarget (Target *target);
+ bool
+ LoadScriptingResourceInTarget (Target *target, Error& error);
+
//------------------------------------------------------------------
/// Get the number of compile units for this module.
///
diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h
index 38d397b032b..7c9f4932539 100644
--- a/lldb/include/lldb/Core/ModuleList.h
+++ b/lldb/include/lldb/Core/ModuleList.h
@@ -27,6 +27,25 @@ namespace lldb_private {
class ModuleList
{
public:
+
+ class Notifier
+ {
+ public:
+ virtual void
+ ModuleAdded (const lldb::ModuleSP& module_sp) = 0;
+ virtual void
+ ModuleRemoved (const lldb::ModuleSP& module_sp) = 0;
+ virtual void
+ ModuleUpdated (const lldb::ModuleSP& old_module_sp,
+ const lldb::ModuleSP& new_module_sp) = 0;
+ virtual void
+ WillClearList () = 0;
+
+ virtual
+ ~Notifier ()
+ {}
+ };
+
//------------------------------------------------------------------
/// Default constructor.
///
@@ -44,6 +63,8 @@ public:
/// Another module list object.
//------------------------------------------------------------------
ModuleList (const ModuleList& rhs);
+
+ ModuleList (ModuleList::Notifier* notifier);
//------------------------------------------------------------------
/// Destructor.
@@ -91,6 +112,15 @@ public:
bool
AppendIfNeeded (const lldb::ModuleSP &module_sp);
+ void
+ Append (const ModuleList& module_list);
+
+ bool
+ AppendIfNeeded (const ModuleList& module_list);
+
+ bool
+ ReplaceModule (const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp);
+
//------------------------------------------------------------------
/// Clear the object's state.
///
@@ -130,7 +160,7 @@ public:
const char *prefix_cstr);
Mutex &
- GetMutex ()
+ GetMutex () const
{
return m_modules_mutex;
}
@@ -151,7 +181,7 @@ public:
/// @see ModuleList::GetSize()
//------------------------------------------------------------------
lldb::ModuleSP
- GetModuleAtIndex (uint32_t idx);
+ GetModuleAtIndex (uint32_t idx) const;
//------------------------------------------------------------------
/// Get the module shared pointer for the module at index \a idx without
@@ -168,7 +198,7 @@ public:
/// @see ModuleList::GetSize()
//------------------------------------------------------------------
lldb::ModuleSP
- GetModuleAtIndexUnlocked (uint32_t idx);
+ GetModuleAtIndexUnlocked (uint32_t idx) const;
//------------------------------------------------------------------
/// Get the module pointer for the module at index \a idx.
@@ -226,7 +256,7 @@ public:
uint32_t
FindCompileUnits (const FileSpec &path,
bool append,
- SymbolContextList &sc_list);
+ SymbolContextList &sc_list) const;
//------------------------------------------------------------------
/// @see Module::FindFunctions ()
@@ -237,7 +267,7 @@ public:
bool include_symbols,
bool include_inlines,
bool append,
- SymbolContextList &sc_list);
+ SymbolContextList &sc_list) const;
//------------------------------------------------------------------
/// Find global and static variables by name.
@@ -266,7 +296,7 @@ public:
FindGlobalVariables (const ConstString &name,
bool append,
uint32_t max_matches,
- VariableList& variable_list);
+ VariableList& variable_list) const;
//------------------------------------------------------------------
/// Find global and static variables by regular exression.
@@ -294,7 +324,7 @@ public:
FindGlobalVariables (const RegularExpression& regex,
bool append,
uint32_t max_matches,
- VariableList& variable_list);
+ VariableList& variable_list) const;
//------------------------------------------------------------------
/// Finds the first module whose file specification matches \a
@@ -332,7 +362,7 @@ public:
ModuleList& matching_module_list) const;
lldb::ModuleSP
- FindModule (const Module *module_ptr);
+ FindModule (const Module *module_ptr) const;
//------------------------------------------------------------------
// Find a module by UUID
@@ -342,22 +372,22 @@ public:
// finding modules by UUID values is very efficient and accurate.
//------------------------------------------------------------------
lldb::ModuleSP
- FindModule (const UUID &uuid);
+ FindModule (const UUID &uuid) const;
lldb::ModuleSP
- FindFirstModule (const ModuleSpec &module_spec);
+ FindFirstModule (const ModuleSpec &module_spec) const;
size_t
FindSymbolsWithNameAndType (const ConstString &name,
lldb::SymbolType symbol_type,
SymbolContextList &sc_list,
- bool append = false);
+ bool append = false) const;
size_t
FindSymbolsMatchingRegExAndType (const RegularExpression &regex,
lldb::SymbolType symbol_type,
SymbolContextList &sc_list,
- bool append = false);
+ bool append = false) const;
//------------------------------------------------------------------
/// Find types by name.
@@ -397,7 +427,7 @@ public:
const ConstString &name,
bool name_is_fully_qualified,
uint32_t max_matches,
- TypeList& types);
+ TypeList& types) const;
bool
FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const;
@@ -416,7 +446,7 @@ public:
bool
ResolveFileAddress (lldb::addr_t vm_addr,
- Address& so_addr);
+ Address& so_addr) const;
//------------------------------------------------------------------
/// @copydoc Module::ResolveSymbolContextForAddress (const Address &,uint32_t,SymbolContext&)
@@ -424,7 +454,7 @@ public:
uint32_t
ResolveSymbolContextForAddress (const Address& so_addr,
uint32_t resolve_scope,
- SymbolContext& sc);
+ SymbolContext& sc) const;
//------------------------------------------------------------------
/// @copydoc Module::ResolveSymbolContextForFilePath (const char *,uint32_t,bool,uint32_t,SymbolContextList&)
@@ -434,7 +464,7 @@ public:
uint32_t line,
bool check_inlines,
uint32_t resolve_scope,
- SymbolContextList& sc_list);
+ SymbolContextList& sc_list) const;
//------------------------------------------------------------------
/// @copydoc Module::ResolveSymbolContextsForFileSpec (const FileSpec &,uint32_t,bool,uint32_t,SymbolContextList&)
@@ -444,7 +474,7 @@ public:
uint32_t line,
bool check_inlines,
uint32_t resolve_scope,
- SymbolContextList& sc_list);
+ SymbolContextList& sc_list) const;
//------------------------------------------------------------------
/// Gets the size of the module list.
@@ -485,12 +515,26 @@ protected:
//------------------------------------------------------------------
typedef std::vector<lldb::ModuleSP> collection; ///< The module collection type.
+ void
+ AppendImpl (const lldb::ModuleSP &module_sp, bool use_notifier = true);
+
+ bool
+ RemoveImpl (const lldb::ModuleSP &module_sp, bool use_notifier = true);
+
+ collection::iterator
+ RemoveImpl (collection::iterator pos, bool use_notifier = true);
+
+ void
+ ClearImpl (bool use_notifier = true);
+
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
collection m_modules; ///< The collection of modules.
mutable Mutex m_modules_mutex;
+ Notifier* m_notifier;
+
};
} // namespace lldb_private
diff --git a/lldb/include/lldb/Host/Symbols.h b/lldb/include/lldb/Host/Symbols.h
index daba94b9bd2..9db68e1ecf1 100644
--- a/lldb/include/lldb/Host/Symbols.h
+++ b/lldb/include/lldb/Host/Symbols.h
@@ -41,7 +41,7 @@ public:
//----------------------------------------------------------------------
static FileSpec
LocateExecutableSymbolFile (const ModuleSpec &module_spec);
-
+
static FileSpec
FindSymbolFileInBundle (const FileSpec& dsym_bundle_fspec,
const lldb_private::UUID *uuid,
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index 89f6441de6b..2f86042f38b 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -291,6 +291,15 @@ namespace lldb_private {
const UUID *uuid_ptr,
FileSpec &local_file);
+ //----------------------------------------------------------------------
+ // Locate the scripting resource given a module specification.
+ //
+ // Locating the file should happen only on the local computer or using
+ // the current computers global settings.
+ //----------------------------------------------------------------------
+ virtual FileSpec
+ LocateExecutableScriptingResource (const ModuleSpec &module_spec);
+
virtual Error
GetSharedModule (const ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index 65cdaa1e279..851ca3b9ce3 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -47,7 +47,6 @@ typedef enum InlineStrategy
eInlineBreakpointsAlways
} InlineStrategy;
-
//----------------------------------------------------------------------
// TargetProperties
//----------------------------------------------------------------------
@@ -266,7 +265,8 @@ class Target :
public STD_ENABLE_SHARED_FROM_THIS(Target),
public TargetProperties,
public Broadcaster,
- public ExecutionContextScope
+ public ExecutionContextScope,
+ public ModuleList::Notifier
{
public:
friend class TargetList;
@@ -586,13 +586,6 @@ public:
bool
IgnoreWatchpointByID (lldb::watch_id_t watch_id, uint32_t ignore_count);
- void
- ModulesDidLoad (ModuleList &module_list);
-
- void
- ModulesDidUnload (ModuleList &module_list);
-
-
//------------------------------------------------------------------
/// Get \a load_addr as a callable code load address for this target
///
@@ -623,13 +616,30 @@ public:
GetOpcodeLoadAddress (lldb::addr_t load_addr, lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
protected:
- void
- ModuleAdded (lldb::ModuleSP &module_sp);
+ //------------------------------------------------------------------
+ /// Implementing of ModuleList::Notifier.
+ //------------------------------------------------------------------
+
+ virtual void
+ ModuleAdded (const lldb::ModuleSP& module_sp);
+
+ virtual void
+ ModuleRemoved (const lldb::ModuleSP& module_sp);
+
+ virtual void
+ ModuleUpdated (const lldb::ModuleSP& old_module_sp,
+ const lldb::ModuleSP& new_module_sp);
+ virtual void
+ WillClearList ();
+public:
+
void
- ModuleUpdated (lldb::ModuleSP &old_module_sp, lldb::ModuleSP &new_module_sp);
+ ModulesDidLoad (ModuleList &module_list);
-public:
+ void
+ ModulesDidUnload (ModuleList &module_list);
+
//------------------------------------------------------------------
/// Gets the module for the main executable.
///
@@ -702,18 +712,17 @@ public:
/// @return
/// A list of Module objects in a module list.
//------------------------------------------------------------------
- ModuleList&
- GetImages ()
- {
- return m_images;
- }
-
const ModuleList&
GetImages () const
{
return m_images;
}
+ ModuleList&
+ GetImages ()
+ {
+ return m_images;
+ }
//------------------------------------------------------------------
/// Return whether this FileSpec corresponds to a module that should be considered for general searches.
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 679c5ddbe94..14018a41145 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2255,7 +2255,7 @@ protected:
if (command.GetArgumentCount() == 0)
{
// Dump all sections for all modules images
- ModuleList &target_modules = target->GetImages();
+ const ModuleList &target_modules = target->GetImages();
Mutex::Locker modules_locker (target_modules.GetMutex());
const uint32_t num_modules = target_modules.GetSize();
if (num_modules > 0)
@@ -2368,7 +2368,7 @@ protected:
{
FileSpec file_spec(arg_cstr, false);
- ModuleList &target_modules = target->GetImages();
+ const ModuleList &target_modules = target->GetImages();
Mutex::Locker modules_locker(target_modules.GetMutex());
const uint32_t num_modules = target_modules.GetSize();
if (num_modules > 0)
@@ -2940,7 +2940,7 @@ protected:
Mutex::Locker locker; // This locker will be locked on the mutex in module_list_ptr if it is non-NULL.
// Otherwise it will lock the AllocationModuleCollectionMutex when accessing
// the global module list directly.
- ModuleList *module_list_ptr = NULL;
+ const ModuleList *module_list_ptr = NULL;
const size_t argc = command.GetArgumentCount();
if (argc == 0)
{
@@ -3825,7 +3825,7 @@ protected:
// Dump all sections for all other modules
- ModuleList &target_modules = target->GetImages();
+ const ModuleList &target_modules = target->GetImages();
Mutex::Locker modules_locker(target_modules.GetMutex());
const uint32_t num_modules = target_modules.GetSize();
if (num_modules > 0)
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 08f826ee42b..e349d635c1c 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include "lldb/Core/Error.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/DataBufferHeap.h"
@@ -18,6 +19,9 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/Symbols.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/lldb-private-log.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -1132,7 +1136,48 @@ Module::IsLoadedInTarget (Target *target)
}
return false;
}
-bool
+
+bool
+Module::LoadScriptingResourceInTarget (Target *target, Error& error)
+{
+ if (!target)
+ {
+ error.SetErrorString("invalid destination Target");
+ return false;
+ }
+
+ PlatformSP platform_sp(target->GetPlatform());
+
+ if (!platform_sp)
+ {
+ error.SetErrorString("invalid Platform");
+ return false;
+ }
+
+ ModuleSpec module_spec(GetFileSpec());
+ FileSpec scripting_fspec = platform_sp->LocateExecutableScriptingResource(module_spec);
+ Debugger &debugger(target->GetDebugger());
+ if (scripting_fspec && scripting_fspec.Exists())
+ {
+ ScriptInterpreter *script_interpreter = debugger.GetCommandInterpreter().GetScriptInterpreter();
+ if (script_interpreter)
+ {
+ StreamString scripting_stream;
+ scripting_fspec.Dump(&scripting_stream);
+ bool did_load = script_interpreter->LoadScriptingModule(scripting_stream.GetData(), false, true, error);
+ if (!did_load)
+ return false;
+ }
+ else
+ {
+ error.SetErrorString("invalid ScriptInterpreter");
+ return false;
+ }
+ }
+ return true;
+}
+
+bool
Module::SetArchitecture (const ArchSpec &new_arch)
{
if (!m_arch.IsValid())
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 338482b3ff7..c7f7484934e 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -30,7 +30,8 @@ using namespace lldb_private;
//----------------------------------------------------------------------
ModuleList::ModuleList() :
m_modules(),
- m_modules_mutex (Mutex::eMutexTypeRecursive)
+ m_modules_mutex (Mutex::eMutexTypeRecursive),
+ m_notifier(NULL)
{
}
@@ -44,6 +45,14 @@ ModuleList::ModuleList(const ModuleList& rhs) :
Mutex::Locker lhs_locker(m_modules_mutex);
Mutex::Locker rhs_locker(rhs.m_modules_mutex);
m_modules = rhs.m_modules;
+ m_notifier = rhs.m_notifier;
+}
+
+ModuleList::ModuleList (ModuleList::Notifier* notifier) :
+ m_modules(),
+ m_modules_mutex (Mutex::eMutexTypeRecursive),
+ m_notifier(notifier)
+{
}
//----------------------------------------------------------------------
@@ -57,6 +66,7 @@ ModuleList::operator= (const ModuleList& rhs)
Mutex::Locker lhs_locker(m_modules_mutex);
Mutex::Locker rhs_locker(rhs.m_modules_mutex);
m_modules = rhs.m_modules;
+ m_notifier = rhs.m_notifier;
}
return *this;
}
@@ -69,16 +79,24 @@ ModuleList::~ModuleList()
}
void
-ModuleList::Append (const ModuleSP &module_sp)
+ModuleList::AppendImpl (const ModuleSP &module_sp, bool use_notifier)
{
if (module_sp)
{
Mutex::Locker locker(m_modules_mutex);
m_modules.push_back(module_sp);
+ if (use_notifier && m_notifier)
+ m_notifier->ModuleAdded(module_sp);
}
}
void
+ModuleList::Append (const ModuleSP &module_sp)
+{
+ AppendImpl (module_sp);
+}
+
+void
ModuleList::ReplaceEquivalent (const ModuleSP &module_sp)
{
if (module_sp)
@@ -95,12 +113,12 @@ ModuleList::ReplaceEquivalent (const ModuleSP &module_sp)
{
ModuleSP module_sp (m_modules[idx]);
if (module_sp->MatchesModuleSpec (equivalent_module_spec))
- m_modules.erase(m_modules.begin() + idx);
+ RemoveImpl(m_modules.begin() + idx);
else
++idx;
}
// Now add the new module to the list
- m_modules.push_back(module_sp);
+ Append(module_sp);
}
}
@@ -117,14 +135,30 @@ ModuleList::AppendIfNeeded (const ModuleSP &module_sp)
return false; // Already in the list
}
// Only push module_sp on the list if it wasn't already in there.
- m_modules.push_back(module_sp);
+ Append(module_sp);
return true;
}
return false;
}
+void
+ModuleList::Append (const ModuleList& module_list)
+{
+ for (auto pos : module_list.m_modules)
+ Append(pos);
+}
+
bool
-ModuleList::Remove (const ModuleSP &module_sp)
+ModuleList::AppendIfNeeded (const ModuleList& module_list)
+{
+ bool any_in = false;
+ for (auto pos : module_list.m_modules)
+ any_in = AppendIfNeeded(pos) | any_in;
+ return any_in;
+}
+
+bool
+ModuleList::RemoveImpl (const ModuleSP &module_sp, bool use_notifier)
{
if (module_sp)
{
@@ -135,6 +169,8 @@ ModuleList::Remove (const ModuleSP &module_sp)
if (pos->get() == module_sp.get())
{
m_modules.erase (pos);
+ if (use_notifier && m_notifier)
+ m_notifier->ModuleRemoved(module_sp);
return true;
}
}
@@ -142,6 +178,33 @@ ModuleList::Remove (const ModuleSP &module_sp)
return false;
}
+ModuleList::collection::iterator
+ModuleList::RemoveImpl (ModuleList::collection::iterator pos, bool use_notifier)
+{
+ ModuleSP module_sp(*pos);
+ collection::iterator retval = m_modules.erase(pos);
+ if (use_notifier && m_notifier)
+ m_notifier->ModuleRemoved(module_sp);
+ return retval;
+}
+
+bool
+ModuleList::Remove (const ModuleSP &module_sp)
+{
+ return RemoveImpl (module_sp);
+}
+
+bool
+ModuleList::ReplaceModule (const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp)
+{
+ if (!RemoveImpl(old_module_sp, false))
+ return false;
+ AppendImpl (new_module_sp, false);
+ if (m_notifier)
+ m_notifier->ModuleUpdated(old_module_sp,new_module_sp);
+ return true;
+}
+
bool
ModuleList::RemoveIfOrphaned (const Module *module_ptr)
{
@@ -155,7 +218,7 @@ ModuleList::RemoveIfOrphaned (const Module *module_ptr)
{
if (pos->unique())
{
- pos = m_modules.erase (pos);
+ pos = RemoveImpl(pos);
return true;
}
else
@@ -187,7 +250,7 @@ ModuleList::RemoveOrphans (bool mandatory)
{
if (pos->unique())
{
- pos = m_modules.erase (pos);
+ pos = RemoveImpl(pos);
++remove_count;
}
else
@@ -213,20 +276,25 @@ ModuleList::Remove (ModuleList &module_list)
}
-
void
ModuleList::Clear()
{
- Mutex::Locker locker(m_modules_mutex);
- m_modules.clear();
+ ClearImpl();
}
void
ModuleList::Destroy()
{
+ ClearImpl();
+}
+
+void
+ModuleList::ClearImpl (bool use_notifier)
+{
Mutex::Locker locker(m_modules_mutex);
- collection empty;
- m_modules.swap(empty);
+ if (use_notifier && m_notifier)
+ m_notifier->WillClearList();
+ m_modules.clear();
}
Module*
@@ -245,14 +313,14 @@ ModuleList::GetModulePointerAtIndexUnlocked (uint32_t idx) const
}
ModuleSP
-ModuleList::GetModuleAtIndex(uint32_t idx)
+ModuleList::GetModuleAtIndex(uint32_t idx) const
{
Mutex::Locker locker(m_modules_mutex);
return GetModuleAtIndexUnlocked(idx);
}
ModuleSP
-ModuleList::GetModuleAtIndexUnlocked(uint32_t idx)
+ModuleList::GetModuleAtIndexUnlocked(uint32_t idx) const
{
ModuleSP module_sp;
if (idx < m_modules.size())
@@ -266,7 +334,7 @@ ModuleList::FindFunctions (const ConstString &name,
bool include_symbols,
bool include_inlines,
bool append,
- SymbolContextList &sc_list)
+ SymbolContextList &sc_list) const
{
if (!append)
sc_list.Clear();
@@ -284,7 +352,7 @@ ModuleList::FindFunctions (const ConstString &name,
uint32_t
ModuleList::FindCompileUnits (const FileSpec &path,
bool append,
- SymbolContextList &sc_list)
+ SymbolContextList &sc_list) const
{
if (!append)
sc_list.Clear();
@@ -303,11 +371,11 @@ uint32_t
ModuleList::FindGlobalVariables (const ConstString &name,
bool append,
uint32_t max_matches,
- VariableList& variable_list)
+ VariableList& variable_list) const
{
size_t initial_size = variable_list.GetSize();
Mutex::Locker locker(m_modules_mutex);
- collection::iterator pos, end = m_modules.end();
+ collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
(*pos)->FindGlobalVariables (name, NULL, append, max_matches, variable_list);
@@ -320,11 +388,11 @@ uint32_t
ModuleList::FindGlobalVariables (const RegularExpression& regex,
bool append,
uint32_t max_matches,
- VariableList& variable_list)
+ VariableList& variable_list) const
{
size_t initial_size = variable_list.GetSize();
Mutex::Locker locker(m_modules_mutex);
- collection::iterator pos, end = m_modules.end();
+ collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
(*pos)->FindGlobalVariables (regex, append, max_matches, variable_list);
@@ -337,14 +405,14 @@ size_t
ModuleList::FindSymbolsWithNameAndType (const ConstString &name,
SymbolType symbol_type,
SymbolContextList &sc_list,
- bool append)
+ bool append) const
{
Mutex::Locker locker(m_modules_mutex);
if (!append)
sc_list.Clear();
size_t initial_size = sc_list.GetSize();
- collection::iterator pos, end = m_modules.end();
+ collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
(*pos)->FindSymbolsWithNameAndType (name, symbol_type, sc_list);
return sc_list.GetSize() - initial_size;
@@ -354,14 +422,14 @@ size_t
ModuleList::FindSymbolsMatchingRegExAndType (const RegularExpression &regex,
lldb::SymbolType symbol_type,
SymbolContextList &sc_list,
- bool append)
+ bool append) const
{
Mutex::Locker locker(m_modules_mutex);
if (!append)
sc_list.Clear();
size_t initial_size = sc_list.GetSize();
- collection::iterator pos, end = m_modules.end();
+ collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
(*pos)->FindSymbolsMatchingRegExAndType (regex, symbol_type, sc_list);
return sc_list.GetSize() - initial_size;
@@ -384,7 +452,7 @@ ModuleList::FindModules (const ModuleSpec &module_spec, ModuleList& matching_mod
}
ModuleSP
-ModuleList::FindModule (const Module *module_ptr)
+ModuleList::FindModule (const Module *module_ptr) const
{
ModuleSP module_sp;
@@ -407,7 +475,7 @@ ModuleList::FindModule (const Module *module_ptr)
}
ModuleSP
-ModuleList::FindModule (const UUID &uuid)
+ModuleList::FindModule (const UUID &uuid) const
{
ModuleSP module_sp;
@@ -430,7 +498,7 @@ ModuleList::FindModule (const UUID &uuid)
uint32_t
-ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool name_is_fully_qualified, uint32_t max_matches, TypeList& types)
+ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool name_is_fully_qualified, uint32_t max_matches, TypeList& types) const
{
Mutex::Locker locker(m_modules_mutex);
@@ -487,7 +555,7 @@ ModuleList::FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const
ModuleSP
-ModuleList::FindFirstModule (const ModuleSpec &module_spec)
+ModuleList::FindFirstModule (const ModuleSpec &module_spec) const
{
ModuleSP module_sp;
Mutex::Locker locker(m_modules_mutex);
@@ -554,7 +622,7 @@ ModuleList::LogUUIDAndPaths (LogSP &log_sp, const char *prefix_cstr)
}
bool
-ModuleList::ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr)
+ModuleList::ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr) const
{
Mutex::Locker locker(m_modules_mutex);
collection::const_iterator pos, end = m_modules.end();
@@ -568,7 +636,7 @@ ModuleList::ResolveFileAddress (lldb::addr_t vm_addr, Address& so_addr)
}
uint32_t
-ModuleList::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc)
+ModuleList::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) const
{
// The address is already section offset so it has a module
uint32_t resolved_flags = 0;
@@ -604,14 +672,14 @@ ModuleList::ResolveSymbolContextForFilePath
bool check_inlines,
uint32_t resolve_scope,
SymbolContextList& sc_list
-)
+) const
{
FileSpec file_spec(file_path, false);
return ResolveSymbolContextsForFileSpec (file_spec, line, check_inlines, resolve_scope, sc_list);
}
uint32_t
-ModuleList::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list)
+ModuleList::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) const
{
Mutex::Locker locker(m_modules_mutex);
collection::const_iterator pos, end = m_modules.end();
diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp
index 60f7dbbe2a7..d9af19ed183 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -204,7 +204,7 @@ SearchFilter::DoModuleIteration (const SymbolContext &context, Searcher &searche
}
else
{
- ModuleList &target_images = m_target_sp->GetImages();
+ const ModuleList &target_images = m_target_sp->GetImages();
Mutex::Locker modules_locker(target_images.GetMutex());
size_t n_modules = target_images.GetSize();
@@ -428,7 +428,7 @@ SearchFilterByModule::Search (Searcher &searcher)
// filespec that passes. Otherwise, we need to go through all modules and
// find the ones that match the file name.
- ModuleList &target_modules = m_target_sp->GetImages();
+ const ModuleList &target_modules = m_target_sp->GetImages();
Mutex::Locker modules_locker (target_modules.GetMutex());
const size_t num_modules = target_modules.GetSize ();
@@ -595,7 +595,7 @@ SearchFilterByModuleList::Search (Searcher &searcher)
// filespec that passes. Otherwise, we need to go through all modules and
// find the ones that match the file name.
- ModuleList &target_modules = m_target_sp->GetImages();
+ const ModuleList &target_modules = m_target_sp->GetImages();
Mutex::Locker modules_locker (target_modules.GetMutex());
const size_t num_modules = target_modules.GetSize ();
@@ -768,7 +768,7 @@ SearchFilterByModuleListAndCU::Search (Searcher &searcher)
// find the ones that match the file name.
ModuleList matching_modules;
- ModuleList &target_images = m_target_sp->GetImages();
+ const ModuleList &target_images = m_target_sp->GetImages();
Mutex::Locker modules_locker(target_images.GetMutex());
const size_t num_modules = target_images.GetSize ();
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index e238303278c..67fdace84d1 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -250,7 +250,7 @@ ClangASTSource::CompleteType (TagDecl *tag_decl)
ConstString name(tag_decl->getName().str().c_str());
ClangNamespaceDecl namespace_decl;
- ModuleList &module_list = m_target->GetImages();
+ const ModuleList &module_list = m_target->GetImages();
bool exact_match = false;
module_list.FindTypes (null_sc, name, exact_match, UINT32_MAX, types);
@@ -612,7 +612,7 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context,
}
else
{
- ModuleList &target_images = m_target->GetImages();
+ const ModuleList &target_images = m_target->GetImages();
Mutex::Locker modules_locker (target_images.GetMutex());
for (uint32_t i = 0, e = target_images.GetSize();
@@ -1536,7 +1536,7 @@ ClangASTSource::CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespac
}
else
{
- ModuleList &target_images = m_target->GetImages();
+ const ModuleList &target_images = m_target->GetImages();
Mutex::Locker modules_locker(target_images.GetMutex());
ClangNamespaceDecl null_namespace_decl;
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 3863762a276..194f21e0067 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -281,7 +281,7 @@ DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule (
{
if (uuid_is_valid)
{
- ModuleList &target_images = target.GetImages();
+ const ModuleList &target_images = target.GetImages();
module_sp = target_images.FindModule(uuid);
if (!module_sp)
@@ -669,10 +669,7 @@ DynamicLoaderDarwinKernel::AddModulesUsingImageInfos (OSKextLoadedKextSummary::c
loaded_module_list.AppendIfNeeded (image_infos[idx].module_sp);
}
- if (loaded_module_list.GetSize() > 0)
- {
- m_process->GetTarget().ModulesDidLoad (loaded_module_list);
- }
+ m_process->GetTarget().ModulesDidLoad (loaded_module_list);
return true;
}
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 1b9be627569..4723da8b184 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -287,7 +287,9 @@ DynamicLoaderMacOSXDYLD::FindTargetModuleForDYLDImageInfo (const DYLDImageInfo &
{
if (did_create_ptr)
*did_create_ptr = false;
- ModuleList &target_images = m_process->GetTarget().GetImages();
+
+
+ const ModuleList &target_images = m_process->GetTarget().GetImages();
ModuleSpec module_spec (image_info.file_spec, image_info.GetArchitecture ());
module_spec.GetUUID() = image_info.uuid;
ModuleSP module_sp (target_images.FindFirstModule (module_spec));
@@ -816,7 +818,7 @@ DynamicLoaderMacOSXDYLD::AddModulesUsingImageInfos (DYLDImageInfo::collection &i
Section *commpage_section = sections->FindSectionByName(commpage_dbstr).get();
if (commpage_section)
{
- ModuleList& target_images = m_process->GetTarget().GetImages();
+ const ModuleList& target_images = m_process->GetTarget().GetImages();
ModuleSpec module_spec (objfile->GetFileSpec(), image_infos[idx].GetArchitecture ());
module_spec.GetObjectName() = commpage_dbstr;
ModuleSP commpage_image_module_sp(target_images.FindFirstModule (module_spec));
@@ -966,7 +968,7 @@ DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress (lldb::addr_t image
log->PutCString("Unloaded:");
unloaded_module_list.LogUUIDAndPaths (log, "DynamicLoaderMacOSXDYLD::ModulesDidUnload");
}
- m_process->GetTarget().ModulesDidUnload (unloaded_module_list);
+ m_process->GetTarget().GetImages().Remove (unloaded_module_list);
}
m_dyld_image_infos_stop_id = m_process->GetStopID();
return true;
@@ -1060,7 +1062,7 @@ DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos ()
// to an equivalent version. We don't want it to stay in the target's module list or it will confuse
// us, so unload it here.
Target &target = m_process->GetTarget();
- ModuleList &target_modules = target.GetImages();
+ const ModuleList &target_modules = target.GetImages();
ModuleList not_loaded_modules;
Mutex::Locker modules_locker(target_modules.GetMutex());
@@ -1082,7 +1084,7 @@ DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos ()
if (not_loaded_modules.GetSize() != 0)
{
- target.ModulesDidUnload(not_loaded_modules);
+ target.GetImages().Remove(not_loaded_modules);
}
return true;
@@ -1586,7 +1588,7 @@ DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop
{
SymbolContextList target_symbols;
TargetSP target_sp (thread.CalculateTarget());
- ModuleList &images = target_sp->GetImages();
+ const ModuleList &images = target_sp->GetImages();
images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeCode, target_symbols);
diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 251590fac16..1400427094b 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -271,9 +271,8 @@ DynamicLoaderPOSIXDYLD::RefreshModules()
FileSpec file(I->path.c_str(), true);
ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr);
if (module_sp.get())
- new_modules.Append(module_sp);
+ loaded_modules.AppendIfNeeded(module_sp);
}
- m_process->GetTarget().ModulesDidLoad(new_modules);
}
if (m_rendezvous.ModulesDidUnload())
@@ -290,7 +289,7 @@ DynamicLoaderPOSIXDYLD::RefreshModules()
if (module_sp.get())
old_modules.Append(module_sp);
}
- m_process->GetTarget().ModulesDidUnload(old_modules);
+ loaded_modules.Remove(old_modules);
}
}
@@ -312,7 +311,7 @@ DynamicLoaderPOSIXDYLD::GetStepThroughTrampolinePlan(Thread &thread, bool stop)
SymbolContextList target_symbols;
Target &target = thread.GetProcess()->GetTarget();
- ModuleList &images = target.GetImages();
+ const ModuleList &images = target.GetImages();
images.FindSymbolsWithNameAndType(sym_name, eSymbolTypeCode, target_symbols);
size_t num_targets = target_symbols.GetSize();
diff --git a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
index 9b15ea8e49c..f27f0a19d5d 100644
--- a/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
@@ -95,7 +95,7 @@ DynamicLoaderStatic::DidLaunch ()
void
DynamicLoaderStatic::LoadAllImagesAtFileAddresses ()
{
- ModuleList &module_list = m_process->GetTarget().GetImages();
+ const ModuleList &module_list = m_process->GetTarget().GetImages();
ModuleList loaded_module_list;
@@ -143,8 +143,7 @@ DynamicLoaderStatic::LoadAllImagesAtFileAddresses ()
}
}
- if (loaded_module_list.GetSize())
- m_process->GetTarget().ModulesDidLoad (loaded_module_list);
+ m_process->GetTarget().ModulesDidLoad (loaded_module_list);
}
ThreadPlanSP
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 995a438ca89..a49b2137f1d 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -178,7 +178,7 @@ AppleObjCRuntime::GetObjCModule ()
Process *process = GetProcess();
if (process)
{
- ModuleList& modules = process->GetTarget().GetImages();
+ const ModuleList& modules = process->GetTarget().GetImages();
for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
{
module_sp = modules.GetModuleAtIndex(idx);
@@ -197,7 +197,7 @@ AppleObjCRuntime::GetPrintForDebuggerAddr()
{
if (!m_PrintForDebugger_addr.get())
{
- ModuleList &modules = m_process->GetTarget().GetImages();
+ const ModuleList &modules = m_process->GetTarget().GetImages();
SymbolContextList contexts;
SymbolContext context;
@@ -289,7 +289,7 @@ AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp)
return eObjC_VersionUnknown;
Target &target = process->GetTarget();
- ModuleList &target_modules = target.GetImages();
+ const ModuleList &target_modules = target.GetImages();
Mutex::Locker modules_locker(target_modules.GetMutex());
size_t num_images = target_modules.GetSize();
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 4b13cba5bb6..5b758c86ca5 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -1617,7 +1617,7 @@ protected:
{
if (!target_sp)
return eLazyBoolCalculate;
- ModuleList& modules = target_sp->GetImages();
+ const ModuleList& modules = target_sp->GetImages();
for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
{
lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index d84bccd69b6..25a2bfa4f7f 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -334,7 +334,7 @@ AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols ()
return true;
Target &target = m_process_sp->GetTarget();
- ModuleList &target_modules = target.GetImages();
+ const ModuleList &target_modules = target.GetImages();
Mutex::Locker modules_locker(target_modules.GetMutex());
size_t num_modules = target_modules.GetSize();
if (!m_objc_module_sp)
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 7deadc0a493..a0d47b95c90 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -18,6 +18,7 @@
#include "lldb/Core/Error.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -47,6 +48,37 @@ PlatformDarwin::~PlatformDarwin()
{
}
+FileSpec
+PlatformDarwin::LocateExecutableScriptingResource (const ModuleSpec &module_spec)
+{
+ const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
+ const ArchSpec *arch = module_spec.GetArchitecturePtr();
+ const UUID *uuid = module_spec.GetUUIDPtr();
+
+ Timer scoped_timer (__PRETTY_FUNCTION__,
+ "LocateExecutableScriptingResource (file = %s, arch = %s, uuid = %p)",
+ exec_fspec ? exec_fspec->GetFilename().AsCString ("<NULL>") : "<NULL>",
+ arch ? arch->GetArchitectureName() : "<NULL>",
+ uuid);
+
+
+ FileSpec symbol_fspec (Symbols::LocateExecutableSymbolFile(module_spec));
+
+ FileSpec script_fspec;
+
+ if (symbol_fspec && symbol_fspec.Exists())
+ {
+ // for OSX we are going to be in .dSYM/Contents/Resources/DWARF/<basename>
+ // let us go to .dSYM/Contents/Resources/Python/<basename>.py and see if the file exists
+ StreamString path_string;
+ path_string.Printf("%s/../Python/%s.py",symbol_fspec.GetDirectory().GetCString(),module_spec.GetFileSpec().GetFileNameStrippingExtension().GetCString());
+ script_fspec.SetFile(path_string.GetData(), true);
+ if (!script_fspec.Exists())
+ script_fspec.Clear();
+ }
+
+ return script_fspec;
+}
Error
PlatformDarwin::ResolveExecutable (const FileSpec &exe_file,
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
index 9376a660bcc..ddb3ead0202 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -38,6 +38,9 @@ public:
const lldb_private::ModuleSpec &sym_spec,
lldb_private::FileSpec &sym_file);
+ lldb_private::FileSpec
+ LocateExecutableScriptingResource (const lldb_private::ModuleSpec &module_spec);
+
virtual lldb_private::Error
GetSharedModule (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp
index 0be1c96d1ce..f61e5c0c799 100644
--- a/lldb/source/Target/ObjCLanguageRuntime.cpp
+++ b/lldb/source/Target/ObjCLanguageRuntime.cpp
@@ -75,7 +75,7 @@ ObjCLanguageRuntime::LookupInCompleteClassCache (ConstString &name)
m_complete_class_cache.erase(name);
}
- ModuleList &modules = m_process->GetTarget().GetImages();
+ const ModuleList &modules = m_process->GetTarget().GetImages();
SymbolContextList sc_list;
const size_t matching_symbols = modules.FindSymbolsWithNameAndType (name,
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 6772abf00be..86ef2a022ea 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -89,6 +89,12 @@ Platform::GetFile (const FileSpec &platform_file,
return Error();
}
+FileSpec
+Platform::LocateExecutableScriptingResource (const ModuleSpec &module_spec)
+{
+ return FileSpec();
+}
+
Error
Platform::GetSharedModule (const ModuleSpec &module_spec,
ModuleSP &module_sp,
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index cdbdec49af1..ee6fd27ae62 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2980,7 +2980,7 @@ Process::CompleteAttach ()
m_os_ap.reset (OperatingSystem::FindPlugin (this, NULL));
// Figure out which one is the executable, and set that in our target:
- ModuleList &target_modules = m_target.GetImages();
+ const ModuleList &target_modules = m_target.GetImages();
Mutex::Locker modules_locker(target_modules.GetMutex());
size_t num_modules = target_modules.GetSize();
ModuleSP new_executable_module_sp;
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index fa9fb54f5a7..b9616039125 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -64,7 +64,7 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat
m_platform_sp (platform_sp),
m_mutex (Mutex::eMutexTypeRecursive),
m_arch (target_arch),
- m_images (),
+ m_images (this),
m_section_load_list (),
m_breakpoint_list (false),
m_internal_breakpoint_list (true),
@@ -954,6 +954,18 @@ Target::GetExecutableModulePointer ()
return m_images.GetModulePointerAtIndex(0);
}
+static void
+LoadScriptingResourceForModule (const ModuleSP &module_sp, Target *target)
+{
+ Error error;
+ if (module_sp && !module_sp->LoadScriptingResourceInTarget(target, error))
+ {
+ target->GetDebugger().GetOutputStream().Printf("unable to load scripting data for module %s - error reported was %s\n",
+ module_sp->GetFileSpec().GetFileNameStrippingExtension().GetCString(),
+ error.AsCString());
+ }
+}
+
void
Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
{
@@ -1047,16 +1059,31 @@ Target::SetArchitecture (const ArchSpec &arch_spec)
}
void
-Target::ModuleAdded (ModuleSP &module_sp)
+Target::WillClearList ()
+{
+}
+
+void
+Target::ModuleAdded (const ModuleSP &module_sp)
{
// A module is being added to this target for the first time
ModuleList module_list;
module_list.Append(module_sp);
+ LoadScriptingResourceForModule(module_sp, this);
ModulesDidLoad (module_list);
}
void
-Target::ModuleUpdated (ModuleSP &old_module_sp, ModuleSP &new_module_sp)
+Target::ModuleRemoved (const ModuleSP &module_sp)
+{
+ // A module is being added to this target for the first time
+ ModuleList module_list;
+ module_list.Append(module_sp);
+ ModulesDidUnload (module_list);
+}
+
+void
+Target::ModuleUpdated (const ModuleSP &old_module_sp, const ModuleSP &new_module_sp)
{
// A module is replacing an already added module
m_breakpoint_list.UpdateBreakpointsWhenModuleIsReplaced(old_module_sp, new_module_sp);
@@ -1065,28 +1092,28 @@ Target::ModuleUpdated (ModuleSP &old_module_sp, ModuleSP &new_module_sp)
void
Target::ModulesDidLoad (ModuleList &module_list)
{
- m_breakpoint_list.UpdateBreakpoints (module_list, true);
- // TODO: make event data that packages up the module_list
- BroadcastEvent (eBroadcastBitModulesLoaded, NULL);
+ if (module_list.GetSize())
+ {
+ m_breakpoint_list.UpdateBreakpoints (module_list, true);
+ // TODO: make event data that packages up the module_list
+ BroadcastEvent (eBroadcastBitModulesLoaded, NULL);
+ }
}
void
Target::ModulesDidUnload (ModuleList &module_list)
{
- m_breakpoint_list.UpdateBreakpoints (module_list, false);
-
- // Remove the images from the target image list
- m_images.Remove(module_list);
-
- // TODO: make event data that packages up the module_list
- BroadcastEvent (eBroadcastBitModulesUnloaded, NULL);
+ if (module_list.GetSize())
+ {
+ m_breakpoint_list.UpdateBreakpoints (module_list, false);
+ // TODO: make event data that packages up the module_list
+ BroadcastEvent (eBroadcastBitModulesUnloaded, NULL);
+ }
}
-
bool
Target::ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_file_spec)
{
-
if (GetBreakpointsConsultPlatformAvoidList())
{
ModuleList matchingModules;
@@ -1456,17 +1483,15 @@ Target::GetSharedModule (const ModuleSpec &module_spec, Error *error_ptr)
}
}
- m_images.Append (module_sp);
if (old_module_sp && m_images.GetIndexForModule (old_module_sp.get()) != LLDB_INVALID_INDEX32)
{
- ModuleUpdated(old_module_sp, module_sp);
- m_images.Remove (old_module_sp);
+ m_images.ReplaceModule(old_module_sp, module_sp);
Module *old_module_ptr = old_module_sp.get();
old_module_sp.reset();
ModuleList::RemoveSharedModuleIfOrphaned (old_module_ptr);
}
else
- ModuleAdded(module_sp);
+ m_images.Append(module_sp);
}
}
if (error_ptr)
OpenPOWER on IntegriCloud