Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test that we can successfully step into an STL function. |
| 3 | """ |
| 4 | |
| 5 | import os, time |
Johnny Chen | 7325883 | 2010-08-05 23:42:46 +0000 | [diff] [blame] | 6 | import unittest2 |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 7 | import lldb |
Johnny Chen | 1794184 | 2010-08-09 23:44:24 +0000 | [diff] [blame] | 8 | from lldbtest import * |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 9 | |
Johnny Chen | cbb4be0 | 2010-09-01 19:59:58 +0000 | [diff] [blame] | 10 | class STLTestCase(TestBase): |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 11 | |
| 12 | mydir = "stl" |
| 13 | |
Johnny Chen | 7325883 | 2010-08-05 23:42:46 +0000 | [diff] [blame] | 14 | @unittest2.expectedFailure |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 15 | def test_step_into_stl(self): |
| 16 | """Test that we can successfully step into an STL function.""" |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 17 | exe = os.path.join(os.getcwd(), "a.out") |
Johnny Chen | ff3d01d | 2010-08-20 21:03:09 +0000 | [diff] [blame] | 18 | |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 19 | # The following two lines, if uncommented, will enable loggings. |
| 20 | #self.ci.HandleCommand("log enable -f /tmp/lldb.log lldb default", res) |
| 21 | #self.assertTrue(res.Succeeded()) |
Johnny Chen | ff3d01d | 2010-08-20 21:03:09 +0000 | [diff] [blame] | 22 | |
| 23 | self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 24 | |
| 25 | # Break on line 13 of main.cpp. |
Johnny Chen | ff3d01d | 2010-08-20 21:03:09 +0000 | [diff] [blame] | 26 | self.expect("breakpoint set -f main.cpp -l 13", BREAKPOINT_CREATED, |
| 27 | startstr = "Breakpoint created: 1: file ='main.cpp', line = 13, locations = 1") |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 28 | |
Johnny Chen | 5ee8819 | 2010-08-27 23:47:36 +0000 | [diff] [blame] | 29 | self.runCmd("run", RUN_SUCCEEDED) |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 30 | |
| 31 | # Stop at 'std::string hello_world ("Hello World!");'. |
Johnny Chen | ff3d01d | 2010-08-20 21:03:09 +0000 | [diff] [blame] | 32 | self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, |
| 33 | substrs = ['main.cpp:13', |
| 34 | 'stop reason = breakpoint']) |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 35 | |
| 36 | # The breakpoint should have a hit count of 1. |
Johnny Chen | ff3d01d | 2010-08-20 21:03:09 +0000 | [diff] [blame] | 37 | self.expect("breakpoint list", BREAKPOINT_HIT_ONCE, |
| 38 | substrs = [' resolved, hit count = 1']) |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 39 | |
| 40 | # Now do 'thread step-in', we should stop on the basic_string template. |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 41 | # |
| 42 | # This assertion currently always fails. |
Johnny Chen | 588ddc1 | 2010-07-28 22:00:42 +0000 | [diff] [blame] | 43 | # This might be related: rdar://problem/8247112. |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 44 | # |
Johnny Chen | d0190a6 | 2010-08-23 17:10:44 +0000 | [diff] [blame] | 45 | #self.runCmd("thread step-in", trace=True) |
Johnny Chen | ff3d01d | 2010-08-20 21:03:09 +0000 | [diff] [blame] | 46 | self.runCmd("thread step-in") |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 47 | |
Johnny Chen | ff3d01d | 2010-08-20 21:03:09 +0000 | [diff] [blame] | 48 | self.expect("thread backtrace", "We have stepped in STL", |
| 49 | substrs = ['[inlined]', |
| 50 | 'basic_string.h']) |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 51 | |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 52 | |
| 53 | if __name__ == '__main__': |
Johnny Chen | a212495 | 2010-08-05 21:23:45 +0000 | [diff] [blame] | 54 | import atexit |
Johnny Chen | 377a8ed | 2010-07-28 21:24:31 +0000 | [diff] [blame] | 55 | lldb.SBDebugger.Initialize() |
Johnny Chen | a212495 | 2010-08-05 21:23:45 +0000 | [diff] [blame] | 56 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
Johnny Chen | 7325883 | 2010-08-05 23:42:46 +0000 | [diff] [blame] | 57 | unittest2.main() |