| Summary: | lldb-webkit: Pretty-print OptionSet | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Daniel Bates <dbates> | ||||
| Component: | Tools / Tests | Assignee: | 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
Daniel Bates
2018-08-24 15:46:21 PDT
Created attachment 348050 [details]
Patch and unit tests
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
}
Comment on attachment 348050 [details]
Patch and unit tests
Very nice.
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 (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. (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 } Committed r235376: <https://trac.webkit.org/changeset/235376> (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. Re-opened since this is blocked by bug 189008 (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. |