The LLDB API (lldb::SB*) is now thread safe!

llvm-svn: 122262
This commit is contained in:
Greg Clayton
2010-12-20 20:49:23 +00:00
parent 3307d7cbad
commit af67cecd47
23 changed files with 537 additions and 497 deletions

View File

@@ -91,6 +91,10 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb
result.Clear();
if (m_opaque_ptr)
{
TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
Mutex::Locker api_locker;
if (target_sp)
api_locker.Reset(target_sp->GetAPIMutex().GetMutex());
m_opaque_ptr->HandleCommand (command_line, add_to_history, result.ref());
}
else
@@ -163,10 +167,12 @@ SBCommandInterpreter::GetProcess ()
SBProcess process;
if (m_opaque_ptr)
{
Debugger &debugger = m_opaque_ptr->GetDebugger();
Target *target = debugger.GetSelectedTarget().get();
if (target)
process.SetProcess(target->GetProcessSP());
TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
if (target_sp)
{
Mutex::Locker api_locker(target_sp->GetAPIMutex());
process.SetProcess(target_sp->GetProcessSP());
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -229,6 +235,10 @@ SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &resu
result.Clear();
if (m_opaque_ptr)
{
TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
Mutex::Locker api_locker;
if (target_sp)
api_locker.Reset(target_sp->GetAPIMutex().GetMutex());
m_opaque_ptr->SourceInitFile (false, result.ref());
}
else
@@ -250,6 +260,10 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb
result.Clear();
if (m_opaque_ptr)
{
TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
Mutex::Locker api_locker;
if (target_sp)
api_locker.Reset(target_sp->GetAPIMutex().GetMutex());
m_opaque_ptr->SourceInitFile (true, result.ref());
}
else