REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7987

Files:
  lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py
  lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
  lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
  lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
===================================================================
--- lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
+++ lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
@@ -16,7 +16,7 @@
 
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
-    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
     def test_lldbmi_stopped_when_interrupt(self):
         """Test that 'lldb-mi --interpreter' interrupt and resume a looping app."""
 
@@ -70,8 +70,9 @@
         # Test that *stopped is printed
         # Note that message is different in Darwin and Linux:
         # Darwin: "*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",frame={level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
-        # Linux:  "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=\[\],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
-        self.expect("\*stopped,reason=\"(signal-received|end-stepping-range)\",.+,thread-id=\"1\",stopped-threads=\"all\"")
+        # Linux:  "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=[],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
+        self.expect([ "\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\},thread-id=\"1\",stopped-threads=\"all\"",
+                      "\*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"\?\?\",args=\[\],file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"" ])
 
         # Run to main to make sure we have not exited the application
         self.runCmd("-break-insert -f main")
@@ -150,7 +151,11 @@
         self.expect("\^running")
 
         # Test that *stopped is printed
-        self.expect("\*stopped,reason=\"exception-received\",exception=\"(EXC_BAD_ACCESS \(code=1, address=0x0\)|invalid address \(fault address: 0x0\))\",thread-id=\"1\",stopped-threads=\"all\"")
+        # Note that message is different in Darwin and Linux:
+        # Darwin: "*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS (code=1, address=0x0)\",thread-id=\"1\",stopped-threads=\"all\""
+        # Linux:  "*stopped,reason=\"exception-received\",exception=\"invalid address (fault address: 0x0)\",thread-id=\"1\",stopped-threads=\"all\""
+        self.expect([ "\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"",
+                      "\*stopped,reason=\"exception-received\",exception=\"invalid address \(fault address: 0x0\)\",thread-id=\"1\",stopped-threads=\"all\"" ])
 
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
Index: lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
===================================================================
--- lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
+++ lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
@@ -263,38 +263,36 @@
 
         # Warning: the following is sensative to the lines in the source
 
-        # Test that -exec-step does not step into printf (which
-        # has no debug info)
-        #FIXME: is this supposed to step into printf?
+        # Test that -exec-step steps into (or not) printf depending on debug info
+        # Note that message is different in Darwin and Linux:
+        # Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
+        # Linux:  "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
         self.runCmd("-exec-step --thread 1 --frame 0")
         self.expect("\^running")
-        self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
+        it = self.expect([ "\*stopped,reason=\"end-stepping-range\".+func=\"main\"",
+                           "\*stopped,reason=\"end-stepping-range\".+func=\"((?!main).)+\"" ])
+        # Exit from printf if needed
+        if it == 1:
+            self.runCmd("-exec-finish")
+            self.expect("\^running")
+            self.expect("\*stopped,reason=\"end-stepping-range\".+func=\"main\"")
 
         # Test that -exec-step steps into g_MyFunction and back out
         # (and that --thread is optional)
         self.runCmd("-exec-step --frame 0")
         self.expect("\^running")
         self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
-        #FIXME: is this supposed to step into printf?
-        self.runCmd("-exec-step --frame 0")
-        self.expect("\^running")
-        self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
         # Use -exec-finish here to make sure that control reaches the caller.
         # -exec-step can keep us in the g_MyFunction for gcc
         self.runCmd("-exec-finish --frame 0")
         self.expect("\^running")
         self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"30\"")
 
         # Test that -exec-step steps into s_MyFunction
-        self.runCmd("-exec-step --frame 0")
-        self.expect("\^running")
-        self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"s_MyFunction\(\)\"")
-
-        # Test that -exec-step steps into g_MyFunction
         # (and that --frame is optional)
         self.runCmd("-exec-step --thread 1")
         self.expect("\^running")
-        self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
+        self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"s_MyFunction\(\)\"")
 
         # Test that -exec-step steps into g_MyFunction from inside
         # s_MyFunction (and that both --thread and --frame are optional)
@@ -315,7 +313,7 @@
 
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
-    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin due to calling convention assumptions")
+    @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
     def test_lldbmi_exec_step_instruction(self):
         """Test that 'lldb-mi --interpreter' works for instruction stepping into."""
 
Index: lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py
===================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py
+++ lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py
@@ -139,12 +139,16 @@
         self.expect("\^running")
         self.expect("\*stopped,reason=\"breakpoint-hit\"")
 
-        # Test that "thread step-in" steps in
-        #FIXME: is this supposed to step into printf?
+        # Test that "thread step-in" steps into (or not) printf depending on debug info
+        # Note that message is different in Darwin and Linux:
+        # Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
+        # Linux:  "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
         self.runCmd("-interpreter-exec console \"thread step-in\"")
         self.expect("\^done")
-        self.expect("~\"argc=1\\\\r\\\\n\"")
-        self.expect("\*stopped,reason=\"end-stepping-range\"")
+        it = self.expect([ "~\"argc=1\\\\r\\\\n\"",
+                           "\*stopped,reason=\"end-stepping-range\".+func=\"((?!main).)+\"" ])
+        if it == 0:
+            self.expect("\*stopped,reason=\"end-stepping-range\".+func=\"main\"")
 
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
Index: lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
===================================================================
--- lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
+++ lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
@@ -320,8 +320,11 @@
         self.expect("\^done")
 
         # Test that current frame is #1
+        # Note that message is different in Darwin and Linux:
+        # Darwin: "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\"start\",file=\"??\",fullname=\"??\",line=\"-1\"}"
+        # Linux:  "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"\d+\"}"
         self.runCmd("-stack-info-frame")
-        self.expect("\^done,frame=\{level=\"1\",addr=\".+\",func=\".+\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\}")
+        self.expect("\^done,frame=\{level=\"1\",addr=\".+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\"\}")
 
         # Test that -stack-select-frame can select frame #0 (child frame)
         self.runCmd("-stack-select-frame 0")
_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to