[Lldb-commits] [lldb] r149133 - in /lldb/trunk/source/Commands: CommandObjectExpression.cpp CommandObjectExpression.h

Greg Clayton gclayton at apple.com
Fri Jan 27 10:18:23 PST 2012


Author: gclayton
Date: Fri Jan 27 12:18:23 2012
New Revision: 149133

URL: http://llvm.org/viewvc/llvm-project?rev=149133&view=rev
Log:
There is no need to hold onto an ExecutionContext as a member variable. 
ExecutionContext objects have shared pointers to Target, Process, Thread
and Frame objects and they can end up being held onto for too long.


Modified:
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Commands/CommandObjectExpression.h

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=149133&r1=149132&r2=149133&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Jan 27 12:18:23 2012
@@ -282,7 +282,7 @@
     CommandReturnObject *result
 )
 {
-    Target *target = m_exe_ctx.GetTargetPtr();
+    Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
     
     if (!target)
         target = Host::GetDummyTarget(m_interpreter.GetDebugger()).get();
@@ -310,7 +310,7 @@
         }
         
         exe_results = target->EvaluateExpression (expr, 
-                                                  m_exe_ctx.GetFramePtr(),
+                                                  m_interpreter.GetExecutionContext().GetFramePtr(),
                                                   eExecutionPolicyOnlyWhenNeeded,
                                                   m_command_options.print_object,
                                                   m_command_options.unwind_on_error,
@@ -323,7 +323,7 @@
             uint32_t start_frame = 0;
             uint32_t num_frames = 1;
             uint32_t num_frames_with_source = 0;
-            Thread *thread = m_exe_ctx.GetThreadPtr();
+            Thread *thread = m_interpreter.GetExecutionContext().GetThreadPtr();
             if (thread)
             {
                 thread->GetStatus (result->GetOutputStream(), 
@@ -333,7 +333,7 @@
             }
             else 
             {
-                Process *process = m_exe_ctx.GetProcessPtr();
+                Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
                 if (process)
                 {
                     bool only_threads_with_stop_reason = true;
@@ -422,8 +422,6 @@
     CommandReturnObject &result
 )
 {
-    m_exe_ctx = m_interpreter.GetExecutionContext();
-
     m_option_group.NotifyOptionParsingStarting();
 
     const char * expr = NULL;

Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=149133&r1=149132&r2=149133&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Fri Jan 27 12:18:23 2012
@@ -96,7 +96,6 @@
     OptionGroupOptions m_option_group;
     OptionGroupFormat m_format_options;
     CommandOptions m_command_options;
-    ExecutionContext m_exe_ctx;
     uint32_t m_expr_line_count;
     std::string m_expr_lines; // Multi-line expression support
 };





More information about the lldb-commits mailing list