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());
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150801 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/ScriptInterpreterPython.cpp b/source/Interpreter/ScriptInterpreterPython.cpp
index 71b7162..0aefdaa 100644
--- a/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/source/Interpreter/ScriptInterpreterPython.cpp
@@ -1330,7 +1330,8 @@
if (!valobj.get())
return NULL;
- Target *target = valobj->GetUpdatePoint().GetTargetSP().get();
+ ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
+ Target *target = exe_ctx.GetTargetPtr();
if (!target)
return NULL;
@@ -1448,7 +1449,8 @@
if (!valobj.get())
return "<no object>";
- Target *target = valobj->GetUpdatePoint().GetTargetSP().get();
+ ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
+ Target *target = exe_ctx.GetTargetPtr();
if (!target)
return "<no target>";