diff --git a/sdb/command.py b/sdb/command.py index fd69c82..017f98c 100644 --- a/sdb/command.py +++ b/sdb/command.py @@ -587,9 +587,9 @@ def _help_message(input_type: drgn.Type = None) -> str: if input_type is not None: msg += f"no walker found for input of type {input_type}\n" msg += "The following types have walkers:\n" - msg += f"\t{'WALKER':-20s} {'TYPE':-20s}\n" + msg += f"\t{'WALKER':<20s} {'TYPE':<20s}\n" for type_, class_ in Walker.allWalkers.items(): - msg += f"\t{class_.names[0]:-20s} {type_:-20s}\n" + msg += f"\t{class_.names[0]:<20s} {type_:<20s}\n" return msg def _call(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: diff --git a/sdb/commands/linux/process.py b/sdb/commands/linux/process.py index 25ac983..80c798f 100644 --- a/sdb/commands/linux/process.py +++ b/sdb/commands/linux/process.py @@ -22,6 +22,8 @@ import drgn import sdb +from drgn.helpers.linux.pid import find_pid, find_task + class FindPid(sdb.Command): """ @@ -56,7 +58,7 @@ def _init_parser(cls, name: str) -> argparse.ArgumentParser: def _call(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: for pid in self.args.pid: - yield drgn.helpers.linux.pid.find_pid(sdb.get_prog(), pid) + yield find_pid(sdb.get_prog(), pid) class FindTask(sdb.Command): @@ -87,4 +89,4 @@ def _init_parser(cls, name: str) -> argparse.ArgumentParser: def _call(self, objs: Iterable[drgn.Object]) -> Iterable[drgn.Object]: for pid in self.args.pid: - yield drgn.helpers.linux.pid.find_task(sdb.get_prog(), pid) + yield find_task(sdb.get_prog(), pid) diff --git a/sdb/commands/spl/spl_kmem_caches.py b/sdb/commands/spl/spl_kmem_caches.py index ff41743..639d3ea 100644 --- a/sdb/commands/spl/spl_kmem_caches.py +++ b/sdb/commands/spl/spl_kmem_caches.py @@ -212,7 +212,7 @@ class SplKmemCacheWalker(sdb.Walker): EXAMPLES Print all the objects in the ddt_cache: - sdb> spl_kmem_caches | filter obj.skc_name == "ddt_cache" | spl_cache + sdb> spl_kmem_caches | filter 'obj.skc_name == "ddt_cache"' | spl_cache (void *)0xffffa08937e80040 (void *)0xffffa08937e86180 (void *)0xffffa08937e8c2c0 diff --git a/sdb/commands/zfs/btree.py b/sdb/commands/zfs/btree.py index fd170a7..4b5798d 100644 --- a/sdb/commands/zfs/btree.py +++ b/sdb/commands/zfs/btree.py @@ -66,8 +66,17 @@ def _helper(self, node: drgn.Object) -> Iterable[drgn.Object]: if not node: return + # + # We check both members of the node because of the change introdcued in + # https://github.com/delphix/zfs/commit/c0bf952c846100750f526c2a32ebec17694a201b + # + try: + recurse = int(node.bth_first) == -1 + except AttributeError: + recurse = node.bth_core + count = node.bth_count - if node.bth_core: + if recurse: # alterate recursive descent on the children and generating core objects core = drgn.cast('struct zfs_btree_core *', node) for i in range(count):