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
This commit is contained in:
Chaoren Lin 2015-03-19 22:00:13 +00:00
parent a7f8c46439
commit 0efb51a072
1 changed files with 18 additions and 20 deletions

View File

@ -876,11 +876,11 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
const bool get_parent_variables = true;
const bool stop_if_block_is_inlined_function = true;
if (sc.block && sc.block->AppendVariables (can_create,
if (sc.block)
sc.block->AppendVariables(can_create,
get_parent_variables,
stop_if_block_is_inlined_function,
&variable_list))
{
&variable_list);
if (value_type == eValueTypeVariableGlobal)
{
const bool get_file_globals = true;
@ -894,8 +894,6 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
{
value_sp = frame->GetValueObjectForFrameVariable(variable_sp, eNoDynamicValues);
sb_value.SetSP(value_sp, use_dynamic);
break;
}
}
}
break;