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.

llvm-svn: 267500
This commit is contained in:
Jim Ingham 2016-04-26 00:29:59 +00:00
parent 1a07501379
commit cef461772e
3 changed files with 7 additions and 4 deletions

View File

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

View File

@ -278,7 +278,7 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi
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);
}
}

View File

@ -571,7 +571,7 @@ StackFrame::GetVariableList (bool get_file_globals)
}
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 get_file_globals)
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());
}