[PATCH] D73546: Add a few GDB pretty printers for MLIR.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 20:29:42 PST 2020


dblaikie added inline comments.


================
Comment at: mlir/utils/gdb-scripts/prettyprinters.py:21-22
+def get_default_or_struct_printer(val, print_base = True):
+  """Returns gdb.default_visualizer(val) or fall back to StructPrinter."""
+  default_printer = gdb.default_visualizer(val)
+  if default_printer:
----------------
What types would not have a default visualizer/what case is this intended to handle?


================
Comment at: mlir/utils/gdb-scripts/prettyprinters.py:53-54
+  def __call__(self, val):
+    if not self.type:
+      return None
+    return get_default_or_struct_printer(val.cast(self.type))
----------------
When does this code path happen (when does a type's field have a None type?


================
Comment at: mlir/utils/gdb-scripts/prettyprinters.py:64-74
+class IdentifierPrinter:
+  """Prints an mlir::Identifier instance."""
+
+  def __init__(self, val):
+    self.val = val
+
+  def to_string(self):
----------------
Looks easy/simple enough & could be committed separately.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73546/new/

https://reviews.llvm.org/D73546





More information about the llvm-commits mailing list