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
This commit is contained in:
Greg Clayton
2012-02-17 07:49:44 +00:00
parent dd19169988
commit cc4d0146b4
23 changed files with 1290 additions and 731 deletions

View File

@@ -1330,7 +1330,8 @@ ScriptInterpreterPython::CreateSyntheticScriptedProvider (std::string class_name
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 @@ ScriptInterpreterPython::CallPythonScriptFunction (const char *python_function_n
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>";