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/ValueObjectDynamicValue.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/ValueObjectDynamicValue.cpp')
-rw-r--r-- | lldb/source/Core/ValueObjectDynamicValue.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index 5ea7993411b..e608ce9bb70 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -117,7 +117,7 @@ ValueObjectCast::UpdateValue () // say we are changed if our location has changed. SetValueDidChange (m_value.GetValueType() != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar()); } - ExecutionContext exe_ctx (GetExecutionContextScope()); + ExecutionContext exe_ctx (GetExecutionContextRef()); m_error = m_value.GetValueAsData(&exe_ctx, GetClangAST(), m_data, 0, GetModule()); SetValueDidChange (m_parent->GetValueDidChange()); return true; @@ -235,7 +235,7 @@ ValueObjectDynamicValue::UpdateValue () return true; } - ExecutionContext exe_ctx (GetExecutionContextScope()); + ExecutionContext exe_ctx (GetExecutionContextRef()); Target *target = exe_ctx.GetTargetPtr(); if (target) { @@ -244,7 +244,7 @@ ValueObjectDynamicValue::UpdateValue () } // First make sure our Type and/or Address haven't changed: - Process *process = m_update_point.GetProcessSP().get(); + Process *process = exe_ctx.GetProcessPtr(); if (!process) return false; @@ -311,7 +311,8 @@ ValueObjectDynamicValue::UpdateValue () // We've moved, so we should be fine... m_address = dynamic_address; - lldb::addr_t load_address = m_address.GetLoadAddress(m_update_point.GetTargetSP().get()); + lldb::TargetSP target_sp (GetTargetSP()); + lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get()); m_value.GetScalar() = load_address; } |