Add the ability to suppress the creation of a persistent
authorJim Ingham <jingham@apple.com>
Sat, 19 Jul 2014 01:09:16 +0000 (01:09 +0000)
committerJim Ingham <jingham@apple.com>
Sat, 19 Jul 2014 01:09:16 +0000 (01:09 +0000)
result variable and use in in "Process::LoadImage" so that,
for instance, "process load" doesn't increment the return
variable number.

llvm-svn: 213440

lldb/include/lldb/Target/Target.h
lldb/source/Expression/ClangUserExpression.cpp
lldb/source/Target/Process.cpp

index 6e433ce..64f3edf 100644 (file)
@@ -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;
index 62f2869..5c1b467 100644 (file)
@@ -1070,6 +1070,11 @@ ClangUserExpression::Evaluate (ExecutionContext &exe_ctx,
                                                              user_expression_sp,
                                                              expr_result);
 
+            if (options.GetResultIsInternal())
+            {
+                process->GetTarget().GetPersistentVariables().RemovePersistentVariable (expr_result);
+            }
+
             if (execution_results != lldb::eExpressionCompleted)
             {
                 if (log)
index 5446ae6..7e09e7e 100644 (file)
@@ -1524,6 +1524,8 @@ Process::LoadImage (const FileSpec &image_spec, Error &error)
                 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;