This revision was automatically updated to reflect the committed changes. Closed by commit rG15f34ff2d897: [lldb] Allow expect_expr without a running target (authored by teemperor). Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77197/new/ https://reviews.llvm.org/D77197 Files: lldb/packages/Python/lldbsuite/test/lldbtest.py lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py Index: lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py =================================================================== --- lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py +++ lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py @@ -17,24 +17,10 @@ # Builtins are expanded by Clang, so debug info shouldn't matter. NO_DEBUG_INFO_TESTCASE = True - def setUp(self): - TestBase.setUp(self) - # Find the line number to break for main.c. - self.line = line_number( - 'main.cpp', - '// Please test these expressions while stopped at this line:') - def test(self): self.build() - # Set breakpoint in main and run exe - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - # Test different builtin functions. + target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) self.expect_expr("__builtin_isinf(0.0f)", result_type="int", result_value="0") self.expect_expr("__builtin_isnormal(0.0f)", result_type="int", result_value="0") Index: lldb/packages/Python/lldbsuite/test/lldbtest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -2414,9 +2414,12 @@ # Set the usual default options for normal expressions. options.SetIgnoreBreakpoints(True) - options.SetLanguage(frame.GuessLanguage()) - eval_result = frame.EvaluateExpression(expr, options) + if self.frame().IsValid(): + options.SetLanguage(frame.GuessLanguage()) + eval_result = self.frame().EvaluateExpression(expr, options) + else: + eval_result = self.target().EvaluateExpression(expr, options) if not eval_result.GetError().Success(): self.assertTrue(eval_result.GetError().Success(),
Index: lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py =================================================================== --- lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py +++ lldb/test/API/commands/expression/call-function/TestCallBuiltinFunction.py @@ -17,24 +17,10 @@ # Builtins are expanded by Clang, so debug info shouldn't matter. NO_DEBUG_INFO_TESTCASE = True - def setUp(self): - TestBase.setUp(self) - # Find the line number to break for main.c. - self.line = line_number( - 'main.cpp', - '// Please test these expressions while stopped at this line:') - def test(self): self.build() - # Set breakpoint in main and run exe - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True) - - self.runCmd("run", RUN_SUCCEEDED) - - # Test different builtin functions. + target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) self.expect_expr("__builtin_isinf(0.0f)", result_type="int", result_value="0") self.expect_expr("__builtin_isnormal(0.0f)", result_type="int", result_value="0") Index: lldb/packages/Python/lldbsuite/test/lldbtest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -2414,9 +2414,12 @@ # Set the usual default options for normal expressions. options.SetIgnoreBreakpoints(True) - options.SetLanguage(frame.GuessLanguage()) - eval_result = frame.EvaluateExpression(expr, options) + if self.frame().IsValid(): + options.SetLanguage(frame.GuessLanguage()) + eval_result = self.frame().EvaluateExpression(expr, options) + else: + eval_result = self.target().EvaluateExpression(expr, options) if not eval_result.GetError().Success(): self.assertTrue(eval_result.GetError().Success(),
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits