1 """Test stepping through ObjC method dispatch in various forms."""
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
13 # Call super's setUp().
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."""
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):
35 func_name
= thread
.GetFrameAtIndex(0).GetFunctionName()
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
)
46 func_name
= thread
.GetFrameAtIndex(0).GetFunctionName()
48 func_name
, "-[OverridesInit init]", "Stopped in [OverridesInit init]"