forked from OSchip/llvm-project
Minor cleanups to the new ModuleList notification APIs: passing in the ModuleList as part of the callbacks, and not copying the notifier as part of copy constructing and assigning
llvm-svn: 167592
This commit is contained in:
parent
8d16bd4d10
commit
efe637d440
|
@ -32,14 +32,14 @@ public:
|
|||
{
|
||||
public:
|
||||
virtual void
|
||||
ModuleAdded (const lldb::ModuleSP& module_sp) = 0;
|
||||
ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp) = 0;
|
||||
virtual void
|
||||
ModuleRemoved (const lldb::ModuleSP& module_sp) = 0;
|
||||
ModuleRemoved (const ModuleList& module_list, const lldb::ModuleSP& module_sp) = 0;
|
||||
virtual void
|
||||
ModuleUpdated (const lldb::ModuleSP& old_module_sp,
|
||||
ModuleUpdated (const ModuleList& module_list, const lldb::ModuleSP& old_module_sp,
|
||||
const lldb::ModuleSP& new_module_sp) = 0;
|
||||
virtual void
|
||||
WillClearList () = 0;
|
||||
WillClearList (const ModuleList& module_list) = 0;
|
||||
|
||||
virtual
|
||||
~Notifier ()
|
||||
|
|
|
@ -621,16 +621,17 @@ protected:
|
|||
//------------------------------------------------------------------
|
||||
|
||||
virtual void
|
||||
ModuleAdded (const lldb::ModuleSP& module_sp);
|
||||
ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp);
|
||||
|
||||
virtual void
|
||||
ModuleRemoved (const lldb::ModuleSP& module_sp);
|
||||
ModuleRemoved (const ModuleList& module_list, const lldb::ModuleSP& module_sp);
|
||||
|
||||
virtual void
|
||||
ModuleUpdated (const lldb::ModuleSP& old_module_sp,
|
||||
ModuleUpdated (const ModuleList& module_list,
|
||||
const lldb::ModuleSP& old_module_sp,
|
||||
const lldb::ModuleSP& new_module_sp);
|
||||
virtual void
|
||||
WillClearList ();
|
||||
WillClearList (const ModuleList& module_list);
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ 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) :
|
||||
|
@ -66,7 +65,6 @@ 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;
|
||||
}
|
||||
|
@ -86,7 +84,7 @@ ModuleList::AppendImpl (const ModuleSP &module_sp, bool use_notifier)
|
|||
Mutex::Locker locker(m_modules_mutex);
|
||||
m_modules.push_back(module_sp);
|
||||
if (use_notifier && m_notifier)
|
||||
m_notifier->ModuleAdded(module_sp);
|
||||
m_notifier->ModuleAdded(*this, module_sp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +168,7 @@ ModuleList::RemoveImpl (const ModuleSP &module_sp, bool use_notifier)
|
|||
{
|
||||
m_modules.erase (pos);
|
||||
if (use_notifier && m_notifier)
|
||||
m_notifier->ModuleRemoved(module_sp);
|
||||
m_notifier->ModuleRemoved(*this, module_sp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +182,7 @@ 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);
|
||||
m_notifier->ModuleRemoved(*this, module_sp);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -201,7 +199,7 @@ ModuleList::ReplaceModule (const lldb::ModuleSP &old_module_sp, const lldb::Modu
|
|||
return false;
|
||||
AppendImpl (new_module_sp, false);
|
||||
if (m_notifier)
|
||||
m_notifier->ModuleUpdated(old_module_sp,new_module_sp);
|
||||
m_notifier->ModuleUpdated(*this, old_module_sp,new_module_sp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -293,7 +291,7 @@ ModuleList::ClearImpl (bool use_notifier)
|
|||
{
|
||||
Mutex::Locker locker(m_modules_mutex);
|
||||
if (use_notifier && m_notifier)
|
||||
m_notifier->WillClearList();
|
||||
m_notifier->WillClearList(*this);
|
||||
m_modules.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -1059,31 +1059,31 @@ Target::SetArchitecture (const ArchSpec &arch_spec)
|
|||
}
|
||||
|
||||
void
|
||||
Target::WillClearList ()
|
||||
Target::WillClearList (const ModuleList& module_list)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Target::ModuleAdded (const ModuleSP &module_sp)
|
||||
Target::ModuleAdded (const ModuleList& module_list, const ModuleSP &module_sp)
|
||||
{
|
||||
// A module is being added to this target for the first time
|
||||
ModuleList module_list;
|
||||
module_list.Append(module_sp);
|
||||
ModuleList my_module_list;
|
||||
my_module_list.Append(module_sp);
|
||||
LoadScriptingResourceForModule(module_sp, this);
|
||||
ModulesDidLoad (module_list);
|
||||
ModulesDidLoad (my_module_list);
|
||||
}
|
||||
|
||||
void
|
||||
Target::ModuleRemoved (const ModuleSP &module_sp)
|
||||
Target::ModuleRemoved (const ModuleList& module_list, 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);
|
||||
ModuleList my_module_list;
|
||||
my_module_list.Append(module_sp);
|
||||
ModulesDidUnload (my_module_list);
|
||||
}
|
||||
|
||||
void
|
||||
Target::ModuleUpdated (const ModuleSP &old_module_sp, const ModuleSP &new_module_sp)
|
||||
Target::ModuleUpdated (const ModuleList& module_list, 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);
|
||||
|
|
Loading…
Reference in New Issue