<rdar://problem/15960553>
Fix a bug where calling SBFrame::FindValue() would cause a copy of all variables in the block to be inserted in the frame's variable list, regardless of whether those same variables were there or not - which means one could end up with a frame with lots of duplicate copies of the same variables
llvm-svn: 201614
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index cff4602..7d0a03f 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -852,7 +852,7 @@
case eValueTypeVariableArgument: // function argument variables
case eValueTypeVariableLocal: // function local variables
{
- VariableList *variable_list = frame->GetVariableList(true);
+ VariableList variable_list;
SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock));
@@ -863,21 +863,15 @@
if (sc.block && sc.block->AppendVariables (can_create,
get_parent_variables,
stop_if_block_is_inlined_function,
- variable_list))
+ &variable_list))
{
ConstString const_name(name);
- const uint32_t num_variables = variable_list->GetSize();
- for (uint32_t i = 0; i < num_variables; ++i)
+ VariableSP variable_sp(variable_list.FindVariable(const_name,value_type));
+ if (variable_sp)
{
- VariableSP variable_sp (variable_list->GetVariableAtIndex(i));
- if (variable_sp &&
- variable_sp->GetScope() == value_type &&
- variable_sp->GetName() == const_name)
- {
- value_sp = frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues);
- sb_value.SetSP (value_sp, use_dynamic);
- break;
- }
+ value_sp = frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues);
+ sb_value.SetSP (value_sp, use_dynamic);
+ break;
}
}
}