[Lldb-commits] [lldb] r182860 - Refactors to provide two variants for evaluation of text_list:
Ashok Thirumurthi
ashok.thirumurthi at intel.com
Wed May 29 07:58:28 PDT 2013
Author: athirumu
Date: Wed May 29 09:58:27 2013
New Revision: 182860
URL: http://llvm.org/viewvc/llvm-project?rev=182860&view=rev
Log:
Refactors to provide two variants for evaluation of text_list:
- The original test now passes on Linux with clang because a breakpoint is hit prior to evaluation of text_list, which improves text coverage.
- The new test fails because 4 steps are requested, and only two occur prior to evaluation of text_list.
--- Note that the loss of every second "next" command can be reproduced using lldb manually with this script.
Modified:
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/main.cpp
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py?rev=182860&r1=182859&r2=182860&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py Wed May 29 09:58:27 2013
@@ -20,17 +20,33 @@ class StdListDataFormatterTestCase(TestB
self.data_formatter_commands()
@dwarf_test
- @expectedFailureGcc # llvm.org/pr15301 LLDB prints incorrect sizes of STL containers
+ @expectedFailureLinux('llvm.org/pr15301', ['gcc', 'icc']) # LLDB prints incorrect sizes of STL containers
def test_with_dwarf_and_run_command(self):
"""Test data formatter commands."""
self.buildDwarf()
self.data_formatter_commands()
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @dsym_test
+ def test_with_dsym_and_run_command(self):
+ """Test data formatter commands."""
+ self.buildDsym()
+ self.data_formatter_commands_after_steps()
+
+ @dwarf_test
+ @expectedFailureLinux # llvm.org/pr15301 Multiple LLDB steps do not all complete synchronously.
+ def test_with_dwarf_and_run_command_after_steps(self):
+ """Test data formatter commands with multiple steps."""
+ self.buildDwarf()
+ self.data_formatter_commands_after_steps()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break at.
+ # Find the line numbers to break at for the different tests.
self.line = line_number('main.cpp', '// Set break point at this line.')
+ self.optional_line = line_number('main.cpp', '// Optional break point at this line.')
+ self.final_line = line_number('main.cpp', '// Set final break point at this line.')
def data_formatter_commands(self):
"""Test that that file and class static variables display correctly."""
@@ -159,7 +175,14 @@ class StdListDataFormatterTestCase(TestB
substrs = ['list has 0 items',
'{}'])
- self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.final_line, num_expected_locations=-1)
+
+ self.runCmd("c", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
self.expect("frame variable text_list",
substrs = ['list has 4 items',
@@ -188,6 +211,46 @@ class StdListDataFormatterTestCase(TestB
# check that MightHaveChildren() gets it right
self.assertTrue(self.frame().FindVariable("text_list").MightHaveChildren(), "text_list.MightHaveChildren() says False for non empty!")
+ def data_formatter_commands_after_steps(self):
+ """Test that that file and class static variables display correctly after multiple step instructions."""
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.optional_line, num_expected_locations=-1)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ self.expect("frame variable text_list",
+ substrs = ['{}'])
+
+ # Verify that steps in rapid succession are processed prior to inspecting text_list.
+ self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
+
+ self.expect("frame variable text_list",
+ substrs = ['list has 4 items',
+ '[0]', 'goofy',
+ '[1]', 'is',
+ '[2]', 'smart',
+ '[3]', '!!!'])
+
+ self.expect("p text_list",
+ substrs = ['list has 4 items',
+ '\"goofy\"',
+ '\"is\"',
+ '\"smart\"',
+ '\"!!!\"'])
+
+ # check access-by-index
+ self.expect("frame variable text_list[0]",
+ substrs = ['goofy']);
+ self.expect("frame variable text_list[3]",
+ substrs = ['!!!']);
+
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/main.cpp?rev=182860&r1=182859&r2=182860&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/main.cpp (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/main.cpp Wed May 29 09:58:27 2013
@@ -23,11 +23,12 @@ int main()
numbers_list.push_back(4);
string_list text_list;
- text_list.push_back(std::string("goofy"));
+ text_list.push_back(std::string("goofy")); // Optional break point at this line.
text_list.push_back(std::string("is"));
text_list.push_back(std::string("smart"));
text_list.push_back(std::string("!!!"));
- return 0;
-}
\ No newline at end of file
+ return 0; // Set final break point at this line.
+}
+
More information about the lldb-commits
mailing list