1"""
2Test setting a breakpoint on an overloaded function by name.
3"""
4
5import re
6import lldb
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class TestBreakpointOnOverload(TestBase):
13
14    mydir = TestBase.compute_mydir(__file__)
15
16    def check_breakpoint(self, name):
17        bkpt = self.target.BreakpointCreateByName(name)
18        self.assertEqual(bkpt.num_locations, 1, "Got one location")
19        addr = bkpt.locations[0].GetAddress()
20        self.assertTrue(addr.function.IsValid(), "Got a real function")
21        self.assertEqual(addr.function.name, name, "Got the right name")
22
23    def test_break_on_overload(self):
24        self.build()
25        self.target = lldbutil.run_to_breakpoint_make_target(self)
26        self.check_breakpoint("a_function(int)")
27        self.check_breakpoint("a_function(double)")
28        self.check_breakpoint("a_function(int, double)")
29        self.check_breakpoint("a_function(double, int)")
30
31
32
33