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.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140298 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index 9f2e3a1..5e3f3d7 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -487,22 +487,24 @@
lldb::user_id_t break_loc_id
)
{
- BreakpointSP bp_sp(ctx->exe_ctx.target->GetBreakpointList().FindBreakpointByID(break_id));
+ BreakpointSP bp_sp(ctx->exe_ctx.GetTargetRef().GetBreakpointList().FindBreakpointByID(break_id));
if (baton && bp_sp)
{
CallbackData *data = (CallbackData *)baton;
lldb_private::Breakpoint *bp = bp_sp.get();
if (bp && data->callback)
{
- if (ctx->exe_ctx.process)
+ Process *process = ctx->exe_ctx.GetProcessPtr();
+ if (process)
{
- SBProcess sb_process (ctx->exe_ctx.process->GetSP());
+ SBProcess sb_process (process->GetSP());
SBThread sb_thread;
SBBreakpointLocation sb_location;
assert (bp_sp);
sb_location.SetLocation (bp_sp->FindLocationByID (break_loc_id));
- if (ctx->exe_ctx.thread)
- sb_thread.SetThread(ctx->exe_ctx.thread->GetSP());
+ Thread *thread = ctx->exe_ctx.GetThreadPtr();
+ if (thread)
+ sb_thread.SetThread(thread->GetSP());
return data->callback (data->callback_baton,
sb_process,
@@ -522,7 +524,7 @@
if (log)
log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton);
- if (m_opaque_sp.get())
+ if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton));
diff --git a/source/API/SBFunction.cpp b/source/API/SBFunction.cpp
index de9f6ae..e037f83 100644
--- a/source/API/SBFunction.cpp
+++ b/source/API/SBFunction.cpp
@@ -131,7 +131,7 @@
{
api_locker.Reset (target->GetAPIMutex().GetMutex());
target->CalculateExecutionContext (exe_ctx);
- exe_ctx.process = target->GetProcessSP().get();
+ exe_ctx.SetProcessSP(target->GetProcessSP());
}
Module *module = m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule();
if (module)
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index 0a5594a..0be59af 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -122,7 +122,7 @@
{
lldb_private::ExecutionContext exe_ctx;
frame->CalculateExecutionContext (exe_ctx);
- lldb_private::Target *target = exe_ctx.target;
+ lldb_private::Target *target = exe_ctx.GetTargetPtr();
lldb_private::ArchSpec arch = target->GetArchitecture();
return m_opaque_sp->Emulate (arch,