brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 8bbac51 Raw
32 lines · python
1"""2Test setting a breakpoint on an overloaded function by name.3"""4 5import re6import lldb7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10 11 12class TestBreakpointOnOverload(TestBase):13    def check_breakpoint(self, name):14        bkpt = self.target.BreakpointCreateByName(name)15        self.assertEqual(bkpt.num_locations, 1, "Got one location")16        addr = bkpt.locations[0].GetAddress()17        self.assertTrue(addr.function.IsValid(), "Got a real function")18        # On Window, the name of the function includes the return value.19        # We still succeed in setting the breakpoint, but the resultant20        # name is not the same.21        # So just look for the name we used for the breakpoint in the22        # function name, rather than doing an equality check.23        self.assertIn(name, addr.function.name, "Got the right name")24 25    def test_break_on_overload(self):26        self.build()27        self.target = lldbutil.run_to_breakpoint_make_target(self)28        self.check_breakpoint("a_function(int)")29        self.check_breakpoint("a_function(double)")30        self.check_breakpoint("a_function(int, double)")31        self.check_breakpoint("a_function(double, int)")32