2 Test to ensure SBFrame::Disassemble produces SOME output
7 import lldbsuite
.test
.lldbutil
as lldbutil
8 from lldbsuite
.test
.lldbtest
import *
11 class FrameDisassembleTestCase(TestBase
):
12 NO_DEBUG_INFO_TESTCASE
= True
14 def test_frame_disassemble(self
):
15 """Sample test to ensure SBFrame::Disassemble produces SOME output."""
17 self
.frame_disassemble_test()
19 def frame_disassemble_test(self
):
20 """Sample test to ensure SBFrame::Disassemble produces SOME output"""
21 # Create a target by the debugger.
22 target
= self
.createTestTarget()
24 # Now create a breakpoint in main.c at the source matching
25 # "Set a breakpoint here"
26 breakpoint
= target
.BreakpointCreateBySourceRegex(
27 "Set a breakpoint here", lldb
.SBFileSpec("main.cpp")
30 breakpoint
and breakpoint
.GetNumLocations() >= 1, VALID_BREAKPOINT
33 error
= lldb
.SBError()
34 # This is the launch info. If you want to launch with arguments or
35 # environment variables, add them using SetArguments or
36 # SetEnvironmentEntries
38 launch_info
= target
.GetLaunchInfo()
39 process
= target
.Launch(launch_info
, error
)
40 self
.assertTrue(process
, PROCESS_IS_VALID
)
42 # Did we hit our breakpoint?
43 from lldbsuite
.test
.lldbutil
import get_threads_stopped_at_breakpoint
45 threads
= get_threads_stopped_at_breakpoint(process
, breakpoint
)
47 len(threads
), 1, "There should be a thread stopped at our breakpoint"
50 # The hit count for the breakpoint should be 1.
51 self
.assertEquals(breakpoint
.GetHitCount(), 1)
53 frame
= threads
[0].GetFrameAtIndex(0)
54 disassembly
= frame
.Disassemble()
55 self
.assertNotEqual(disassembly
, "")
56 self
.assertNotIn("error", disassembly
)
57 self
.assertIn(": nop", disassembly
)