Revert "[LoongArch] Eliminate the redundant sign extension of division (#107971)"
[llvm-project.git] / lldb / test / API / python_api / breakpoint / TestBreakpointAPI.py
blob555d4a6503979e97b86bb30be553fa5dd83defbc
1 """
2 Test SBBreakpoint APIs.
3 """
5 import lldb
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbtest import *
8 from lldbsuite.test import lldbutil
11 class BreakpointAPITestCase(TestBase):
12 NO_DEBUG_INFO_TESTCASE = True
14 def test_breakpoint_is_valid(self):
15 """Make sure that if an SBBreakpoint gets deleted its IsValid returns false."""
16 self.build()
17 exe = self.getBuildArtifact("a.out")
19 # Create a target by the debugger.
20 target = self.dbg.CreateTarget(exe)
21 self.assertTrue(target, VALID_TARGET)
23 # Now create a breakpoint on main.c by name 'AFunction'.
24 breakpoint = target.BreakpointCreateByName("AFunction", "a.out")
25 self.trace("breakpoint:", breakpoint)
26 self.assertTrue(
27 breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT
30 # Now delete it:
31 did_delete = target.BreakpointDelete(breakpoint.GetID())
32 self.assertTrue(did_delete, "Did delete the breakpoint we just created.")
34 # Make sure we can't find it:
35 del_bkpt = target.FindBreakpointByID(breakpoint.GetID())
36 self.assertTrue(not del_bkpt, "We did delete the breakpoint.")
38 # Finally make sure the original breakpoint is no longer valid.
39 self.assertTrue(not breakpoint, "Breakpoint we deleted is no longer valid.")
41 def test_target_delete(self):
42 """Make sure that if an SBTarget gets deleted the associated
43 Breakpoint's IsValid returns false."""
45 self.build()
46 exe = self.getBuildArtifact("a.out")
48 # Create a target by the debugger.
49 target = self.dbg.CreateTarget(exe)
50 self.assertTrue(target, VALID_TARGET)
52 # Now create a breakpoint on main.c by name 'AFunction'.
53 breakpoint = target.BreakpointCreateByName("AFunction", "a.out")
54 self.trace("breakpoint:", breakpoint)
55 self.assertTrue(
56 breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT
58 location = breakpoint.GetLocationAtIndex(0)
59 self.assertTrue(location.IsValid())
61 # Test negative index access.
62 self.assertTrue(breakpoint.location[-1].IsValid())
64 # Make sure the breakpoint's target is right:
65 self.assertEqual(
66 target, breakpoint.GetTarget(), "Breakpoint reports its target correctly"
69 self.assertTrue(self.dbg.DeleteTarget(target))
70 self.assertFalse(breakpoint.IsValid())
71 self.assertFalse(location.IsValid())