Skip to content

Commit e8e6afe

Browse files
committed
change the test
1 parent f2e9890 commit e8e6afe

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/TestSimpleHWBreakpoints.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,29 @@ def does_not_support_hw_breakpoints(self):
1717
def test(self):
1818
"""Test SBBreakpoint::SetIsHardware"""
1919
self.build()
20-
exe = self.getBuildArtifact("a.out")
21-
target = self.dbg.CreateTarget(exe)
22-
2320
self.runCmd("log enable lldb break")
24-
self.addTearDownHook(lambda: self.runCmd("log disable lldb break"))
2521

26-
breakpoint = target.BreakpointCreateByLocation("main.c", 1)
27-
self.assertFalse(breakpoint.IsHardware())
28-
error = breakpoint.SetIsHardware(True)
29-
self.assertSuccess(error)
30-
self.assertTrue(breakpoint.IsHardware())
22+
target, process, _, main_bp = lldbutil.run_to_source_breakpoint(
23+
self, "main", lldb.SBFileSpec("main.c")
24+
)
25+
26+
break_on_me_bp = target.BreakpointCreateByLocation("main.c", 1)
27+
28+
self.assertFalse(main_bp.IsHardware())
29+
self.assertFalse(break_on_me_bp.IsHardware())
3130

32-
self.runCmd("run", RUN_SUCCEEDED)
31+
error = break_on_me_bp.SetIsHardware(True)
32+
if super().supports_hw_breakpoints():
33+
self.assertSuccess(error)
34+
self.assertTrue(break_on_me_bp.IsHardware())
35+
else:
36+
self.assertFailure(error)
37+
self.assertFalse(break_on_me_bp.IsHardware())
38+
39+
process.Continue()
3340

3441
self.expect(
3542
"thread list",
3643
STOPPED_DUE_TO_BREAKPOINT,
3744
substrs=["stopped", "stop reason = breakpoint"],
3845
)
39-
40-
# Check the breakpoint list.
41-
self.expect(
42-
"breakpoint list -v",
43-
substrs=["file = 'main.c'", "hardware = true"],
44-
)

0 commit comments

Comments
 (0)