49 lines · python
1"""2Make sure running internal expressions doesn't3influence the result variable numbering.4"""5 6 7import lldb8import lldbsuite.test.lldbutil as lldbutil9from lldbsuite.test.lldbtest import *10 11 12class TestExpressionResultNumbering(TestBase):13 NO_DEBUG_INFO_TESTCASE = True14 15 def test_sample_rename_this(self):16 self.build()17 self.main_source_file = lldb.SBFileSpec("main.c")18 self.do_numbering_test()19 20 def do_numbering_test(self):21 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(22 self, "Set a breakpoint here", self.main_source_file23 )24 25 bkpt = target.BreakpointCreateBySourceRegex(26 "Add conditions to this breakpoint", self.main_source_file27 )28 self.assertEqual(bkpt.GetNumLocations(), 1, "Set the breakpoint")29 30 bkpt.SetCondition("call_me(value) < 6")31 32 # Get the number of the last expression:33 result = thread.frames[0].EvaluateExpression("call_me(200)")34 self.assertSuccess(result.GetError(), "Our expression succeeded")35 name = result.GetName()36 ordinal = int(name[1:])37 38 process.Continue()39 40 # The condition evaluation had to run a 4 expressions, but we haven't41 # run any user expressions.42 result = thread.frames[0].EvaluateExpression("call_me(200)")43 self.assertSuccess(44 result.GetError(), "Our expression succeeded the second time"45 )46 after_name = result.GetName()47 after_ordinal = int(after_name[1:])48 self.assertEqual(ordinal + 1, after_ordinal)49