diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2010-11-19 18:07:14 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2010-11-19 18:07:14 +0000 |
| commit | beae523a204e69f658c6939ae0fc5d109e9f636e (patch) | |
| tree | 61021f182bc930dcebf0ee0c02ef579d76d1cea1 /lldb/source/API/SBFrame.cpp | |
| parent | d7a3550a5e72571d36a0661208d0e209471a127f (diff) | |
Fill in more test sequences for Python API SBFrame.LookupVarInScope(name, scope).
Change SBFrame::LookupVarInScope() to also work with "global" scope in addition
to "local" and "parameter" scope.
llvm-svn: 119811
Diffstat (limited to 'lldb/source/API/SBFrame.cpp')
| -rw-r--r-- | lldb/source/API/SBFrame.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index 238464ebaf34..58faed6eea66 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -350,26 +350,25 @@ SBFrame::LookupVarInScope (const char *var_name, const char *scope) if (var_scope != eValueTypeInvalid) { - lldb_private::VariableList variable_list; - SBSymbolContext sc = GetSymbolContext (eSymbolContextEverything); - - SBBlock block = sc.GetBlock(); - if (block.IsValid()) - block.AppendVariables (true, true, &variable_list); - - const uint32_t num_variables = variable_list.GetSize(); - - bool found = false; - for (uint32_t i = 0; i < num_variables && !found; ++i) + lldb_private::VariableList *variable_list = m_opaque_sp->GetVariableList(true); + if (variable_list) { - var_sp = variable_list.GetVariableAtIndex(i); - if (var_sp - && (var_sp.get()->GetName() == lldb_private::ConstString(var_name)) - && var_sp.get()->GetScope() == var_scope) - found = true; + const uint32_t num_variables = variable_list->GetSize(); + bool found = false; + for (uint32_t i = 0; i < num_variables && !found; ++i) + { + var_sp = variable_list->GetVariableAtIndex(i); + if (var_sp + && (var_sp.get()->GetName() == lldb_private::ConstString(var_name)) + && var_sp.get()->GetScope() == var_scope) + { + found = true; + break; + } + } + if (!found) + var_sp.reset(); } - if (!found) - var_sp.reset(); } } |
