Changeset 248970 in webkit
- Timestamp:
- Aug 21, 2019 3:42:48 PM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r248966 r248970 1 2019-08-21 Daniel Bates <dabates@apple.com> 2 3 [lldb-webkit] OptionSet summary shows size 0 sometimes for non-empty set 4 https://bugs.webkit.org/show_bug.cgi?id=200742 5 6 Reviewed by Simon Fraser. 7 8 The OptionSet synthetic provider must respond to requests for the value of m_storage 9 (i.e. GetChildMemberWithName('m_storage')) to avoid interfering with the computation 10 of the type summary. 11 12 Synthetic providers substitute alternative debug information (children) for the default 13 information for a variable. The OptionSet type summary is implemented in terms of the 14 OptionSet synthetic provider to maximize code reuse. If LLDB instantiates the provider 15 before invoking the type summary handler then evaluating GetChildMemberWithName() on 16 the SBValue passed to the type summary handler will access the substitute information 17 instead of the original debug information. As a result OptionSet's synthetic provider's 18 get_child_index('m_storage') returns None hence SBValue.GetChildMemberWithName('m_storage') 19 returned an invalid value; => WTFOptionSetProvider._bitmask() returns 0; => the size 20 reported in the type summary for the OptionSet is 0. Instead get_child_index('m_storage') 21 should return a valid value. 22 23 * lldb/lldb_webkit.py: 24 (FlagEnumerationProvider.__init__): 25 (FlagEnumerationProvider): 26 (FlagEnumerationProvider._get_child_index): Added. WTFOptionSetProvider will override. 27 (FlagEnumerationProvider._get_child_at_index): Added. WTFOptionSetProvider will override. 28 (FlagEnumerationProvider.size): Added. 29 (FlagEnumerationProvider.get_child_index): Modified to call _get_child_index(). 30 (FlagEnumerationProvider.get_child_at_index): Modified to call _get_child_at_index(). 31 (FlagEnumerationProvider.update): Moved initialization of self._elements to the constructor 32 and removed self.size. For the latter we can just expose a getter that returns the size of 33 the list self._elements. 34 (WTFOptionSetProvider._get_child_index): Added. Return the index for LLDB to query for the 35 value of m_storage. 36 (WTFOptionSetProvider): 37 (WTFOptionSetProvider._get_child_at_index): Added. Return the value for m_storage if it 38 matches the specified index. 39 1 40 2019-08-21 Alex Christensen <achristensen@webkit.org> 2 41 -
trunk/Tools/lldb/lldb_webkit.py
r246490 r248970 736 736 def __init__(self, valobj, internal_dict): 737 737 self.valobj = valobj 738 self._elements = [] 738 739 self.update() 739 740 … … 751 752 pass 752 753 754 # Subclasses can override this to provide the index that corresponds to the specified name. 755 # If this method is overridden then it is also expected that _get_child_at_index() will be 756 # overridden to provide the value for the index returned by this method. Note that the 757 # returned index must be greater than or equal to self.size in order to avoid breaking 758 # printing of synthetic children. 759 def _get_child_index(self, name): 760 return None 761 762 # Subclasses can override this to provide the SBValue for the specified index. It is only 763 # meaningful to override this method if _get_child_index() is also overridden. 764 def _get_child_at_index(self, index): 765 return None 766 767 @property 768 def size(self): 769 return len(self._elements) 770 771 # LLDB overrides 753 772 def has_children(self): 754 773 return bool(self._elements) … … 758 777 759 778 def get_child_index(self, name): 760 try: 761 return int(name.lstrip('[').rstrip(']')) 762 except: 763 return None 779 return self._get_child_index(name) 764 780 765 781 def get_child_at_index(self, index): … … 769 785 (name, value) = self._elements[index] 770 786 return self.valobj.CreateValueFromExpression(name, str(value)) 771 return None787 return self._get_child_at_index(index) 772 788 773 789 def update(self): 774 790 self._update() 775 776 self._elements = []777 self.size = 0778 791 779 792 enumerator_value_to_name_map = self._enumerator_value_to_name_map() … … 794 807 bitmask = bitmask & (bitmask - 1) # Turn off the rightmost set bit. 795 808 self._elements = elements 796 self.size = len(elements)797 798 809 799 810 class WTFOptionSetProvider(FlagEnumerationProvider): … … 812 823 def _update(self): 813 824 self.storage = self.valobj.GetChildMemberWithName('m_storage') # May be an invalid value. 825 826 def _get_child_index(self, name): 827 if name == 'm_storage': 828 return self.size 829 return None 830 831 def _get_child_at_index(self, index): 832 if index == self.size: 833 return self.storage 834 return None 814 835 815 836
Note: See TracChangeset
for help on using the changeset viewer.