Home | History | Annotate | Download | only in overloaded-functions
      1 """
      2 Tests that functions with the same name are resolved correctly.
      3 """
      4 
      5 import lldb
      6 from lldbtest import *
      7 import lldbutil
      8 
      9 class CPPStaticMethodsTestCase(TestBase):
     10     
     11     mydir = os.path.join("lang", "cpp", "overloaded-functions")
     12     
     13     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     14     @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 
     20     @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 
     49 if __name__ == '__main__':
     50     import atexit
     51     lldb.SBDebugger.Initialize()
     52     atexit.register(lambda: lldb.SBDebugger.Terminate())
     53     unittest2.main()
     54