Bug 188936

Summary: lldb-webkit: Pretty-print OptionSet
Product: WebKit Reporter: Daniel Bates <dbates>
Component: Tools / TestsAssignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, koivisto, lforschler, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: All   
OS: All   
Bug Depends on: 189008    
Bug Blocks: 189011    
Attachments:
Description Flags
Patch and unit tests simon.fraser: review+

Daniel Bates
Reported 2018-08-24 15:46:21 PDT
We should add support for pretty-printing OptionSet.
Attachments
Patch and unit tests (8.65 KB, patch)
2018-08-24 15:51 PDT, Daniel Bates
simon.fraser: review+
Daniel Bates
Comment 1 2018-08-24 15:51:20 PDT
Created attachment 348050 [details] Patch and unit tests
Daniel Bates
Comment 2 2018-08-24 15:51:47 PDT
With the proposed patch, here is how it looks to print a variable that is an OptionSet: (lldb) p checkingTypes (WTF::OptionSet<WebCore::TextCheckingType>) $3 = { size = 3 } { (Spelling) [0] = 0 (Grammar) [1] = 1 (Replacement) [2] = 4 }
Simon Fraser (smfr)
Comment 3 2018-08-24 15:55:03 PDT
Comment on attachment 348050 [details] Patch and unit tests Very nice.
Daniel Bates
Comment 4 2018-08-24 18:57:03 PDT
Comment on attachment 348050 [details] Patch and unit tests View in context: https://bugs.webkit.org/attachment.cgi?id=348050&action=review > Tools/lldb/lldb_webkit.py:33 > +import operator Will remoce this before landing. > Tools/lldb/lldb_webkit.py:613 > + return self.valobj.CreateValueFromExpression('(%s) [%s]' % (self._elements[index], str(index)), str(index ** 2)) index ** 2 => 2 ** index
Daniel Bates
Comment 5 2018-08-27 09:29:51 PDT
(In reply to Daniel Bates from comment #4) > Comment on attachment 348050 [details] > Patch and unit tests > > View in context: > https://bugs.webkit.org/attachment.cgi?id=348050&action=review > > > Tools/lldb/lldb_webkit.py:33 > > +import operator > > Will remoce this before landing. > > > Tools/lldb/lldb_webkit.py:613 > > + return self.valobj.CreateValueFromExpression('(%s) [%s]' % (self._elements[index], str(index)), str(index ** 2)) > > index ** 2 => 2 ** index This is not correct because index represents the position in the array of collected enumerators != the enumerator's value. We need to explicitly keep track of the value of each seen enumerator.
Daniel Bates
Comment 6 2018-08-27 09:33:32 PDT
(In reply to Daniel Bates from comment #2) > With the proposed patch, here is how it looks to print a variable that is an > OptionSet: > > (lldb) p checkingTypes > (WTF::OptionSet<WebCore::TextCheckingType>) $3 = { size = 3 } { > (Spelling) [0] = 0 > (Grammar) [1] = 1 > (Replacement) [2] = 4 > } Displaying the position in the set (e.g. [1]) does not seem very useful since you cannot index into the set. I am going to simplify this output to only show the name of the enumerator and its value before landing (due to : (lldb) p checkingTypes (WTF::OptionSet<WebCore::TextCheckingType>) $3 = { size = 3 } { Spelling = 1 Grammar = 2 Replacement = 32 }
Daniel Bates
Comment 7 2018-08-27 09:59:48 PDT
Radar WebKit Bug Importer
Comment 8 2018-08-27 10:00:27 PDT
Daniel Bates
Comment 9 2018-08-27 14:45:15 PDT
(In reply to Daniel Bates from comment #7) > Committed r235376: <https://trac.webkit.org/changeset/235376> For some reason the tests lldb_webkit_unittest.TestSummaryProviders.serial_test_WTFOptionSetProvider_simple and lldb_webkit_unittest.TestSummaryProviders.serial_test_WTFOptionSet_SummaryProvider_simple, included in this change, are failing on the Apple High Sierra Debug and Apple Sierra Debug bots. These tests do not fail on the Release variants of these bots (why?). The following is the failure output: [[ [1772/1787] lldb_webkit_unittest.TestSummaryProviders.serial_test_WTFOptionSetProvider_simple [1773/1787] lldb_webkit_unittest.TestSummaryProviders.serial_test_WTFOptionSetProvider_simple erred: Traceback (most recent call last): File "/Volumes/Data/slave/highsierra-debug-tests-wk2/build/Tools/lldb/lldb_webkit_unittest.py", line 193, in serial_test_WTFOptionSetProvider_simple self.assertEqual(provider.get_child_at_index(0).GetName(), 'A') AttributeError: 'NoneType' object has no attribute 'GetName' ... [1779/1787] lldb_webkit_unittest.TestSummaryProviders.serial_test_WTFOptionSet_SummaryProvider_simple failed: Traceback (most recent call last): File "/Volumes/Data/slave/highsierra-debug-tests-wk2/build/Tools/lldb/lldb_webkit_unittest.py", line 181, in serial_test_WTFOptionSet_SummaryProvider_simple self.assertEqual(summary, "{ size = 3 }") AssertionError: '{ size = 0 }' != '{ size = 3 }' [1779/1787] dump_class_layout_unittest.TestDumpClassLayout.serial_test_ClassWithTwoVirtualBaseClasses ]] <https://build.webkit.org/builders/Apple%20High%20Sierra%20Debug%20WK2%20%28Tests%29/builds/4639/steps/webkitpy-test/logs/stdio> Same error seen on Apple Sierra Debug WK1 (Tests): <https://build.webkit.org/builders/Apple%20Sierra%20Debug%20WK1%20%28Tests%29/builds/9271/steps/webkitpy-test/logs/stdio> For completeness, the Apple Sierra Release WK2 (Tests) and High Sierra Release WK2 (Tests) output of test-webkitpy is at <https://build.webkit.org/builders/Apple%20Sierra%20Release%20WK2%20%28Tests%29/builds/11327/steps/webkitpy-test/logs/stdio> and <https://build.webkit.org/builders/Apple%20High%20Sierra%20Release%20WK2%20%28Tests%29/builds/6406/steps/webkitpy-test/logs/stdio>, respectively.
WebKit Commit Bot
Comment 10 2018-08-27 14:47:17 PDT
Re-opened since this is blocked by bug 189008
Daniel Bates
Comment 11 2018-08-30 09:33:32 PDT
(In reply to Daniel Bates from comment #9) > (In reply to Daniel Bates from comment #7) > > Committed r235376: <https://trac.webkit.org/changeset/235376> > > For some reason the tests > lldb_webkit_unittest.TestSummaryProviders. > serial_test_WTFOptionSetProvider_simple and > lldb_webkit_unittest.TestSummaryProviders. > serial_test_WTFOptionSet_SummaryProvider_simple, included in this change, > are failing on the Apple High Sierra Debug and Apple Sierra Debug bots. > These tests do not fail on the Release variants of these bots (why?). The > following is the failure output: > > [[ > [1772/1787] > lldb_webkit_unittest.TestSummaryProviders. > serial_test_WTFOptionSetProvider_simple > [1773/1787] > lldb_webkit_unittest.TestSummaryProviders. > serial_test_WTFOptionSetProvider_simple erred: > Traceback (most recent call last): > File > "/Volumes/Data/slave/highsierra-debug-tests-wk2/build/Tools/lldb/ > lldb_webkit_unittest.py", line 193, in > serial_test_WTFOptionSetProvider_simple > self.assertEqual(provider.get_child_at_index(0).GetName(), 'A') > AttributeError: 'NoneType' object has no attribute 'GetName' > ... > [1779/1787] > lldb_webkit_unittest.TestSummaryProviders. > serial_test_WTFOptionSet_SummaryProvider_simple failed: > Traceback (most recent call last): > File > "/Volumes/Data/slave/highsierra-debug-tests-wk2/build/Tools/lldb/ > lldb_webkit_unittest.py", line 181, in > serial_test_WTFOptionSet_SummaryProvider_simple > self.assertEqual(summary, "{ size = 3 }") > AssertionError: '{ size = 0 }' != '{ size = 3 }' > [1779/1787] > dump_class_layout_unittest.TestDumpClassLayout. > serial_test_ClassWithTwoVirtualBaseClasses > ]] > <https://build.webkit.org/builders/ > Apple%20High%20Sierra%20Debug%20WK2%20%28Tests%29/builds/4639/steps/webkitpy- > test/logs/stdio> > > Same error seen on Apple Sierra Debug WK1 (Tests): > <https://build.webkit.org/builders/ > Apple%20Sierra%20Debug%20WK1%20%28Tests%29/builds/9271/steps/webkitpy-test/ > logs/stdio> > > For completeness, the Apple Sierra Release WK2 (Tests) and High Sierra > Release WK2 (Tests) output of test-webkitpy is at > <https://build.webkit.org/builders/ > Apple%20Sierra%20Release%20WK2%20%28Tests%29/builds/11327/steps/webkitpy- > test/logs/stdio> and > <https://build.webkit.org/builders/ > Apple%20High%20Sierra%20Release%20WK2%20%28Tests%29/builds/6406/steps/ > webkitpy-test/logs/stdio>, respectively. Filed bug #189011 to fix this.
Note You need to log in before you can comment on or make changes to this bug.