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/SBValue.cpp b/source/API/SBValue.cpp
index 913a447..0aa01a6 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -40,11 +40,12 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBExpressionOptions.h"
+#include "lldb/API/SBFrame.h"
 #include "lldb/API/SBProcess.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/API/SBThread.h"
-#include "lldb/API/SBFrame.h"
-#include "lldb/API/SBDebugger.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -694,9 +695,12 @@
     if (log)
     {
         if (new_value_sp)
-            log->Printf ("SBValue(%p)::CreateChildAtOffset => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
+            log->Printf ("SBValue(%p)::CreateChildAtOffset => \"%s\"",
+                         value_sp.get(),
+                         new_value_sp->GetName().AsCString());
         else
-            log->Printf ("SBValue(%p)::CreateChildAtOffset => NULL", value_sp.get());
+            log->Printf ("SBValue(%p)::CreateChildAtOffset => NULL",
+                         value_sp.get());
     }
     return sb_value;
 }
@@ -715,6 +719,14 @@
 lldb::SBValue
 SBValue::CreateValueFromExpression (const char *name, const char* expression)
 {
+    SBExpressionOptions options;
+    options.SetKeepInMemory(true);
+    return CreateValueFromExpression (name, expression, options);
+}
+
+lldb::SBValue
+SBValue::CreateValueFromExpression (const char *name, const char *expression, SBExpressionOptions &options)
+{
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     lldb::SBValue sb_value;
     lldb::ValueObjectSP value_sp(GetSP());
@@ -734,12 +746,11 @@
             Target* target = exe_ctx.GetTargetPtr();
             if (target)
             {
-                Target::EvaluateExpressionOptions options;
                 options.SetKeepInMemory(true);
                 target->EvaluateExpression (expression,
                                             exe_ctx.GetFramePtr(),
                                             new_value_sp,
-                                            options);
+                                            options.ref());
                 if (new_value_sp)
                 {
                     new_value_sp->SetName(ConstString(name));
@@ -1617,7 +1628,9 @@
     }
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
     if (log)
-        log->Printf ("SBValue(%p)::GetAddress () => (%s,%llu)", value_sp.get(), (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"), addr.GetOffset());
+        log->Printf ("SBValue(%p)::GetAddress () => (%s,%llu)", value_sp.get(),
+                     (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"),
+                     addr.GetOffset());
     return SBAddress(new Address(addr));
 }