API cleanup.
authorGreg Clayton <gclayton@apple.com>
Tue, 16 Oct 2012 22:58:25 +0000 (22:58 +0000)
committerGreg Clayton <gclayton@apple.com>
Tue, 16 Oct 2012 22:58:25 +0000 (22:58 +0000)
llvm-svn: 166070

lldb/include/lldb/API/SBExpressionOptions.h
lldb/scripts/Python/interface/SBExpressionOptions.i
lldb/source/API/SBExpressionOptions.cpp
lldb/source/API/SBFrame.cpp
lldb/source/API/SBValue.cpp
lldb/test/expression_command/timeout/TestCallWithTimeout.py

index 509ec05..97e42c0 100644 (file)
@@ -28,53 +28,40 @@ public:
 
     SBExpressionOptions (const lldb::SBExpressionOptions &rhs);
     
-    SBExpressionOptions (bool coerce_to_id,
-                         bool unwind_on_error,
-                         bool keep_in_memory,
-                         bool run_others,
-                         DynamicValueType use_dynamic,
-                         uint32_t timeout_usec);
-
     ~SBExpressionOptions();
 
     const SBExpressionOptions &
     operator = (const lldb::SBExpressionOptions &rhs);
 
     bool
-    DoesCoerceToId () const;
+    GetCoerceResultToId () const;
     
     void
-    SetCoerceToId (bool coerce = true);
+    SetCoerceResultToId (bool coerce = true);
     
     bool
-    DoesUnwindOnError () const;
+    GetUnwindOnError () const;
     
     void
     SetUnwindOnError (bool unwind = false);
     
-    bool
-    DoesKeepInMemory () const;
-    
-    void
-    SetKeepInMemory (bool keep = true);
-
     lldb::DynamicValueType
-    GetUseDynamic () const;
+    GetFetchDynamicValue () const;
     
     void
