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/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index 3145984..980f9d2 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -174,7 +174,7 @@
         exe_module->GetFileSpec().GetPath(filename, sizeof(filename));
 
         StateType state = eStateInvalid;
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         if (process)
         {
             state = process->GetState();
@@ -566,7 +566,7 @@
         // and the target actually stopping.  So even if the interpreter is set to be asynchronous, we wait for the stop
         // ourselves here.
         
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         StateType state = eStateInvalid;
         if (process)
         {
@@ -828,7 +828,7 @@
     Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         bool synchronous_execution = m_interpreter.GetSynchronous ();
 
         if (process == NULL)
@@ -915,7 +915,7 @@
     Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         if (process == NULL)
         {
             result.AppendError ("must have a valid process in order to detach");
@@ -1025,7 +1025,7 @@
         
         TargetSP target_sp (m_interpreter.GetDebugger().GetSelectedTarget());
         Error error;        
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         if (process)
         {
             if (process->IsAlive())
@@ -1139,7 +1139,7 @@
     Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         if (process == NULL)
         {
             result.AppendError ("must have a valid process in order to load a shared library");
@@ -1198,7 +1198,7 @@
     Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         if (process == NULL)
         {
             result.AppendError ("must have a valid process in order to load a shared library");
@@ -1275,7 +1275,7 @@
     Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         if (process == NULL)
         {
             result.AppendError ("no process to signal");
@@ -1350,7 +1350,7 @@
     Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         if (process == NULL)
         {
             result.AppendError ("no process to halt");
@@ -1412,7 +1412,7 @@
     Execute (Args& command,
              CommandReturnObject &result)
     {
-        Process *process = m_interpreter.GetExecutionContext().process;
+        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
         if (process == NULL)
         {
             result.AppendError ("no process to kill");
@@ -1476,18 +1476,19 @@
         Stream &strm = result.GetOutputStream();
         result.SetStatus (eReturnStatusSuccessFinishNoResult);
         ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
-        if (exe_ctx.process)
+        Process *process = exe_ctx.GetProcessPtr();
+        if (process)
         {
             const bool only_threads_with_stop_reason = true;
             const uint32_t start_frame = 0;
             const uint32_t num_frames = 1;
             const uint32_t num_frames_with_source = 1;
-            exe_ctx.process->GetStatus(strm);
-            exe_ctx.process->GetThreadStatus (strm, 
-                                              only_threads_with_stop_reason, 
-                                              start_frame,
-                                              num_frames,
-                                              num_frames_with_source);
+            process->GetStatus(strm);
+            process->GetThreadStatus (strm, 
+                                      only_threads_with_stop_reason, 
+                                      start_frame,
+                                      num_frames,
+                                      num_frames_with_source);
             
         }
         else