<rdar://problem/11791234>

Fixed a case where the python interpreter could end up holding onto a previous lldb::SBProcess (probably in lldb.process) when run under Xcode. Prior to this fix, the lldb::SBProcess held onto a shared pointer to a lldb_private::Process. This in turn could cause the process to still have a thread list with stack frames. The stack frames would have module shared pointers in the lldb_private::SymbolContext objects. 

We also had issues with things staying in the shared module list too long when we found things by UUID (we didn't remove the out of date ModuleSP from the global module cache).

Now all of this is fixed and everything goes away between runs.

llvm-svn: 160140
This commit is contained in:
Greg Clayton
2012-07-12 20:32:19 +00:00
parent 6140847647
commit 4e0fe8ab95
6 changed files with 63 additions and 47 deletions

View File

@@ -39,7 +39,7 @@ using namespace lldb_private;
SBProcess::SBProcess () :
m_opaque_sp()
m_opaque_wp()
{
}
@@ -49,13 +49,13 @@ SBProcess::SBProcess () :
//----------------------------------------------------------------------
SBProcess::SBProcess (const SBProcess& rhs) :
m_opaque_sp (rhs.m_opaque_sp)
m_opaque_wp (rhs.m_opaque_wp)
{
}
SBProcess::SBProcess (const lldb::ProcessSP &process_sp) :
m_opaque_sp (process_sp)
m_opaque_wp (process_sp)
{
}
@@ -63,7 +63,7 @@ const SBProcess&
SBProcess::operator = (const SBProcess& rhs)
{
if (this != &rhs)
m_opaque_sp = rhs.m_opaque_sp;
m_opaque_wp = rhs.m_opaque_wp;
return *this;
}
@@ -83,26 +83,26 @@ SBProcess::GetBroadcasterClassName ()
lldb::ProcessSP
SBProcess::GetSP() const
{
return m_opaque_sp;
return m_opaque_wp.lock();
}
void
SBProcess::SetSP (const ProcessSP &process_sp)
{
m_opaque_sp = process_sp;
m_opaque_wp = process_sp;
}
void
SBProcess::Clear ()
{
m_opaque_sp.reset();
m_opaque_wp.reset();
}
bool
SBProcess::IsValid() const
{
return m_opaque_sp.get() != NULL;
return m_opaque_wp.lock().get() != NULL;
}
bool
@@ -119,7 +119,7 @@ SBProcess::RemoteLaunch (char const **argv,
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log) {
log->Printf ("SBProcess(%p)::RemoteLaunch (argv=%p, envp=%p, stdin=%s, stdout=%s, stderr=%s, working-dir=%s, launch_flags=0x%x, stop_at_entry=%i, &error (%p))...",
m_opaque_sp.get(),
m_opaque_wp.lock().get(),
argv,
envp,
stdin_path ? stdin_path : "NULL",