Moved the code in ClangUserExpression that set up & ran the thread plan with timeouts, and restarting with all threads into a utility function in Process.  This required a bunch of renaming. 

Added a ThreadPlanCallUserExpression that differs from ThreadPlanCallFunction in that it holds onto a shared pointer to its ClangUserExpression so that can't go away before the thread plan is done using it.

Fixed the stop message when you hit a breakpoint while running a user expression so it is more obvious what has happened.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@120386 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectExpression.cpp b/source/Commands/CommandObjectExpression.cpp
index 32236f8..c58f3f5 100644
--- a/source/Commands/CommandObjectExpression.cpp
+++ b/source/Commands/CommandObjectExpression.cpp
@@ -13,6 +13,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "CommandObjectThread.h" // For DisplayThreadInfo.
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/InputReader.h"
@@ -242,7 +243,8 @@
     if (m_exe_ctx.target)
         prefix = m_exe_ctx.target->GetExpressionPrefixContentsAsCString();
     
-    lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (m_exe_ctx, m_options.unwind_on_error, expr, prefix));
+    lldb::ValueObjectSP result_valobj_sp;
+    Process::ExecutionResults execution_results = ClangUserExpression::Evaluate (m_exe_ctx, m_options.unwind_on_error, expr, prefix, result_valobj_sp);
     assert (result_valobj_sp.get());
     if (result_valobj_sp->GetError().Success())
     {
@@ -267,6 +269,16 @@
     else
     {
         error_stream.PutCString(result_valobj_sp->GetError().AsCString());
+        // If we've been interrupted, display state information.
+        if (execution_results == Process::eExecutionInterrupted && !m_options.unwind_on_error)
+        {
+            if (m_exe_ctx.thread)
+                lldb_private::DisplayThreadInfo (m_interpreter, result->GetOutputStream(), m_exe_ctx.thread, false, true);
+            else
+            {
+                lldb_private::DisplayThreadsInfo (m_interpreter, &m_exe_ctx, *result, true, true); 
+            }
+        }
         if (result)
             result->SetStatus (eReturnStatusFailed);
     }