forked from OSchip/llvm-project
Lock the target API mutex correctly in all cases and make sure m_opaque_sp
contains a valid pointer before trying to access the target. llvm-svn: 131771
This commit is contained in:
parent
109b127e02
commit
21c5ab4fe1
|
@ -348,14 +348,12 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic)
|
||||||
{
|
{
|
||||||
lldb::ValueObjectSP child_sp;
|
lldb::ValueObjectSP child_sp;
|
||||||
|
|
||||||
|
if (m_opaque_sp)
|
||||||
|
{
|
||||||
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
||||||
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
||||||
|
|
||||||
if (m_opaque_sp)
|
|
||||||
{
|
|
||||||
child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
|
child_sp = m_opaque_sp->GetChildAtIndex (idx, true);
|
||||||
}
|
|
||||||
|
|
||||||
if (use_dynamic != lldb::eNoDynamicValues)
|
if (use_dynamic != lldb::eNoDynamicValues)
|
||||||
{
|
{
|
||||||
if (child_sp)
|
if (child_sp)
|
||||||
|
@ -365,6 +363,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic)
|
||||||
child_sp = dynamic_sp;
|
child_sp = dynamic_sp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SBValue sb_value (child_sp);
|
SBValue sb_value (child_sp);
|
||||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||||
|
@ -379,7 +378,12 @@ SBValue::GetIndexOfChildWithName (const char *name)
|
||||||
{
|
{
|
||||||
uint32_t idx = UINT32_MAX;
|
uint32_t idx = UINT32_MAX;
|
||||||
if (m_opaque_sp)
|
if (m_opaque_sp)
|
||||||
|
{
|
||||||
|
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
||||||
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
||||||
|
|
||||||
idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
|
idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
|
||||||
|
}
|
||||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||||
if (log)
|
if (log)
|
||||||
{
|
{
|
||||||
|
@ -404,15 +408,12 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
|
||||||
lldb::ValueObjectSP child_sp;
|
lldb::ValueObjectSP child_sp;
|
||||||
const ConstString str_name (name);
|
const ConstString str_name (name);
|
||||||
|
|
||||||
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
|
||||||
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
|
||||||
|
|
||||||
|
|
||||||
if (m_opaque_sp)
|
if (m_opaque_sp)
|
||||||
{
|
{
|
||||||
|
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
||||||
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
||||||
child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
|
child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
|
||||||
}
|
|
||||||
|
|
||||||
if (use_dynamic_value != lldb::eNoDynamicValues)
|
if (use_dynamic_value != lldb::eNoDynamicValues)
|
||||||
{
|
{
|
||||||
if (child_sp)
|
if (child_sp)
|
||||||
|
@ -422,6 +423,7 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
|
||||||
child_sp = dynamic_sp;
|
child_sp = dynamic_sp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SBValue sb_value (child_sp);
|
SBValue sb_value (child_sp);
|
||||||
|
|
||||||
|
@ -439,7 +441,12 @@ SBValue::GetNumChildren ()
|
||||||
uint32_t num_children = 0;
|
uint32_t num_children = 0;
|
||||||
|
|
||||||
if (m_opaque_sp)
|
if (m_opaque_sp)
|
||||||
|
{
|
||||||
|
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
||||||
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
||||||
|
|
||||||
num_children = m_opaque_sp->GetNumChildren();
|
num_children = m_opaque_sp->GetNumChildren();
|
||||||
|
}
|
||||||
|
|
||||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||||
if (log)
|
if (log)
|
||||||
|
@ -455,6 +462,9 @@ SBValue::Dereference ()
|
||||||
SBValue sb_value;
|
SBValue sb_value;
|
||||||
if (m_opaque_sp)
|
if (m_opaque_sp)
|
||||||
{
|
{
|
||||||
|
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
||||||
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
sb_value = m_opaque_sp->Dereference (error);
|
sb_value = m_opaque_sp->Dereference (error);
|
||||||
}
|
}
|
||||||
|
@ -471,7 +481,12 @@ SBValue::TypeIsPointerType ()
|
||||||
bool is_ptr_type = false;
|
bool is_ptr_type = false;
|
||||||
|
|
||||||
if (m_opaque_sp)
|
if (m_opaque_sp)
|
||||||
|
{
|
||||||
|
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
||||||
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
||||||
|
|
||||||
is_ptr_type = m_opaque_sp->IsPointerType();
|
is_ptr_type = m_opaque_sp->IsPointerType();
|
||||||
|
}
|
||||||
|
|
||||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||||
if (log)
|
if (log)
|
||||||
|
@ -485,7 +500,12 @@ void *
|
||||||
SBValue::GetOpaqueType()
|
SBValue::GetOpaqueType()
|
||||||
{
|
{
|
||||||
if (m_opaque_sp)
|
if (m_opaque_sp)
|
||||||
|
{
|
||||||
|
if (m_opaque_sp->GetUpdatePoint().GetTarget())
|
||||||
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
|
||||||
|
|
||||||
return m_opaque_sp->GetClangType();
|
return m_opaque_sp->GetClangType();
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue