Skip to content

Commit

Permalink
Some debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Nov 11, 2020
1 parent 9053cfb commit 5e33d9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lldb_lookup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import lldb

import sys
from lldb_providers import *
from rust_types import RustType, classify_struct, classify_union

Expand All @@ -23,6 +24,7 @@ def summary_lookup(valobj, dict):
# type: (SBValue, dict) -> str
"""Returns the summary provider for the given value"""
rust_type = classify_rust_type(valobj.GetType())
print('summary_lookup rust_type=%r' % (rust_type,), file=sys.stderr)

if rust_type == RustType.STD_STRING:
return StdStringSummaryProvider(valobj, dict)
Expand Down Expand Up @@ -62,6 +64,7 @@ def synthetic_lookup(valobj, dict):
# type: (SBValue, dict) -> object
"""Returns the synthetic provider for the given value"""
rust_type = classify_rust_type(valobj.GetType())
print('synthetic_lookup rust_type=%r' % (rust_type,), file=sys.stderr)

if rust_type == RustType.STRUCT:
return StructSyntheticProvider(valobj, dict)
Expand All @@ -88,6 +91,7 @@ def synthetic_lookup(valobj, dict):

if rust_type == RustType.STD_HASH_MAP:
if is_hashbrown_hashmap(valobj):
print('is_hashbrown', file=sys.stderr)
return StdHashMapSyntheticProvider(valobj, dict)
else:
return StdOldHashMapSyntheticProvider(valobj, dict)
Expand Down
8 changes: 8 additions & 0 deletions lldb_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,20 @@ def __init__(self, valobj, dict, is_variant=False):

def num_children(self):
# type: () -> int
print('tuple num_children=%r' % (self.size,), file=sys.stderr)
return self.size

def get_child_index(self, name):
# type: (str) -> int
print('tuple get_child_index=%r' % (name,), file=sys.stderr)
if name.isdigit():
return int(name)
else:
return -1

def get_child_at_index(self, index):
# type: (int) -> SBValue
print('tuple get_child_at_index=%r' % (index,), file=sys.stderr)
if self.is_variant:
field = self.type.GetFieldAtIndex(index + 1)
else:
Expand Down Expand Up @@ -500,10 +503,12 @@ def __init__(self, valobj, dict, show_values=True):

def num_children(self):
# type: () -> int
print('num_children=%r' % (self.size,), file=sys.stderr)
return self.size

def get_child_index(self, name):
# type: (str) -> int
print('get_child_index %r' % (name,), file=sys.stderr)
index = name.lstrip('[').rstrip(']')
if index.isdigit():
return int(index)
Expand All @@ -512,6 +517,7 @@ def get_child_index(self, name):

def get_child_at_index(self, index):
# type: (int) -> SBValue
print('get_child_at_index %r' % (index,), file=sys.stderr)
pairs_start = self.data_ptr.GetValueAsUnsigned()
idx = self.valid_indices[index]
if self.new_layout:
Expand All @@ -526,6 +532,7 @@ def get_child_at_index(self, index):

def update(self):
# type: () -> None
print('update', file=sys.stderr)
table = self.table()
capacity = table.GetChildMemberWithName("bucket_mask").GetValueAsUnsigned() + 1
ctrl = table.GetChildMemberWithName("ctrl").GetChildAtIndex(0)
Expand Down Expand Up @@ -554,6 +561,7 @@ def update(self):

def table(self):
# type: () -> SBValue
print('table', file=sys.stderr)
if self.show_values:
hashbrown_hashmap = self.valobj.GetChildMemberWithName("base")
else:
Expand Down

0 comments on commit 5e33d9d

Please sign in to comment.