diff options
| author | Enrico Granata <egranata@apple.com> | 2014-02-18 23:48:11 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2014-02-18 23:48:11 +0000 |
| commit | 08a04327a94bbfa0d2d804c4ee845ef8a7c6cf54 (patch) | |
| tree | 245831f7bd9e7a11cd0cbec41c32e520125d6c9f /lldb/source/API | |
| parent | 9873a5ba4f17c79b280596c4bbaf707b7d3011fb (diff) | |
| download | bcm5719-llvm-08a04327a94bbfa0d2d804c4ee845ef8a7c6cf54.tar.gz bcm5719-llvm-08a04327a94bbfa0d2d804c4ee845ef8a7c6cf54.zip | |
<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
Diffstat (limited to 'lldb/source/API')
| -rw-r--r-- | lldb/source/API/SBFrame.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
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; } } } |

