Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / objc / direct-dispatch-step / TestObjCDirectDispatchStepping.py
blobff485bab93b5ad6880a6e080916967219772fc54
1 """Test stepping through ObjC method dispatch in various forms."""
3 import lldb
4 from lldbsuite.test.decorators import *
5 from lldbsuite.test.lldbtest import *
6 from lldbsuite.test import lldbutil
9 class TestObjCDirectDispatchStepping(TestBase):
10 NO_DEBUG_INFO_TESTCASE = True
12 def setUp(self):
13 # Call super's setUp().
14 TestBase.setUp(self)
15 # Find the line numbers that we will step to in main:
16 self.main_source = lldb.SBFileSpec("stepping-tests.m")
18 @add_test_categories(["pyapi", "basic_process"])
19 def test_with_python_api(self):
20 """Test stepping through the 'direct dispatch' optimized method calls."""
21 self.build()
23 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
24 self, "Stop here to start stepping", self.main_source
26 stop_bkpt = target.BreakpointCreateBySourceRegex(
27 "// Stop Location [0-9]+", self.main_source
29 self.assertEqual(stop_bkpt.GetNumLocations(), 15)
31 # Here we step through all the overridden methods of OverridesALot
32 # The last continue will get us to the call ot OverridesInit.
33 for idx in range(2, 16):
34 thread.StepInto()
35 func_name = thread.GetFrameAtIndex(0).GetFunctionName()
36 self.assertIn(
37 "OverridesALot",
38 func_name,
39 "%d'th step did not match name: %s" % (idx, func_name),
41 stop_threads = lldbutil.continue_to_breakpoint(process, stop_bkpt)
42 self.assertEqual(len(stop_threads), 1)
43 self.assertEqual(stop_threads[0], thread)
45 thread.StepInto()
46 func_name = thread.GetFrameAtIndex(0).GetFunctionName()
47 self.assertEqual(
48 func_name, "-[OverridesInit init]", "Stopped in [OverridesInit init]"