[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

llvm-svn: 235034
This commit is contained in:
Siva Chandra 2015-04-15 18:32:17 +00:00
parent 09129d957c
commit f5941b8d08
2 changed files with 1 additions and 4 deletions

View File

@ -13,7 +13,6 @@ class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase):
@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.MiTestCaseBase):
@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.MiTestCaseBase):
@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."""

View File

@ -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
}