[Lldb-commits] [lldb] r267500 - When building the list of variables we're going to write "using $_lldb_local_vars"

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 25 17:29:59 PDT 2016


Author: jingham
Date: Mon Apr 25 19:29:59 2016
New Revision: 267500

URL: http://llvm.org/viewvc/llvm-project?rev=267500&view=rev
Log:
When building the list of variables we're going to write "using $_lldb_local_vars" 
statements for, be sure not to include variables that have no locations.  We wouldn't
be able to realize them, and that will cause all expressions to fail.

Modified:
    lldb/trunk/include/lldb/Target/StackFrame.h
    lldb/trunk/source/Expression/ExpressionSourceCode.cpp
    lldb/trunk/source/Target/StackFrame.cpp

Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=267500&r1=267499&r2=267500&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Mon Apr 25 19:29:59 2016
@@ -289,7 +289,7 @@ public:
     ///     A pointer to a list of variables.
     //------------------------------------------------------------------
     lldb::VariableListSP
-    GetInScopeVariableList (bool get_file_globals);
+    GetInScopeVariableList (bool get_file_globals, bool must_have_valid_location = false);
 
     //------------------------------------------------------------------
     /// Create a ValueObject for a variable name / pathname, possibly

Modified: lldb/trunk/source/Expression/ExpressionSourceCode.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ExpressionSourceCode.cpp?rev=267500&r1=267499&r2=267500&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ExpressionSourceCode.cpp (original)
+++ lldb/trunk/source/Expression/ExpressionSourceCode.cpp Mon Apr 25 19:29:59 2016
@@ -278,7 +278,7 @@ bool ExpressionSourceCode::GetText (std:
         ConstString object_name;
         if (Language::LanguageIsCPlusPlus(frame->GetLanguage()))
         {
-            lldb::VariableListSP var_list_sp = frame->GetInScopeVariableList(false);
+            lldb::VariableListSP var_list_sp = frame->GetInScopeVariableList(false, true);
             AddLocalVariableDecls(var_list_sp, lldb_local_var_decls);
         }
     }

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=267500&r1=267499&r2=267500&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Mon Apr 25 19:29:59 2016
@@ -571,7 +571,7 @@ StackFrame::GetVariableList (bool get_fi
 }
 
 VariableListSP
-StackFrame::GetInScopeVariableList (bool get_file_globals)
+StackFrame::GetInScopeVariableList (bool get_file_globals, bool must_have_valid_location)
 {
     Mutex::Locker locker(m_mutex);
     // We can't fetch variable information for a history stack frame.
@@ -589,7 +589,10 @@ StackFrame::GetInScopeVariableList (bool
         m_sc.block->AppendVariables (can_create, 
                                      get_parent_variables,
                                      stop_if_block_is_inlined_function,
-                                     [this](Variable* v) { return v->IsInScope(this); },
+                                     [this, must_have_valid_location](Variable* v)
+                                     {
+                                         return v->IsInScope(this) && (!must_have_valid_location || v->LocationIsValidForFrame(this));
+                                     },
                                      var_list_sp.get());
     }
                      




More information about the lldb-commits mailing list