Author: gclayton
Date: Thu Jun  9 18:56:12 2016
New Revision: 272348

URL: http://llvm.org/viewvc/llvm-project?rev=272348&view=rev
Log:
Fix "frame variable" to show all variables defined in functions and any 
contained lexical blocks, even if they are static variables. 

For code like:

int g_global = 234;
int g_static = 345;
int main(int argc, char **argv)
{                     
    int a = 22333;
    static int g_int = 123;
    return g_global + g_static + g_int + a;
}


If we stop at the "return" statement, we expect to see "argc", "argv", "a" and 
"g_int" when we type "frame variable" since "g_int" is a locally defined static 
variable, but we don't expect to see "g_global" or "g_static" unless we add the 
-g option to "frame variable".


Modified:
    lldb/trunk/source/Commands/CommandObjectFrame.cpp

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=272348&r1=272347&r2=272348&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Jun  9 18:56:12 2016
@@ -373,12 +373,10 @@ protected:
 
         Stream &s = result.GetOutputStream();
 
-        bool get_file_globals = true;
-        
         // Be careful about the stack frame, if any summary formatter runs 
code, it might clear the StackFrameList
         // for the thread.  So hold onto a shared pointer to the frame so it 
stays alive.
         
-        VariableList *variable_list = frame->GetVariableList 
(get_file_globals);
+        VariableList *variable_list = frame->GetVariableList 
(m_option_variable.show_globals);
 
         VariableSP var_sp;
         ValueObjectSP valobj_sp;
@@ -515,13 +513,16 @@ protected:
                         switch (var_sp->GetScope())
                         {
                             case eValueTypeVariableGlobal:
-                                dump_variable = m_option_variable.show_globals;
+                                // Always dump globals since we only fetched 
them if
+                                // m_option_variable.show_scope was true
                                 if (dump_variable && 
m_option_variable.show_scope)
                                     scope_string = "GLOBAL: ";
                                 break;
 
                             case eValueTypeVariableStatic:
-                                dump_variable = m_option_variable.show_globals;
+                                // Always dump globals since we only fetched 
them if
+                                // m_option_variable.show_scope was true, or 
this is
+                                // a static variable from a block in the 
current scope
                                 if (dump_variable && 
m_option_variable.show_scope)
                                     scope_string = "STATIC: ";
                                 break;


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to