[Lldb-commits] [lldb] r166070 - in /lldb/trunk: include/lldb/API/SBExpressionOptions.h scripts/Python/interface/SBExpressionOptions.i source/API/SBExpressionOptions.cpp source/API/SBFrame.cpp source/API/SBValue.cpp test/expression_command/timeout/TestCallWithTimeout.py

Greg Clayton gclayton at apple.com
Tue Oct 16 15:58:25 PDT 2012


Author: gclayton
Date: Tue Oct 16 17:58:25 2012
New Revision: 166070

URL: http://llvm.org/viewvc/llvm-project?rev=166070&view=rev
Log:
API cleanup.


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

Modified: lldb/trunk/include/lldb/API/SBExpressionOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBExpressionOptions.h?rev=166070&r1=166069&r2=166070&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBExpressionOptions.h (original)
+++ lldb/trunk/include/lldb/API/SBExpressionOptions.h Tue Oct 16 17:58:25 2012
@@ -28,53 +28,40 @@
 
     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:
 

Modified: lldb/trunk/scripts/Python/interface/SBExpressionOptions.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBExpressionOptions.i?rev=166070&r1=166069&r2=166070&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBExpressionOptions.i (original)
+++ lldb/trunk/scripts/Python/interface/SBExpressionOptions.i Tue Oct 16 17:58:25 2012
@@ -23,69 +23,46 @@
 
     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);

Modified: lldb/trunk/source/API/SBExpressionOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBExpressionOptions.cpp?rev=166070&r1=166069&r2=166070&view=diff
==============================================================================
--- lldb/trunk/source/API/SBExpressionOptions.cpp (original)
+++ lldb/trunk/source/API/SBExpressionOptions.cpp Tue Oct 16 17:58:25 2012
@@ -16,25 +16,9 @@
 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 @@
 }
 
 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 @@
     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);
 }

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=166070&r1=166069&r2=166070&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Tue Oct 16 17:58:25 2012
@@ -1043,7 +1043,7 @@
     {
         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 @@
 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 @@
 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 @@
             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,

Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=166070&r1=166069&r2=166070&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Tue Oct 16 17:58:25 2012
@@ -720,7 +720,7 @@
 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 @@
             Target* target = exe_ctx.GetTargetPtr();
             if (target)
             {
-                options.SetKeepInMemory(true);
+                options.ref().SetKeepInMemory(true);
                 target->EvaluateExpression (expression,
                                             exe_ctx.GetFramePtr(),
                                             new_value_sp,

Modified: lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py?rev=166070&r1=166069&r2=166070&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py (original)
+++ lldb/trunk/test/expression_command/timeout/TestCallWithTimeout.py Tue Oct 16 17:58:25 2012
@@ -57,7 +57,7 @@
         
         # 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 @@
 
         # 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)





More information about the lldb-commits mailing list