about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-04-06 17:42:35 +0200
committerGitHub <noreply@github.com>2021-04-06 17:42:35 +0200
commit3d33818a79143d0e82852c8b2ed68abf6b86c095 (patch)
tree8b241bc0ca8518cb00a6d4e465275c5d9cdf8e84
parent2f57dc857553b881a1e65a1b2341d6f7055cb3d9 (diff)
parent3d3a5ca79fa6bbc83ec73a90c9a4337630ff76b2 (diff)
downloadrust-3d33818a79143d0e82852c8b2ed68abf6b86c095.tar.gz
rust-3d33818a79143d0e82852c8b2ed68abf6b86c095.zip
Rollup merge of #83920 - ortem:fix-hashmap-lldb-pretty-printer-1.52, r=pnkfelix
Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0

The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566 after updating hashbrown to 0.11.0.
Note that the corresponding GDB pretty-printer was updated properly.

Fixes #83891
-rw-r--r--src/etc/lldb_providers.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py
index 702f2e82e4e..86dcc335e3c 100644
--- a/src/etc/lldb_providers.py
+++ b/src/etc/lldb_providers.py
@@ -527,20 +527,22 @@ class StdHashMapSyntheticProvider:
     def update(self):
         # type: () -> None
         table = self.table()
-        capacity = table.GetChildMemberWithName("bucket_mask").GetValueAsUnsigned() + 1
-        ctrl = table.GetChildMemberWithName("ctrl").GetChildAtIndex(0)
+        inner_table = table.GetChildMemberWithName("table")
 
-        self.size = table.GetChildMemberWithName("items").GetValueAsUnsigned()
+        capacity = inner_table.GetChildMemberWithName("bucket_mask").GetValueAsUnsigned() + 1
+        ctrl = inner_table.GetChildMemberWithName("ctrl").GetChildAtIndex(0)
+
+        self.size = inner_table.GetChildMemberWithName("items").GetValueAsUnsigned()
         self.pair_type = table.type.template_args[0]
         if self.pair_type.IsTypedefType():
             self.pair_type = self.pair_type.GetTypedefedType()
         self.pair_type_size = self.pair_type.GetByteSize()
 
-        self.new_layout = not table.GetChildMemberWithName("data").IsValid()
+        self.new_layout = not inner_table.GetChildMemberWithName("data").IsValid()
         if self.new_layout:
             self.data_ptr = ctrl.Cast(self.pair_type.GetPointerType())
         else:
-            self.data_ptr = table.GetChildMemberWithName("data").GetChildAtIndex(0)
+            self.data_ptr = inner_table.GetChildMemberWithName("data").GetChildAtIndex(0)
 
         u8_type = self.valobj.GetTarget().GetBasicType(eBasicTypeUnsignedChar)
         u8_type_size = self.valobj.GetTarget().GetBasicType(eBasicTypeUnsignedChar).GetByteSize()
@@ -563,7 +565,7 @@ class StdHashMapSyntheticProvider:
             # HashSet wraps either std HashMap or hashbrown::HashSet, which both
             # wrap hashbrown::HashMap, so either way we "unwrap" twice.
             hashbrown_hashmap = self.valobj.GetChildAtIndex(0).GetChildAtIndex(0)
-        return hashbrown_hashmap.GetChildMemberWithName("table").GetChildMemberWithName("table")
+        return hashbrown_hashmap.GetChildMemberWithName("table")
 
     def has_children(self):
         # type: () -> bool