forked from OSchip/llvm-project
Fixed an issue where StackFrame::GetValueForVariableExpressionPath(...)
was previously using the entire frame variable list instead of using the in scope variable list. I added a new function to a stack frame: lldb::VariableListSP StackFrame::GetInScopeVariableList (bool get_file_globals); This gets only variables that are in scope and they will be ordered such that the variables from the current scope are first. llvm-svn: 136745
This commit is contained in:
parent
2f7af6a15a
commit
d41f032a45
|
@ -101,6 +101,9 @@ public:
|
|||
VariableList *
|
||||
GetVariableList (bool get_file_globals);
|
||||
|
||||
lldb::VariableListSP
|
||||
GetInScopeVariableList (bool get_file_globals);
|
||||
|
||||
// See ExpressionPathOption enumeration for "options" values
|
||||
lldb::ValueObjectSP
|
||||
GetValueForVariableExpressionPath (const char *var_expr,
|
||||
|
|
|
@ -485,6 +485,34 @@ StackFrame::GetVariableList (bool get_file_globals)
|
|||
return m_variable_list_sp.get();
|
||||
}
|
||||
|
||||
VariableListSP
|
||||
StackFrame::GetInScopeVariableList (bool get_file_globals)
|
||||
{
|
||||
VariableListSP var_list_sp(new VariableList);
|
||||
GetSymbolContext (eSymbolContextCompUnit | eSymbolContextBlock);
|
||||
|
||||
if (m_sc.block)
|
||||
{
|
||||
const bool can_create = true;
|
||||
const bool get_parent_variables = true;
|
||||
const bool stop_if_block_is_inlined_function = true;
|
||||
m_sc.block->AppendVariables (can_create,
|
||||
get_parent_variables,
|
||||
stop_if_block_is_inlined_function,
|
||||
var_list_sp.get());
|
||||
}
|
||||
|
||||
if (m_sc.comp_unit)
|
||||
{
|
||||
VariableListSP global_variable_list_sp (m_sc.comp_unit->GetVariableList(true));
|
||||
if (global_variable_list_sp)
|
||||
var_list_sp->AddVariables (global_variable_list_sp.get());
|
||||
}
|
||||
|
||||
return var_list_sp;
|
||||
}
|
||||
|
||||
|
||||
ValueObjectSP
|
||||
StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
|
@ -502,7 +530,10 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
|||
bool address_of = false;
|
||||
ValueObjectSP valobj_sp;
|
||||
const bool get_file_globals = true;
|
||||
VariableList *variable_list = GetVariableList (get_file_globals);
|
||||
// When looking up a variable for an expression, we need only consider the
|
||||
// variables that are in scope.
|
||||
VariableListSP var_list_sp (GetInScopeVariableList (get_file_globals));
|
||||
VariableList *variable_list = var_list_sp.get();
|
||||
|
||||
if (variable_list)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue