summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorChaoren Lin <chaorenl@google.com>2015-03-19 22:00:13 +0000
committerChaoren Lin <chaorenl@google.com>2015-03-19 22:00:13 +0000
commit0efb51a072b06d5cfb97af6594c3a1fd0e80cc93 (patch)
tree878d31ce1b80af68d6d2c8d873469756dd8df887 /lldb/source
parenta7f8c46439ea05c6e64ba9c6f25d3261521a05d4 (diff)
downloadbcm5719-llvm-0efb51a072b06d5cfb97af6594c3a1fd0e80cc93.tar.gz
bcm5719-llvm-0efb51a072b06d5cfb97af6594c3a1fd0e80cc93.zip
Fix SBFrame::FindValue for when only global variables exist.
Summary: sc.block->AppendVariables(...) returns 0 if there are no arguments or local variables, but we still need to check for global variables. Test Plan: ``` $ cat test.cpp int i; int main() { } $ lldb test -o 'b main' -o r (lldb) script >>> print lldb.frame.FindValue('i', lldb.eValueTypeVariableGlobal) (int) i = 0 # as opposed to "No value" ``` Reviewers: jingham, ovyalov, vharron, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8464 llvm-svn: 232767
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBFrame.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 37455fdf989..bc96ad1959c 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -870,32 +870,30 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
case eValueTypeVariableArgument: // function argument variables
case eValueTypeVariableLocal: // function local variables
{
- SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock));
+ SymbolContext sc(frame->GetSymbolContext(eSymbolContextBlock));
const bool can_create = true;
const bool get_parent_variables = true;
const bool stop_if_block_is_inlined_function = true;
- if (sc.block && sc.block->AppendVariables (can_create,
- get_parent_variables,
- stop_if_block_is_inlined_function,
- &variable_list))
+ if (sc.block)
+ sc.block->AppendVariables(can_create,
+ get_parent_variables,
+ stop_if_block_is_inlined_function,
+ &variable_list);
+ if (value_type == eValueTypeVariableGlobal)
{
- if (value_type == eValueTypeVariableGlobal)
- {
- const bool get_file_globals = true;
- VariableList* frame_vars = frame->GetVariableList(get_file_globals);
- if (frame_vars)
- frame_vars->AppendVariablesIfUnique(variable_list);
- }
- ConstString const_name(name);
- VariableSP variable_sp(variable_list.FindVariable(const_name,value_type));
- if (variable_sp)
- {
- value_sp = frame->GetValueObjectForFrameVariable (variable_sp, eNoDynamicValues);
- sb_value.SetSP (value_sp, use_dynamic);
- break;
- }
+ const bool get_file_globals = true;
+ VariableList *frame_vars = frame->GetVariableList(get_file_globals);
+ if (frame_vars)
+ frame_vars->AppendVariablesIfUnique(variable_list);
+ }
+ ConstString const_name(name);
+ VariableSP variable_sp(variable_list.FindVariable(const_name, value_type));
+ if (variable_sp)
+ {
+ value_sp = frame->GetValueObjectForFrameVariable(variable_sp, eNoDynamicValues);
+ sb_value.SetSP(value_sp, use_dynamic);
}
}
break;
OpenPOWER on IntegriCloud