From 08a04327a94bbfa0d2d804c4ee845ef8a7c6cf54 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Tue, 18 Feb 2014 23:48:11 +0000 Subject: 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 --- lldb/source/API/SBFrame.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'lldb/source/API') diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index cff46020807..7d0a03f7103 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -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; } } } -- cgit v1.2.3