[Lldb-commits] [lldb] r213440 - Add the ability to suppress the creation of a persistent

Jim Ingham jingham at apple.com
Fri Jul 18 18:09:16 PDT 2014


Author: jingham
Date: Fri Jul 18 20:09:16 2014
New Revision: 213440

URL: http://llvm.org/viewvc/llvm-project?rev=213440&view=rev
Log:
Add the ability to suppress the creation of a persistent
result variable and use in in "Process::LoadImage" so that,
for instance, "process load" doesn't increment the return
variable number.

Modified:
    lldb/trunk/include/lldb/Target/Target.h
    lldb/trunk/source/Expression/ClangUserExpression.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=213440&r1=213439&r2=213440&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Fri Jul 18 20:09:16 2014
@@ -208,6 +208,7 @@ public:
         m_debug(false),
         m_trap_exceptions(true),
         m_generate_debug_info(false),
+        m_result_is_internal(false),
         m_use_dynamic(lldb::eNoDynamicValues),
         m_timeout_usec(default_timeout),
         m_one_thread_timeout_usec(0),
@@ -402,6 +403,18 @@ public:
             return m_cancel_callback (phase, m_cancel_callback_baton);
     }
 
+    void
+    SetResultIsInternal (bool b)
+    {
+        m_result_is_internal = b;
+    }
+
+    bool
+    GetResultIsInternal () const
+    {
+        return m_result_is_internal;
+    }
+
 private:
     ExecutionPolicy m_execution_policy;
     lldb::LanguageType m_language;
@@ -414,6 +427,7 @@ private:
     bool m_debug;
     bool m_trap_exceptions;
     bool m_generate_debug_info;
+    bool m_result_is_internal;
     lldb::DynamicValueType m_use_dynamic;
     uint32_t m_timeout_usec;
     uint32_t m_one_thread_timeout_usec;

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=213440&r1=213439&r2=213440&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Fri Jul 18 20:09:16 2014
@@ -1070,6 +1070,11 @@ ClangUserExpression::Evaluate (Execution
                                                              user_expression_sp,
                                                              expr_result);
 
+            if (options.GetResultIsInternal())
+            {
+                process->GetTarget().GetPersistentVariables().RemovePersistentVariable (expr_result);
+            }
+
             if (execution_results != lldb::eExpressionCompleted)
             {
                 if (log)

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=213440&r1=213439&r2=213440&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Jul 18 20:09:16 2014
@@ -1524,6 +1524,8 @@ Process::LoadImage (const FileSpec &imag
                 expr_options.SetUnwindOnError(true);
                 expr_options.SetIgnoreBreakpoints(true);
                 expr_options.SetExecutionPolicy(eExecutionPolicyAlways);
+                expr_options.SetResultIsInternal(true);
+                
                 StreamString expr;
                 expr.Printf(R"(
                                struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result;





More information about the lldb-commits mailing list