From 1cd9ec952fc5fb1c38eec61ba23e506ea21d97e1 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 23 Mar 2021 13:07:38 +0300 Subject: [PATCH] gdb: Show address of the row::_cells tree (or "empty" mark) Currently clang optimizes-out lots of critical stuff from compact radix tree. Untill we find out the way to walk the tree in gdb, it's better to at least show where it is in memory. Signed-off-by: Pavel Emelyanov --- scylla-gdb.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scylla-gdb.py b/scylla-gdb.py index b2d17ac572..01b440bc9c 100644 --- a/scylla-gdb.py +++ b/scylla-gdb.py @@ -151,6 +151,19 @@ class intrusive_set: yield n +class compact_radix_tree: + def __init__(self, ref): + self.root = ref['_root']['_v'] + + def to_string(self): + if self.root['_base_layout'] == 0: + return '' + + # Compiler optimizes-away lots of critical stuff, so + # for now just show where the tree is + return 'compact radix tree @ 0x%x' % self.root + + class intrusive_btree: def __init__(self, ref): container_type = ref.type.strip_typedefs() @@ -657,7 +670,7 @@ class row_printer(gdb.printing.PrettyPrinter): def __init__(self, val): self.val = val - def to_string(self): + def __to_string_legacy(self): if self.val['_type'] == gdb.parse_and_eval('row::storage_type::vector'): cells = str(self.val['_storage']['vector']) elif self.val['_type'] == gdb.parse_and_eval('row::storage_type::set'): @@ -666,6 +679,12 @@ class row_printer(gdb.printing.PrettyPrinter): raise Exception('Unsupported storage type: ' + self.val['_type']) return '{type=%s, cells=%s}' % (self.val['_type'], cells) + def to_string(self): + try: + return '{cells=[%s]}' % compact_radix_tree(self.val['_cells']).to_string() + except gdb.error: + return self.__to_string_legacy() + def display_hint(self): return 'row'