diff options
Diffstat (limited to 'buildscripts/gdb')
| -rw-r--r-- | buildscripts/gdb/mongo.py | 2 | ||||
| -rw-r--r-- | buildscripts/gdb/mongo_printers.py | 78 |
2 files changed, 1 insertions, 79 deletions
diff --git a/buildscripts/gdb/mongo.py b/buildscripts/gdb/mongo.py index ea3bf3c45d9..2e1106bf121 100644 --- a/buildscripts/gdb/mongo.py +++ b/buildscripts/gdb/mongo.py @@ -69,7 +69,7 @@ def get_current_thread_name(): fallback_name = '"%s"' % (gdb.selected_thread().name or '') try: # This goes through the pretty printer for StringData which adds "" around the name. - name = str(gdb.parse_and_eval("mongo::getThreadName()")) + name = str(gdb.parse_and_eval("mongo::ThreadName::getStaticString()")) if name == '""': return fallback_name return name diff --git a/buildscripts/gdb/mongo_printers.py b/buildscripts/gdb/mongo_printers.py index ae02a085b83..fe9727447ea 100644 --- a/buildscripts/gdb/mongo_printers.py +++ b/buildscripts/gdb/mongo_printers.py @@ -1,19 +1,12 @@ """GDB Pretty-printers for MongoDB.""" -import os import re import struct import sys import uuid -from pathlib import Path import gdb.printing -ROOT_PATH = str(Path(os.path.abspath(__file__)).parent.parent.parent) -if ROOT_PATH not in sys.path: - sys.path.insert(0, ROOT_PATH) -from src.third_party.immer.dist.tools.gdb_pretty_printers.printers import ListIter as ImmerListIter # pylint: disable=wrong-import-position - try: import bson import bson.json_util @@ -578,75 +571,6 @@ class AbslFlatHashMapPrinter(AbslHashMapPrinterBase): yield ('value', kvp['value']) -class ImmutableMapIter(ImmerListIter): - """Iterator for mongo::immutable::map.""" - - def __init__(self, val): - """Initialize iterator for mongo::immutable::map.""" - super().__init__(val) - self.max = (1 << 64) - 1 - self.pair = None - self.curr = (None, self.max, self.max) - - def __next__(self): - """Advance iterator for mongo::immutable::map and return current element.""" - if self.pair: - result = ('value', self.pair['second']) - self.pair = None - self.i += 1 - return result - if self.i == self.size: - raise StopIteration - if self.i < self.curr[1] or self.i >= self.curr[2]: - self.curr = self.region() - self.pair = self.curr[0][self.i - self.curr[1]].cast( - gdb.lookup_type(self.v.type.template_argument(0).name)) - result = ('key', self.pair['first']) - return result - - -class ImmutableMapPrinter: - """Pretty-printer for mongo::immutable::map.""" - - def __init__(self, val): - """Initialize pretty-printer for mongo::immutable::map.""" - self.val = val - - def to_string(self): - """Print top-level information about map.""" - return '%s of size %d' % (self.val.type, int(self.val['_storage']['impl_']['size'])) - - def children(self): - """Initialize iterator to actual elements of map.""" - return ImmutableMapIter(self.val['_storage']) - - @staticmethod - def display_hint(): - """Ensure map is displayed as map in gdb.""" - return 'map' - - -class ImmutableSetPrinter: - """Pretty-printer for mongo::immutable::set.""" - - def __init__(self, val): - """Initialize pretty-printer for mongo::immutable::set.""" - self.val = val - - def to_string(self): - """Print top-level information about set.""" - return '%s of size %d' % (self.val.type, int(self.val['_storage']['impl_']['size'])) - - def children(self): - """Initialize iterator to actual elements of set.""" - return ImmerListIter(self.val['_storage']) - - @staticmethod - def display_hint(): - """Ensure set is displayed as array in gdb.""" - return 'array' - - def find_match_brackets(search, opening='<', closing='>'): """Return the index of the closing bracket that matches the first opening bracket. @@ -957,8 +881,6 @@ def build_pretty_printer(): pp.add('__wt_txn', '__wt_txn', False, WtTxnPrinter) pp.add('__wt_update', '__wt_update', False, WtUpdateToBsonPrinter) pp.add('CodeFragment', 'mongo::sbe::vm::CodeFragment', False, SbeCodeFragmentPrinter) - pp.add('immutable::map', 'mongo::immutable::map', True, ImmutableMapPrinter) - pp.add('immutable::set', 'mongo::immutable::set', True, ImmutableSetPrinter) # TODO: enable with SERVER-62044. # Optimizer/ABT related pretty printers that can be used only with a running process. |
