Author: jingham
Date: Tue Mar 18 20:54:41 2014
New Revision: 204209

URL: http://llvm.org/viewvc/llvm-project?rev=204209&view=rev
Log:
Add a test to check the C's constructor's name is C::C, which will fail 
everywhere now,
so mark as expected fail.  And find another way to check that we hit our 
constructor
breakpoint, so we don't need to expected fail the Disassembly tests.

Modified:
    lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
    lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py

Modified: lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py?rev=204209&r1=204208&r2=204209&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py Tue Mar 18 20:54:41 
2014
@@ -10,6 +10,7 @@ import lldbutil
 class ClassTypesTestCase(TestBase):
 
     mydir = TestBase.compute_mydir(__file__)
+    failing_compilers = ['clang', 'gcc']
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
@@ -59,6 +60,27 @@ class ClassTypesTestCase(TestBase):
         self.buildDwarf()
         self.class_types_expr_parser()
 
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    # rdar://problem/8557478
+    # test/class_types test failures: runCmd: expr this->m_c_int
+    @dsym_test
+    @expectedFailureDarwin(16362674)
+    def test_with_dsym_and_constructor_name(self):
+        """Test 'frame variable this' and 'expr this' when stopped inside a 
constructor."""
+        self.buildDsym()
+        self.class_types_constructor_name()
+
+    # rdar://problem/8557478
+    # test/class_types test failures: runCmd: expr this->m_c_int
+    @dwarf_test
+    @expectedFailureFreeBSD('llvm.org/pr14540')
+    @expectedFailureLinux('llvm.org/pr14540', failing_compilers)
+    @expectedFailureDarwin(16362674)
+    def test_with_dwarf_and_constructor_name (self):
+        """Test 'frame variable this' and 'expr this' when stopped inside a 
constructor."""
+        self.buildDwarf()
+        self.class_types_constructor_name()
+
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
@@ -206,6 +228,55 @@ class ClassTypesTestCase(TestBase):
             patterns = ['\(int\) \$[0-9]+ = 66'])
 
 
+    def class_types_constructor_name (self):
+        """Check whether the constructor name has the class name prepended."""
+        exe = os.path.join(os.getcwd(), "a.out")
+
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        filespec = target.GetExecutable()
+        self.assertTrue(filespec, VALID_FILESPEC)
+
+        fsDir = filespec.GetDirectory()
+        fsFile = filespec.GetFilename()
+
+        self.assertTrue(fsDir == os.getcwd() and fsFile == "a.out",
+                        "FileSpec matches the executable")
+
+        bpfilespec = lldb.SBFileSpec("main.cpp", False)
+
+        breakpoint = target.BreakpointCreateByLocation(bpfilespec, self.line)
+        self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+        # Verify the breakpoint just created.
+        self.expect(str(breakpoint), BREAKPOINT_CREATED, exe=False,
+            substrs = ['main.cpp',
+                       str(self.line)])
+
+        # Now launch the process, and do not stop at entry point.
+        process = target.LaunchSimple (None, None, 
self.get_process_working_directory())
+
+        if not process:
+            self.fail("SBTarget.Launch() failed")
+
+        if process.GetState() != lldb.eStateStopped:
+            self.fail("Process should be in the 'stopped' state, "
+                      "instead the actual state is: '%s'" %
+                      lldbutil.state_type_to_str(process.GetState()))
+
+        # The stop reason of the thread should be breakpoint.
+        thread = process.GetThreadAtIndex(0)
+        if thread.GetStopReason() != lldb.eStopReasonBreakpoint:
+            from lldbutil import stop_reason_to_str
+            self.fail(STOPPED_DUE_TO_BREAKPOINT_WITH_STOP_REASON_AS %
+                      stop_reason_to_str(thread.GetStopReason()))
+
+        frame = thread.frames[0]
+        self.assertTrue (frame.IsValid(), "Got a valid frame.")
+
+        self.assertTrue ("C::C" in frame.name, "Constructor name includes 
class name.")
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py?rev=204209&r1=204208&r2=204209&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py (original)
+++ lldb/trunk/test/lang/cpp/class_types/TestClassTypesDisassembly.py Tue Mar 
18 20:54:41 2014
@@ -21,8 +21,6 @@ class IterateFrameAndDisassembleTestCase
         self.disassemble_call_stack()
 
     @dwarf_test
-    @expectedFailureFreeBSD('llvm.org/pr14540')
-    @expectedFailureLinux('llvm.org/pr14540', failing_compilers)
     def test_with_dwarf_and_run_command(self):
         """Disassemble each call frame when stopped on C's constructor."""
         self.buildDwarf()
@@ -38,8 +36,6 @@ class IterateFrameAndDisassembleTestCase
 
     @python_api_test
     @dwarf_test
-    @expectedFailureFreeBSD('llvm.org/pr14540')
-    @expectedFailureLinux('llvm.org/pr14540', failing_compilers)
     def test_with_dwarf_and_python_api(self):
         """Disassemble each call frame when stopped on C's constructor."""
         self.buildDwarf()


_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to