Author: amccarth Date: Wed May 4 18:32:35 2016 New Revision: 268573 URL: http://llvm.org/viewvc/llvm-project?rev=268573&view=rev Log: XFail TestLambdas.py on Windows after fixing some of the problems
1. Fixed semicolon placement in the lambda in the test itself. 2. Fixed lldbinline tests in general so that we don't attempt tests on platforms that don't use the given type of debug info. (For example, no DWO tests on Windows.) This fixes one of the two failures on Windows. (TestLambdas.py was the only inline test that wasn't XFailed or skipped on Windows.) 3. Set the error string in IRInterpreter::CanInterpret so that the caller doesn't print (null) instead of an explanation. I don't entirely understand the error, so feel free to suggest a better wording. 4. XFailed the test on Windows. The interpreter won't evaluate the lambda because the module has multiple function bodies. I don't exactly understand why that's a problem for the interpreter nor why the problem arises only on Windows. Differential Revision: http://reviews.llvm.org/D19606 Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py lldb/trunk/source/Expression/IRInterpreter.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py?rev=268573&r1=268572&r2=268573&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py Wed May 4 18:32:35 2016 @@ -1,4 +1,4 @@ from lldbsuite.test import lldbinline from lldbsuite.test import decorators -lldbinline.MakeInlineTest(__file__, globals(), []) +lldbinline.MakeInlineTest(__file__, globals(), [lldbinline.expectedFailureAll(oslist=["windows"])]) Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp?rev=268573&r1=268572&r2=268573&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/main.cpp Wed May 4 18:32:35 2016 @@ -11,7 +11,7 @@ int main (int argc, char const *argv[]) { - printf("Stop here\n"); //% self.runCmd("expression auto $add = [](int a, int b) { return a + b };") - //% self.expect("expression $add(2,3)", substrs = ['= 5']) - return 0; + printf("Stop here\n"); //% self.runCmd("expression auto $add = [](int a, int b) { return a + b; }") + //% self.expect("expression $add(2,3)", substrs = ['= 5']) + return 0; } Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py?rev=268573&r1=268572&r2=268573&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py Wed May 4 18:32:35 2016 @@ -186,7 +186,7 @@ def ApplyDecoratorsToFunction(func, deco elif hasattr(decorators, '__call__'): tmp = decorators(tmp) return tmp - + def MakeInlineTest(__file, __globals, decorators=None): # Adjust the filename if it ends in .pyc. We want filenames to @@ -200,13 +200,17 @@ def MakeInlineTest(__file, __globals, de InlineTest.mydir = TestBase.compute_mydir(__file) test_name, _ = os.path.splitext(file_basename) - # Build the test case + # Build the test case test = type(test_name, (InlineTest,), {'using_dsym': None}) test.name = test_name - test.test_with_dsym = ApplyDecoratorsToFunction(test._InlineTest__test_with_dsym, decorators) - test.test_with_dwarf = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators) - test.test_with_dwo = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwo, decorators) + target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2] + if test_categories.is_supported_on_platform("dsym", target_platform): + test.test_with_dsym = ApplyDecoratorsToFunction(test._InlineTest__test_with_dsym, decorators) + if test_categories.is_supported_on_platform("dwarf", target_platform): + test.test_with_dwarf = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators) + if test_categories.is_supported_on_platform("dwo", target_platform): + test.test_with_dwo = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwo, decorators) # Add the test case to the globals, and hide InlineTest __globals.update({test_name : test}) Modified: lldb/trunk/source/Expression/IRInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=268573&r1=268572&r2=268573&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRInterpreter.cpp (original) +++ lldb/trunk/source/Expression/IRInterpreter.cpp Wed May 4 18:32:35 2016 @@ -477,6 +477,7 @@ static const char *memory_write_error static const char *memory_read_error = "Interpreter couldn't read from memory"; static const char *infinite_loop_error = "Interpreter ran for too many cycles"; //static const char *bad_result_error = "Result of expression is in bad memory"; +static const char *too_many_functions_error = "Interpreter doesn't handle modules with multiple function bodies."; static bool CanResolveConstant (llvm::Constant *constant) @@ -506,7 +507,7 @@ CanResolveConstant (llvm::Constant *cons Constant *base = dyn_cast<Constant>(*op_cursor); if (!base) return false; - + return CanResolveConstant(base); } } @@ -535,7 +536,13 @@ IRInterpreter::CanInterpret (llvm::Modul if (fi->begin() != fi->end()) { if (saw_function_with_body) + { + if (log) + log->Printf("More than one function in the module has a body"); + error.SetErrorToGenericError(); + error.SetErrorString(too_many_functions_error); return false; + } saw_function_with_body = true; } } @@ -664,7 +671,7 @@ IRInterpreter::CanInterpret (llvm::Modul return false; } } - + if (Constant *constant = llvm::dyn_cast<Constant>(operand)) { if (!CanResolveConstant(constant)) @@ -680,7 +687,8 @@ IRInterpreter::CanInterpret (llvm::Modul } - return true;} + return true; +} bool IRInterpreter::Interpret (llvm::Module &module, _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits