diff options
author | Greg Clayton <gclayton@apple.com> | 2012-02-17 07:49:44 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-02-17 07:49:44 +0000 |
commit | cc4d0146b4f5edf4cebf06697f52959409136591 (patch) | |
tree | 9aa64046056d513eb1e506b126f89584e8ef9aee /lldb/source/Core/ValueObjectConstResultImpl.cpp | |
parent | dd19169988da4fca1149852c67019e448f13c75f (diff) | |
download | bcm5719-llvm-cc4d0146b4f5edf4cebf06697f52959409136591.tar.gz bcm5719-llvm-cc4d0146b4f5edf4cebf06697f52959409136591.zip |
This checking is part one of trying to add some threading safety to our
internals. The first part of this is to use a new class:
lldb_private::ExecutionContextRef
This class holds onto weak pointers to the target, process, thread and frame
and it also contains the thread ID and frame Stack ID in case the thread and
frame objects go away and come back as new objects that represent the same
logical thread/frame.
ExecutionContextRef objcets have accessors to access shared pointers for
the target, process, thread and frame which might return NULL if the backing
object is no longer available. This allows for references to persistent program
state without needing to hold a shared pointer to each object and potentially
keeping that object around for longer than it needs to be.
You can also "Lock" and ExecutionContextRef (which contains weak pointers)
object into an ExecutionContext (which contains strong, or shared pointers)
with code like
ExecutionContext exe_ctx (my_obj->GetExectionContextRef().Lock());
llvm-svn: 150801
Diffstat (limited to 'lldb/source/Core/ValueObjectConstResultImpl.cpp')
-rw-r--r-- | lldb/source/Core/ValueObjectConstResultImpl.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lldb/source/Core/ValueObjectConstResultImpl.cpp b/lldb/source/Core/ValueObjectConstResultImpl.cpp index 31646b4ca0b..731f3938e28 100644 --- a/lldb/source/Core/ValueObjectConstResultImpl.cpp +++ b/lldb/source/Core/ValueObjectConstResultImpl.cpp @@ -53,13 +53,14 @@ ValueObjectConstResultImpl::DerefOnTarget() if (m_load_addr_backend.get() == NULL) { lldb::addr_t tgt_address = m_impl_backend->GetPointerValue(); - m_load_addr_backend = ValueObjectConstResult::Create (m_impl_backend->GetExecutionContextScope(), + ExecutionContext exe_ctx (m_impl_backend->GetExecutionContextRef()); + m_load_addr_backend = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), m_impl_backend->GetClangAST(), m_impl_backend->GetClangType(), m_impl_backend->GetName(), tgt_address, eAddressTypeLoad, - m_impl_backend->GetUpdatePoint().GetProcessSP()->GetAddressByteSize()); + exe_ctx.GetAddressByteSize()); } return m_load_addr_backend; } @@ -107,8 +108,7 @@ ValueObjectConstResultImpl::CreateChildAtIndex (uint32_t idx, bool synthetic_arr lldb::clang_type_t clang_type = m_impl_backend->GetClangType(); lldb::clang_type_t child_clang_type; - ExecutionContext exe_ctx; - m_impl_backend->GetExecutionContextScope()->CalculateExecutionContext (exe_ctx); + ExecutionContext exe_ctx (m_impl_backend->GetExecutionContextRef()); child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (&exe_ctx, clang_ast, @@ -184,14 +184,14 @@ ValueObjectConstResultImpl::AddressOf (Error &error) std::string new_name("&"); new_name.append(m_impl_backend->GetName().AsCString("")); - - m_address_of_backend = ValueObjectConstResult::Create(m_impl_backend->GetExecutionContextScope(), - type.GetASTContext(), - type.GetPointerType(), - ConstString(new_name.c_str()), - buffer, - lldb::endian::InlHostByteOrder(), - m_impl_backend->GetExecutionContextScope()->CalculateProcess()->GetAddressByteSize()); + ExecutionContext exe_ctx (m_impl_backend->GetExecutionContextRef()); + m_address_of_backend = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), + type.GetASTContext(), + type.GetPointerType(), + ConstString(new_name.c_str()), + buffer, + lldb::endian::InlHostByteOrder(), + exe_ctx.GetAddressByteSize()); m_address_of_backend->GetValue().SetValueType(Value::eValueTypeScalar); m_address_of_backend->GetValue().GetScalar() = m_live_address; |