[Lldb-commits] [lldb] r137004 - in /lldb/trunk: source/Expression/ClangExpressionDeclMap.cpp test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Sean Callanan
scallanan at apple.com
Fri Aug 5 17:28:14 PDT 2011
Author: spyffe
Date: Fri Aug 5 19:28:14 2011
New Revision: 137004
URL: http://llvm.org/viewvc/llvm-project?rev=137004&view=rev
Log:
Made the expression parser use the StackFrame's
variable search API rather than rolling its own,
fixing one of our testcases.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=137004&r1=137003&r2=137004&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Aug 5 19:28:14 2011
@@ -1572,40 +1572,18 @@
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
- VariableList *var_list = frame.GetVariableList(true);
-
- if (!var_list)
- return lldb::VariableSP();
+ ValueObjectSP valobj;
+ VariableSP var_sp;
+ Error err;
- lldb::VariableSP var_sp (var_list->FindVariable(name));
+ valobj = frame.GetValueForVariableExpressionPath(name.GetCString(),
+ eNoDynamicValues,
+ StackFrame::eExpressionPathOptionCheckPtrVsMember,
+ var_sp,
+ err);
- const bool append = true;
- const uint32_t max_matches = 1;
- if (!var_sp)
- {
- // Look for globals elsewhere in the module for the frame
- ModuleSP module_sp (frame.GetSymbolContext(eSymbolContextModule).module_sp);
- if (module_sp)
- {
- VariableList module_globals;
- if (module_sp->FindGlobalVariables (name, append, max_matches, module_globals))
- var_sp = module_globals.GetVariableAtIndex (0);
- }
- }
-
- if (!var_sp)
- {
- // Look for globals elsewhere in the program (all images)
- TargetSP target_sp (frame.GetSymbolContext(eSymbolContextTarget).target_sp);
- if (target_sp)
- {
- VariableList program_globals;
- if (target_sp->GetImages().FindGlobalVariables (name, append, max_matches, program_globals))
- var_sp = program_globals.GetVariableAtIndex (0);
- }
- }
-
- if (!var_sp ||
+ if (!err.Success() ||
+ !var_sp ||
!var_sp->IsInScope(&frame) ||
!var_sp->LocationIsValidForFrame (&frame))
return lldb::VariableSP();
@@ -1745,10 +1723,18 @@
// doesn't start with our phony prefix of '$'
if (name_unique_cstr[0] != '$')
{
- VariableSP var = FindVariableInScope(*m_parser_vars->m_exe_ctx->frame, name);
+ ValueObjectSP valobj;
+ VariableSP var;
+ Error err;
+
+ valobj = m_parser_vars->m_exe_ctx->frame->GetValueForVariableExpressionPath(name_unique_cstr,
+ eNoDynamicValues,
+ StackFrame::eExpressionPathOptionCheckPtrVsMember,
+ var,
+ err);
// If we found a variable in scope, no need to pull up function names
- if (var != NULL)
+ if (err.Success() && var != NULL)
{
AddOneVariable(context, var);
}
Modified: lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py?rev=137004&r1=137003&r2=137004&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py (original)
+++ lldb/trunk/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py Fri Aug 5 19:28:14 2011
@@ -15,7 +15,6 @@
self.line_to_break = line_number(self.source, '// Set breakpoint here.')
# rdar://problem/9890530
- @unittest2.expectedFailure
def test_eval_index_variable(self):
"""Test expressions of variable 'i' which appears in two for loops."""
self.buildDefault()
More information about the lldb-commits
mailing list