[Lldb-commits] [lldb] r235034 - [TestMiBreak] Print a formatted string via printf in the test case.

Siva Chandra sivachandra at google.com
Wed Apr 15 11:32:17 PDT 2015


Author: sivachandra
Date: Wed Apr 15 13:32:17 2015
New Revision: 235034

URL: http://llvm.org/viewvc/llvm-project?rev=235034&view=rev
Log:
[TestMiBreak] Print a formatted string via printf in the test case.

Summary:
If the string is not formatted, these can happen when compiled with GCC:
1. If it is a null string "", then GCC completely removes the call to
printf even with -O0.
2. If the string is a single character string, say "\n" for example,
then GCC replaces the call to printf with a call to putchar.
3. If the string length is greater than 1, but is not formatted, then
GCC replaces the call to printf with a call to puts.

All the above will fail the test as we want a breakpoint on "printf" to
hit.

Test Plan: dotest.py -C gcc -p TestMiBreak

Reviewers: chying, ki.stfu

Reviewed By: ki.stfu

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D9025

Modified:
    lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
    lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp

Modified: lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=235034&r1=235033&r2=235034&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py Wed Apr 15 13:32:17 2015
@@ -13,7 +13,6 @@ class MiBreakTestCase(lldbmi_testcase.Mi
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
-    @expectedFailureGcc #xfail to get buildbot green, test failed with gcc4.8.2
     def test_lldbmi_break_insert_function_pending(self):
         """Test that 'lldb-mi --interpreter' works for pending function breakpoints."""
 
@@ -38,7 +37,6 @@ class MiBreakTestCase(lldbmi_testcase.Mi
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
-    @expectedFailureGcc #xfail to get buildbot green, test failed with gcc4.8.2
     def test_lldbmi_break_insert_function(self):
         """Test that 'lldb-mi --interpreter' works for function breakpoints."""
 
@@ -98,7 +96,6 @@ class MiBreakTestCase(lldbmi_testcase.Mi
     @lldbmi_test
     @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
     @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
-    @expectedFailureGcc #xfail to get buildbot green, test failed with gcc4.8.2
     def test_lldbmi_break_insert_file_line(self):
         """Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
 

Modified: lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp?rev=235034&r1=235033&r2=235034&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp Wed Apr 15 13:32:17 2015
@@ -12,6 +12,6 @@
 int
 main(int argc, char const *argv[])
 {
-    printf("");
+    printf("Print a formatted string so that GCC does not optimize this printf call: %s\n", argv[0]);
     return 0; // BP_return
 }





More information about the lldb-commits mailing list