2 Test require hardware breakpoints.
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 class BreakpointLocationsTestCase(TestBase):
13 NO_DEBUG_INFO_TESTCASE = True
14 mydir = TestBase.compute_mydir(__file__)
16 def test_breakpoint(self):
17 """Test regular breakpoints when hardware breakpoints are required."""
19 exe = self.getBuildArtifact("a.out")
20 target = self.dbg.CreateTarget(exe)
22 self.runCmd("settings set target.require-hardware-breakpoint true")
24 breakpoint = target.BreakpointCreateByLocation("main.c", 1)
25 self.assertTrue(breakpoint.IsHardware())
28 @expectedFailureAll(archs="aarch64", oslist="linux",
29 bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44055")
30 def test_step_range(self):
31 """Test stepping when hardware breakpoints are required."""
34 _, _, thread, _ = lldbutil.run_to_line_breakpoint(
35 self, lldb.SBFileSpec("main.c"), 1)
37 self.runCmd("settings set target.require-hardware-breakpoint true")
39 # Ensure we fail in the interpreter.
40 self.expect("thread step-in")
41 self.expect("thread step-in", error=True)
43 # Ensure we fail when stepping through the API.
44 error = lldb.SBError()
45 thread.StepInto('', 4, error)
46 self.assertTrue(error.Fail())
47 self.assertTrue("Could not create hardware breakpoint for thread plan"
48 in error.GetCString())
51 @expectedFailureAll(archs="aarch64", oslist="linux",
52 bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44055")
53 def test_step_out(self):
54 """Test stepping out when hardware breakpoints are required."""
57 _, _, thread, _ = lldbutil.run_to_line_breakpoint(
58 self, lldb.SBFileSpec("main.c"), 1)
60 self.runCmd("settings set target.require-hardware-breakpoint true")
62 # Ensure this fails in the command interpreter.
63 self.expect("thread step-out", error=True)
65 # Ensure we fail when stepping through the API.
66 error = lldb.SBError()
68 self.assertTrue(error.Fail())
69 self.assertTrue("Could not create hardware breakpoint for thread plan"
70 in error.GetCString())
73 @expectedFailureAll(archs="aarch64", oslist="linux",
74 bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44055")
75 def test_step_over(self):
76 """Test stepping over when hardware breakpoints are required."""
79 _, _, thread, _ = lldbutil.run_to_line_breakpoint(
80 self, lldb.SBFileSpec("main.c"), 7)
82 self.runCmd("settings set target.require-hardware-breakpoint true")
84 # Step over doesn't fail immediately but fails later on.
89 'error: Could not create hardware breakpoint for thread plan.'
93 @expectedFailureAll(archs="aarch64", oslist="linux",
94 bugnumber="https://bugs.llvm.org/show_bug.cgi?id=44055")
95 def test_step_until(self):
96 """Test stepping until when hardware breakpoints are required."""
99 _, _, thread, _ = lldbutil.run_to_line_breakpoint(
100 self, lldb.SBFileSpec("main.c"), 7)
102 self.runCmd("settings set target.require-hardware-breakpoint true")
104 self.expect("thread until 5", error=True)
106 # Ensure we fail when stepping through the API.
107 error = thread.StepOverUntil(lldb.SBFrame(), lldb.SBFileSpec(), 5)
108 self.assertTrue(error.Fail())
109 self.assertTrue("Could not create hardware breakpoint for thread plan"
110 in error.GetCString())