-    SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
+    SetFetchDynamicValue (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
     
     uint32_t
-    GetTimeoutUsec () const;
+    GetTimeoutInMicroSeconds () const;
     
     void
-    SetTimeoutUsec (uint32_t timeout = 0);
+    SetTimeoutInMicroSeconds (uint32_t timeout = 0);
     
     bool
-    GetRunOthers () const;
+    GetTryAllThreads () const;
     
     void
-    SetRunOthers (bool run_others = true);
+    SetTryAllThreads (bool run_others = true);
 
 protected:
 
index fa58fe3..3190402 100644 (file)
@@ -23,69 +23,46 @@ public:
 
     SBExpressionOptions (const lldb::SBExpressionOptions &rhs);
     
-    SBExpressionOptions (bool coerce_to_id,
-                         bool unwind_on_error,
-                         bool keep_in_memory,
-                         bool run_others,
-                         DynamicValueType use_dynamic,
-                         uint32_t timeout_usec);
-
     ~SBExpressionOptions();
 
     bool
-    DoesCoerceToId () const;
+    GetCoerceResultToId () const;
+    
+    %feature("docstring", "Sets whether to coerce the expression result to ObjC id type after evaluation.") SetCoerceResultToId;
     
-    %feature("docstring",
-    "Sets whether to coerce the expression result to ObjC id type after evaluation."
-    ) SetCoerceToId;
     void
-    SetCoerceToId (bool coerce = true);
+    SetCoerceResultToId (bool coerce = true);
     
     bool
-    DoesUnwindOnError () const;
+    GetUnwindOnError () const;
+    
+    %feature("docstring", "Sets whether to unwind the expression stack on error.") SetUnwindOnError;
     
-    %feature("docstring",
-    "Sets whether to unwind the expression stack on error."
-    ) SetUnwindOnError;
     void
     SetUnwindOnError (bool unwind = false);
     
-    bool
-    DoesKeepInMemory () const;
-    
-    %feature("docstring",
-    "Sets whether to keep the expression result in the target program's memory - forced to true when creating SBValues."
-    ) SetKeepInMemory;
-    void
-    SetKeepInMemory (bool keep = true);
-
     lldb::DynamicValueType
-    GetUseDynamic () const;
+    GetFetchDynamicValue () const;
     
-    %feature("docstring",
-    "Sets whether to cast the expression result to its dynamic type."
-    ) SetUseDynamic;
-    void
-    SetUseDynamic (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
+    %feature("docstring", "Sets whether to cast the expression result to its dynamic type.") SetFetchDynamicValue;
     
+    void
+    SetFetchDynamicValue (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
+
     uint32_t
-    GetTimeoutUsec () const;
+    GetTimeoutInMicroSeconds () const;
     
-    %feature("docstring",
-    "Sets the duration we will wait before cancelling expression evaluation.  0 means wait forever."
-    ) SetTimeoutUsec;
+    %feature("docstring", "Sets the timeout in microseconds to run the expression for. If try all threads is set to true and the expression doesn't complete within the specified timeout, all threads will be resumed for the same timeout to see if the expresson will finish.") SetTimeoutInMicroSeconds;
     void
-    SetTimeoutUsec (uint32_t timeout = 0);
+    SetTimeoutInMicroSeconds (uint32_t timeout = 0);
     
     bool
-    GetRunOthers () const;
+    GetTryAllThreads () const;
     
-    %feature("docstring",
-    "Sets whether to run all threads if the expression does not complete on one thread."
-    ) SetRunOthers;
+    %feature("docstring", "Sets whether to run all threads if the expression does not complete on one thread.") SetTryAllThreads;
     void
-    SetRunOthers (bool run_others = true);
-
+    SetTryAllThreads (bool run_others = true);
+    
 protected:
 
     SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
index 2a4b9f5..9733d25 100644 (file)
@@ -16,25 +16,9 @@ using namespace lldb;
 using namespace lldb_private;
 
 
-SBExpressionOptions::SBExpressionOptions ()
+SBExpressionOptions::SBExpressionOptions () :
+    m_opaque_ap(new EvaluateExpressionOptions())
 {
-    m_opaque_ap.reset(new EvaluateExpressionOptions());
-}
-
-SBExpressionOptions::SBExpressionOptions (bool coerce_to_id,
-                         bool unwind_on_error,
-                         bool keep_in_memory,
-                         bool run_others,
-                         DynamicValueType use_dynamic,
-                         uint32_t timeout_usec)
-{
-    m_opaque_ap.reset(new EvaluateExpressionOptions());
-    m_opaque_ap->SetCoerceToId(coerce_to_id);
-    m_opaque_ap->SetUnwindOnError(unwind_on_error);
-    m_opaque_ap->SetKeepInMemory(keep_in_memory);
-    m_opaque_ap->SetRunOthers(run_others);
-    m_opaque_ap->SetUseDynamic (use_dynamic);
-    m_opaque_ap->SetTimeoutUsec (timeout_usec);
 }
 
 SBExpressionOptions::SBExpressionOptions (const SBExpressionOptions &rhs)
@@ -58,19 +42,19 @@ SBExpressionOptions::~SBExpressionOptions()
 }
 
 bool
-SBExpressionOptions::DoesCoerceToId () const
+SBExpressionOptions::GetCoerceResultToId () const
 {
     return m_opaque_ap->DoesCoerceToId ();
 }
 
 void
-SBExpressionOptions::SetCoerceToId (bool coerce)
+SBExpressionOptions::SetCoerceResultToId (bool coerce)
 {
     m_opaque_ap->SetCoerceToId (coerce);
 }
 
 bool
-SBExpressionOptions::DoesUnwindOnError () const
+SBExpressionOptions::GetUnwindOnError () const
 {
     return m_opaque_ap->DoesUnwindOnError ();
 }
@@ -81,50 +65,38 @@ SBExpressionOptions::SetUnwindOnError (bool unwind)
     m_opaque_ap->SetUnwindOnError (unwind);
 }
 
-bool
-SBExpressionOptions::DoesKeepInMemory () const
-{
-    return m_opaque_ap->DoesKeepInMemory ();
-}
-
-void
-SBExpressionOptions::SetKeepInMemory (bool keep)
-{
-    m_opaque_ap->SetKeepInMemory (keep);
-}
-
 lldb::DynamicValueType
-SBExpressionOptions::GetUseDynamic () const
+SBExpressionOptions::GetFetchDynamicValue () const
 {
     return m_opaque_ap->GetUseDynamic ();
 }
 
 void
-SBExpressionOptions::SetUseDynamic (lldb::DynamicValueType dynamic)
+SBExpressionOptions::SetFetchDynamicValue (lldb::DynamicValueType dynamic)
 {
     m_opaque_ap->SetUseDynamic (dynamic);
 }
 
 uint32_t
-SBExpressionOptions::GetTimeoutUsec () const
+SBExpressionOptions::GetTimeoutInMicroSeconds () const
 {
     return m_opaque_ap->GetTimeoutUsec ();
 }
 
 void
-SBExpressionOptions::SetTimeoutUsec (uint32_t timeout)
+SBExpressionOptions::SetTimeoutInMicroSeconds (uint32_t timeout)
 {
     m_opaque_ap->SetTimeoutUsec (timeout);
 }
 
 bool
-SBExpressionOptions::GetRunOthers () const
+SBExpressionOptions::GetTryAllThreads () const
 {
     return m_opaque_ap->GetRunOthers ();
 }
 
 void
-SBExpressionOptions::SetRunOthers (bool run_others)
+SBExpressionOptions::SetTryAllThreads (bool run_others)
 {
     m_opaque_ap->SetRunOthers (run_others);
 }
index f89c25b..3fdadde 100644 (file)
@@ -1043,7 +1043,7 @@ SBFrame::EvaluateExpression (const char *expr)
     {
         SBExpressionOptions options;
         lldb::DynamicValueType fetch_dynamic_value = frame->CalculateTarget()->GetPreferDynamicValue();
-        options.SetUseDynamic (fetch_dynamic_value);
+        options.SetFetchDynamicValue (fetch_dynamic_value);
         options.SetUnwindOnError (true);
         return EvaluateExpression (expr, options);
     }
@@ -1054,7 +1054,7 @@ SBValue
 SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value)
 {
     SBExpressionOptions options;
-    options.SetUseDynamic (fetch_dynamic_value);
+    options.SetFetchDynamicValue (fetch_dynamic_value);
     options.SetUnwindOnError (true);
     return EvaluateExpression (expr, options);
 }
