[Lldb-commits] [lldb] r243472 - Fix a bug where the std::list synthetic child provider would not clean its cache correctly on update, causing stale children to be returned in some circumstances

Enrico Granata egranata at apple.com
Tue Jul 28 13:19:45 PDT 2015


Author: enrico
Date: Tue Jul 28 15:19:45 2015
New Revision: 243472

URL: http://llvm.org/viewvc/llvm-project?rev=243472&view=rev
Log:
Fix a bug where the std::list synthetic child provider would not clean its cache correctly on update, causing stale children to be returned in some circumstances

Fixes rdar://20560680


Modified:
    lldb/trunk/source/DataFormatters/LibCxxList.cpp
    lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
    lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp

Modified: lldb/trunk/source/DataFormatters/LibCxxList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/LibCxxList.cpp?rev=243472&r1=243471&r2=243472&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/LibCxxList.cpp (original)
+++ lldb/trunk/source/DataFormatters/LibCxxList.cpp Tue Jul 28 15:19:45 2015
@@ -312,6 +312,7 @@ lldb_private::formatters::LibcxxStdListS
 bool
 lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update()
 {
+    m_children.clear();
     m_head = m_tail = NULL;
     m_node_address = 0;
     m_count = UINT32_MAX;

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py?rev=243472&r1=243471&r2=243472&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py Tue Jul 28 15:19:45 2015
@@ -33,6 +33,8 @@ class LibcxxListDataFormatterTestCase(Te
         # Find the line number to break at.
         self.line = line_number('main.cpp', '// Set break point at this line.')
         self.line2 = line_number('main.cpp', '// Set second break point at this line.')
+        self.line3 = line_number('main.cpp', '// Set third break point at this line.')
+        self.line4 = line_number('main.cpp', '// Set fourth break point at this line.')
 
     def data_formatter_commands(self):
         """Test that that file and class static variables display correctly."""
@@ -40,6 +42,8 @@ class LibcxxListDataFormatterTestCase(Te
 
         lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
         lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=-1)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line3, num_expected_locations=-1)
+        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line4, num_expected_locations=-1)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -172,6 +176,21 @@ class LibcxxListDataFormatterTestCase(Te
                     substrs = ['goofy']);
         self.expect("frame variable text_list[3]",
                     substrs = ['!!!']);
+                    
+        self.runCmd("continue")
+        
+        # check that the list provider correctly updates if elements move
+        countingList = self.frame().FindVariable("countingList")
+        countingList.SetPreferDynamicValue(True)
+        countingList.SetPreferSyntheticValue(True)
+        
+        self.assertTrue(countingList.GetChildAtIndex(0).GetValueAsUnsigned(0) == 3141, "list[0] == 3141")
+        self.assertTrue(countingList.GetChildAtIndex(1).GetValueAsUnsigned(0) == 3141, "list[1] == 3141")
+        
+        self.runCmd("continue")
+
+        self.assertTrue(countingList.GetChildAtIndex(0).GetValueAsUnsigned(0) == 3141, "uniqued list[0] == 3141")
+        self.assertTrue(countingList.GetChildAtIndex(1).GetValueAsUnsigned(0) == 3142, "uniqued list[1] == 3142")
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp?rev=243472&r1=243471&r2=243472&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/main.cpp Tue Jul 28 15:19:45 2015
@@ -33,6 +33,11 @@ int main()
     (text_list.push_back(std::string("smart")));
     
     (text_list.push_back(std::string("!!!"))); // Set second break point at this line.
-        
+    
+    std::list<int> countingList = {3141, 3142, 3142,3142,3142, 3142, 3142, 3141};
+    countingList.sort();
+    countingList.unique(); // Set third break point at this line.
+    countingList.size(); // Set fourth break point at this line.
+
     return 0;
-}
\ No newline at end of file
+}





More information about the lldb-commits mailing list