Home | History | Annotate | Download | only in objc++
      1 """
      2 Make sure that ivars of Objective-C++ classes are visible in LLDB.
      3 """
      4 
      5 import os, time
      6 import unittest2
      7 import lldb
      8 from lldbtest import *
      9 import lldbutil
     10 
     11 class ObjCXXTestCase(TestBase):
     12 
     13     mydir = os.path.join("lang", "objc", "objc++")
     14 
     15     @dsym_test
     16     def test_break_with_dsym(self):
     17         """Test ivars of Objective-C++ classes"""
     18         if self.getArchitecture() == 'i386':
     19             self.skipTest("requires Objective-C 2.0 runtime")
     20         self.buildDsym()
     21         self.do_testObjCXXClasses()
     22 
     23     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     24     @dwarf_test
     25     def test_break_with_dwarf(self):
     26         """Test ivars of Objective-C++ classes"""
     27         if self.getArchitecture() == 'i386':
     28             self.skipTest("requires Objective-C 2.0 runtime")
     29         self.buildDwarf()
     30         self.do_testObjCXXClasses()
     31 
     32     def do_testObjCXXClasses(self):
     33         """Test ivars of Objective-C++ classes"""
     34         exe = os.path.join(os.getcwd(), "a.out")
     35         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
     36 
     37         lldbutil.run_break_set_by_source_regexp (self, 'breakpoint 1', num_expected_locations=1) 
     38 
     39         self.runCmd("run", RUN_SUCCEEDED)
     40 
     41         self.expect("expr f->f", "Found ivar in class",
     42             substrs = ["= 3"])
     43         
     44 if __name__ == '__main__':
     45     import atexit
     46     lldb.SBDebugger.Initialize()
     47     atexit.register(lambda: lldb.SBDebugger.Terminate())
     48     unittest2.main()
     49