blob: 0ae186ff28646ee2fa50422fc5027bd51704c605 [file] [log] [blame]
Sean Callanan485f7322013-04-24 00:34:41 +00001"""
2Tests that functions with the same name are resolved correctly.
3"""
4
5import lldb
6from lldbtest import *
7import lldbutil
8
9class CPPStaticMethodsTestCase(TestBase):
10
Greg Clayton4570d3e2013-12-10 23:19:29 +000011 mydir = TestBase.compute_mydir(__file__)
Sean Callanan485f7322013-04-24 00:34:41 +000012
Robert Flack13c7ad92015-03-30 14:12:17 +000013 @skipUnlessDarwin
Sean Callanan485f7322013-04-24 00:34:41 +000014 @dsym_test
15 def test_with_dsym_and_run_command(self):
16 """Test that functions with the same name are resolved correctly"""
17 self.buildDsym()
18 self.static_method_commands()
19
Sean Callanan485f7322013-04-24 00:34:41 +000020 @dwarf_test
21 def test_with_dwarf_and_run_command(self):
22 """Test that functions with the same name are resolved correctly"""
23 self.buildDwarf()
24 self.static_method_commands()
25
26 def setUp(self):
27 TestBase.setUp(self)
28 self.line = line_number('main.cpp', '// breakpoint')
29
30 def static_method_commands(self):
31 """Test that static methods are properly distinguished from regular methods"""
32 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
33
34 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
35
36 self.runCmd("process launch", RUN_SUCCEEDED)
37
38 # The stop reason of the thread should be breakpoint.
39 self.expect("thread list",
40 STOPPED_DUE_TO_BREAKPOINT,
41 substrs = ['stopped', 'stop reason = breakpoint'])
42
43 self.expect("expression -- Dump(myB)",
44 startstr = "(int) $0 = 2")
45
46 self.expect("expression -- Static()",
47 startstr = "(int) $1 = 1")
48
49if __name__ == '__main__':
50 import atexit
51 lldb.SBDebugger.Initialize()
52 atexit.register(lambda: lldb.SBDebugger.Terminate())
53 unittest2.main()