Johnny Chen | b146ad5 | 2011-05-19 21:28:24 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test calling std::String member functions. |
| 3 | """ |
| 4 | |
Zachary Turner | 77db4a8 | 2015-10-22 20:06:20 +0000 | [diff] [blame] | 5 | import lldb_shared |
| 6 | |
Johnny Chen | b146ad5 | 2011-05-19 21:28:24 +0000 | [diff] [blame] | 7 | import lldb |
| 8 | import lldbutil |
| 9 | from lldbtest import * |
| 10 | |
| 11 | class ExprCommandCallFunctionTestCase(TestBase): |
| 12 | |
Greg Clayton | 4570d3e | 2013-12-10 23:19:29 +0000 | [diff] [blame] | 13 | mydir = TestBase.compute_mydir(__file__) |
Johnny Chen | b146ad5 | 2011-05-19 21:28:24 +0000 | [diff] [blame] | 14 | |
| 15 | def setUp(self): |
| 16 | # Call super's setUp(). |
| 17 | TestBase.setUp(self) |
| 18 | # Find the line number to break for main.c. |
| 19 | self.line = line_number('main.cpp', |
| 20 | '// Please test these expressions while stopped at this line:') |
| 21 | |
Matt Kopec | 9c99030 | 2013-08-02 17:53:28 +0000 | [diff] [blame] | 22 | @expectedFailureIcc # llvm.org/pr14437, fails with ICC 13.1 |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 23 | @expectedFailureFreeBSD('llvm.org/pr17807') # Fails on FreeBSD buildbot |
Zachary Turner | 608cb82 | 2015-09-11 20:00:00 +0000 | [diff] [blame] | 24 | @expectedFailureWindows("llvm.org/pr21765") |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 25 | def test_with(self): |
Johnny Chen | b146ad5 | 2011-05-19 21:28:24 +0000 | [diff] [blame] | 26 | """Test calling std::String member function.""" |
Tamas Berghammer | c8fd130 | 2015-09-30 10:12:40 +0000 | [diff] [blame] | 27 | self.build() |
Johnny Chen | b146ad5 | 2011-05-19 21:28:24 +0000 | [diff] [blame] | 28 | self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) |
| 29 | |
Matt Kopec | c51b243 | 2013-03-01 17:29:16 +0000 | [diff] [blame] | 30 | # Some versions of GCC encode two locations for the 'return' statement in main.cpp |
| 31 | lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True) |
Johnny Chen | b146ad5 | 2011-05-19 21:28:24 +0000 | [diff] [blame] | 32 | |
Sean Callanan | 05834cd | 2015-07-01 23:56:30 +0000 | [diff] [blame] | 33 | self.runCmd("run", RUN_SUCCEEDED) |
Johnny Chen | b146ad5 | 2011-05-19 21:28:24 +0000 | [diff] [blame] | 34 | |
| 35 | self.expect("print str", |
| 36 | substrs = ['Hello world']) |
| 37 | |
Jim Ingham | 8e52209 | 2014-03-19 00:30:31 +0000 | [diff] [blame] | 38 | # Calling this function now succeeds, but we follow the typedef return type through to |
| 39 | # const char *, and thus don't invoke the Summary formatter. |
Johnny Chen | b146ad5 | 2011-05-19 21:28:24 +0000 | [diff] [blame] | 40 | self.expect("print str.c_str()", |
| 41 | substrs = ['Hello world']) |