Converted the lldb_private::Process over to use the intrusive

shared pointers.

Changed the ExecutionContext over to use shared pointers for
the target, process, thread and frame since these objects can
easily go away at any time and any object that was holding onto
an ExecutionContext was running the risk of using a bad object.

Now that the shared pointers for target, process, thread and
frame are just a single pointer (they all use the instrusive
shared pointers) the execution context is much safer and still
the same size. 

Made the shared pointers in the the ExecutionContext class protected
and made accessors for all of the various ways to get at the pointers,
references, and shared pointers.

llvm-svn: 140298
This commit is contained in:
Greg Clayton
2011-09-22 04:58:26 +00:00
parent 3d10b95bf7
commit c14ee32db5
59 changed files with 1112 additions and 737 deletions

View File

@@ -912,8 +912,8 @@ void
Thread::CalculateExecutionContext (ExecutionContext &exe_ctx)
{
m_process.CalculateExecutionContext (exe_ctx);
exe_ctx.thread = this;
exe_ctx.frame = NULL;
exe_ctx.SetThreadPtr (this);
exe_ctx.SetFramePtr (NULL);
}
@@ -943,16 +943,17 @@ void
Thread::DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx)
{
ExecutionContext exe_ctx;
StackFrameSP frame_sp;
SymbolContext frame_sc;
CalculateExecutionContext (exe_ctx);
if (frame_idx != LLDB_INVALID_INDEX32)
{
StackFrameSP frame_sp(GetStackFrameAtIndex (frame_idx));
frame_sp = GetStackFrameAtIndex (frame_idx);
if (frame_sp)
{
exe_ctx.frame = frame_sp.get();
frame_sc = exe_ctx.frame->GetSymbolContext(eSymbolContextEverything);
exe_ctx.SetFrameSP(frame_sp);
frame_sc = frame_sp->GetSymbolContext(eSymbolContextEverything);
}
}
@@ -960,7 +961,7 @@ Thread::DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx)
assert (thread_format);
const char *end = NULL;
Debugger::FormatPrompt (thread_format,
exe_ctx.frame ? &frame_sc : NULL,
frame_sp ? &frame_sc : NULL,
&exe_ctx,
NULL,
strm,