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
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 43ca4b3..8a7356d 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -540,7 +540,11 @@
const bool can_create = true;
const bool stop_if_child_block_is_inlined_function = true;
m_variable_list_sp.reset(new VariableList());
- frame_block->AppendBlockVariables(can_create, get_child_variables, stop_if_child_block_is_inlined_function, m_variable_list_sp.get());
+ frame_block->AppendBlockVariables(can_create,
+ get_child_variables,
+ stop_if_child_block_is_inlined_function,
+ [this](Variable* v) { return v->IsInScope(this); },
+ m_variable_list_sp.get());
}
}
@@ -584,6 +588,7 @@
m_sc.block->AppendVariables (can_create,
get_parent_variables,
stop_if_block_is_inlined_function,
+ [this](Variable* v) { return v->IsInScope(this); },
var_list_sp.get());
}