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".

llvm-svn: 272348
This commit is contained in:
Greg Clayton 2016-06-09 23:56:12 +00:00
parent 3a1398b5f0
commit 4e26dd34a0
1 changed files with 6 additions and 5 deletions

View File

@ -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;