@@ -1063,7 +1063,7 @@ SBValue
 SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dynamic_value, bool unwind_on_error)
 {
     SBExpressionOptions options;
-    options.SetUseDynamic (fetch_dynamic_value);
+    options.SetFetchDynamicValue (fetch_dynamic_value);
     options.SetUnwindOnError (unwind_on_error);
     return EvaluateExpression (expr, options);
 }
@@ -1096,7 +1096,7 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
             StreamString frame_description;
             frame->DumpUsingSettingsFormat (&frame_description);
             Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
-                                                 expr, options.GetUseDynamic(), frame_description.GetString().c_str());
+                                                 expr, options.GetFetchDynamicValue(), frame_description.GetString().c_str());
 #endif
             exe_results = target->EvaluateExpression (expr, 
                                                       frame,
index 0aa01a6..5b38bc5 100644 (file)
@@ -720,7 +720,7 @@ lldb::SBValue
 SBValue::CreateValueFromExpression (const char *name, const char* expression)
 {
     SBExpressionOptions options;
-    options.SetKeepInMemory(true);
+    options.ref().SetKeepInMemory(true);
     return CreateValueFromExpression (name, expression, options);
 }
 
@@ -746,7 +746,7 @@ SBValue::CreateValueFromExpression (const char *name, const char *expression, SB
             Target* target = exe_ctx.GetTargetPtr();
             if (target)
             {
-                options.SetKeepInMemory(true);
+                options.ref().SetKeepInMemory(true);
                 target->EvaluateExpression (expression,
                                             exe_ctx.GetFramePtr(),
                                             new_value_sp,
index fb9b7d0..6ca21bc 100644 (file)
@@ -57,7 +57,7 @@ class ExprCommandWithTimeoutsTestCase(TestBase):
         
         # First set the timeout too short, and make sure we fail.
         options = lldb.SBExpressionOptions()
-        options.SetTimeoutUsec(100)
+        options.SetTimeoutInMicroSeconds(100)
         options.SetUnwindOnError(True)
 
         frame = thread.GetFrameAtIndex(0)
@@ -75,7 +75,7 @@ class ExprCommandWithTimeoutsTestCase(TestBase):
 
         # Okay, now do it again with long enough time outs:
 
-        options.SetTimeoutUsec(1000000)
+        options.SetTimeoutInMicroSeconds(1000000)
         value = frame.EvaluateExpression ("wait_a_while (1000)", options)
         self.assertTrue(value.IsValid())
         self.assertTrue (value.GetError().Success() == True)