<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
This commit is contained in:
Enrico Granata
2014-02-18 23:48:11 +00:00
parent 9873a5ba4f
commit 08a04327a9
6 changed files with 111 additions and 13 deletions

View File

@@ -852,7 +852,7 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
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 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
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;
}
}
}