Bug 1481577 - make nsTHashtable pretty-printer aware of naming changes; r=tromey
authorNathan Froyd <froydnj@mozilla.com>
Mon, 26 Nov 2018 13:16:13 -0500
changeset 507237 73de720af49df25489f2f47a84c14725e326478c
parent 507236 8a7a03bc253d12664de2a396b2483187499af996
child 507238 73cac4fab2def41df759926fe8e6fe8564c27610
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstromey
bugs1481577
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1481577 - make nsTHashtable pretty-printer aware of naming changes; r=tromey kHashBits was renamed to mozilla::kHashNumberBits, which seems awkward to access from the pretty-printer. So we compute its value from the HashNumber type instead.
third_party/python/gdbpp/gdbpp/thashtable.py
--- a/third_party/python/gdbpp/gdbpp/thashtable.py
+++ b/third_party/python/gdbpp/gdbpp/thashtable.py
@@ -99,19 +99,21 @@ class thashtable_printer(object):
 
         # mEntryCount is the number of occupied slots/entries in the table.
         # We can use this to avoid doing wasted memory reads.
         entryCount = table['mEntryCount']
         if entryCount == 0:
             return
 
         # The table capacity is tracked "cleverly" in terms of how many bits
-        # the hash needs to be shifted.  CapacityFromHashShift calculates the
-        # actual entry capacity via ((uint32_t)1 << (kHashBits - mHashShift));
-        capacity = 1 << (table['kHashBits'] - table['mHashShift'])
+        # the hash needs to be shifted.  CapacityFromHashShift calculates this
+        # quantity, but may be inlined, so we replicate the calculation here.
+        hashType = gdb.lookup_type('mozilla::HashNumber')
+        hashBits = hashType.sizeof * 8
+        capacity = 1 << (hashBits - table['mHashShift'])
 
         # Pierce generation-tracking EntryStore class to get at buffer.  The
         # class instance always exists, but this char* may be null.
         store = table['mEntryStore']['mEntryStore']
 
         key_field_name = self.key_field_name
 
         seenCount = 0