Add the ability to set timeout & "run all threads" options both from the "expr" command and from
the SB API's that evaluate expressions.

<rdar://problem/12457211>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166062 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index b94a0ce..f89c25b 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -40,6 +40,7 @@
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBValue.h"
 #include "lldb/API/SBAddress.h"
+#include "lldb/API/SBExpressionOptions.h"
 #include "lldb/API/SBStream.h"
 #include "lldb/API/SBSymbolContext.h"
 #include "lldb/API/SBThread.h"
@@ -1040,8 +1041,11 @@
     Target *target = exe_ctx.GetTargetPtr();
     if (frame && target)
     {
-        lldb::DynamicValueType use_dynamic = frame->CalculateTarget()->GetPreferDynamicValue();
-        result = EvaluateExpression (expr, use_dynamic);
+        SBExpressionOptions options;
+        lldb::DynamicValueType fetch_dynamic_value = frame->CalculateTarget()->GetPreferDynamicValue();
+        options.SetUseDynamic (fetch_dynamic_value);
+        options.SetUnwindOnError (true);
+        return EvaluateExpression (expr, options);
     }
     return result;
 }
@@ -1049,12 +1053,24 @@
 SBValue
 SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value)
 {
-    return EvaluateExpression (expr, fetch_dynamic_value, true);
+    SBExpressionOptions options;
+    options.SetUseDynamic (fetch_dynamic_value);
+    options.SetUnwindOnError (true);
+    return EvaluateExpression (expr, options);
 }
 
 SBValue
 SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value, bool unwind_on_error)
 {
+    SBExpressionOptions options;
+    options.SetUseDynamic (fetch_dynamic_value);
+    options.SetUnwindOnError (unwind_on_error);
+    return EvaluateExpression (expr, options);
+}
+
+lldb::SBValue
+SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &options)
+{
     LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     
     LogSP expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -1080,16 +1096,12 @@
             StreamString frame_description;
             frame->DumpUsingSettingsFormat (&frame_description);
             Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
-                                                 expr, fetch_dynamic_value, frame_description.GetString().c_str());
+                                                 expr, options.GetUseDynamic(), frame_description.GetString().c_str());
 #endif
-            Target::EvaluateExpressionOptions options;
-            options.SetUnwindOnError(unwind_on_error)
-            .SetUseDynamic(fetch_dynamic_value);
-            
             exe_results = target->EvaluateExpression (expr, 
                                                       frame,
                                                       expr_value_sp,
-                                                      options);
+                                                      options.ref());
             expr_result.SetSP(expr_value_sp);
 #ifdef LLDB_CONFIGURATION_DEBUG
             Host::SetCrashDescription (NULL);