aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/StackFrame.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-08-02 23:35:43 +0000
committerGreg Clayton <gclayton@apple.com>2011-08-02 23:35:43 +0000
commitd41f032a450b71c33dce5f37f08ee92e2a1b8e4f (patch)
tree740168bebd5342dedd0a43f07bab15cbc3953f4f /lldb/source/Target/StackFrame.cpp
parent2f7af6a15a95f545c0823a06c3fd4a92d00d78ad (diff)
downloadllvm-d41f032a450b71c33dce5f37f08ee92e2a1b8e4f.zip
llvm-d41f032a450b71c33dce5f37f08ee92e2a1b8e4f.tar.gz
llvm-d41f032a450b71c33dce5f37f08ee92e2a1b8e4f.tar.bz2
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
Diffstat (limited to 'lldb/source/Target/StackFrame.cpp')
-rw-r--r--lldb/source/Target/StackFrame.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 48055d0..803e49b 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -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)
{