1""" 2Test completion in our IOHandlers. 3""" 4 5import os 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test.lldbpexpect import PExpectTest 11 12 13class BreakpointCallbackCommandSource(PExpectTest): 14 file_to_source = os.path.join( 15 os.path.abspath(os.path.dirname(__file__)), "source.lldb" 16 ) 17 18 # PExpect uses many timeouts internally and doesn't play well 19 # under ASAN on a loaded machine.. 20 @skipIfAsan 21 @skipIfEditlineSupportMissing 22 @skipIf(oslist=["linux"], archs=["arm", "aarch64"]) 23 @skipIf(oslist=["freebsd"], bugnumber="llvm.org/pr48316") 24 def test_breakpoint_callback_command_source(self): 25 self.build() 26 exe = self.getBuildArtifact("a.out") 27 28 self.launch(exe) 29 self.expect("b main", substrs=["Breakpoint 1"]) 30 self.child.send("breakpoint command add -s python\n") 31 self.child.send( 32 "frame.GetThread().GetProcess().GetTarget().GetDebugger().HandleCommand('command source -s true {}')\n".format( 33 self.file_to_source 34 ) 35 ) 36 self.child.send("DONE\n") 37 self.expect_prompt() 38 self.expect("run", substrs=["Process", "stopped"]) 39 self.expect("script print(foo)", substrs=["95126"]) 40