Handle the case when a variable is only valid in part of the enclosing scope

DWARF stores this information in the DW_AT_start_scope attribute. This
CL add support for this attribute and also changes the functions
displaying frame variables to only display the variables currently in
scope.

Differential revision: http://reviews.llvm.org/D17449

llvm-svn: 261858
This commit is contained in:
Tamas Berghammer
2016-02-25 12:23:37 +00:00
parent 2e4c72977c
commit 72ac8a840f
10 changed files with 130 additions and 32 deletions

View File

@@ -131,7 +131,11 @@ SBBlock::AppendVariables (bool can_create, bool get_parent_variables, lldb_priva
if (IsValid())
{
bool show_inline = true;
m_opaque_ptr->AppendVariables (can_create, get_parent_variables, show_inline, var_list);
m_opaque_ptr->AppendVariables (can_create,
get_parent_variables,
show_inline,
[](Variable*) { return true; },
var_list);
}
}

View File

@@ -789,9 +789,10 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
const bool get_parent_variables = true;
const bool stop_if_block_is_inlined_function = true;
if (sc.block->AppendVariables (can_create,
if (sc.block->AppendVariables (can_create,
get_parent_variables,
stop_if_block_is_inlined_function,
[frame](Variable* v) { return v->IsInScope(frame); },
&variable_list))
{
var_sp = variable_list.FindVariable (ConstString(name));
@@ -887,6 +888,7 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
sc.block->AppendVariables(can_create,
get_parent_variables,
stop_if_block_is_inlined_function,
[frame](Variable* v) { return v->IsInScope(frame); },
&variable_list);
if (value_type == eValueTypeVariableGlobal)
{