diff --git a/llvm/utils/gdb-scripts/prettyprinters.py b/llvm/utils/gdb-scripts/prettyprinters.py --- a/llvm/utils/gdb-scripts/prettyprinters.py +++ b/llvm/utils/gdb-scripts/prettyprinters.py @@ -386,6 +386,9 @@ yield ('pointer', self.pointer) yield ('value', self.value) + def to_string(self): + return '(%s, %s)' % self.pointer.type, self.value.type + def make_pointer_int_pair_printer(val): """Factory for an llvm::PointerIntPair printer.""" try: diff --git a/mlir/utils/gdb-scripts/prettyprinters.py b/mlir/utils/gdb-scripts/prettyprinters.py --- a/mlir/utils/gdb-scripts/prettyprinters.py +++ b/mlir/utils/gdb-scripts/prettyprinters.py @@ -16,6 +16,8 @@ else: yield field.name, self.val[field.name] + def to_string(self): + return 'mlir::Storage' class TupleTypeStoragePrinter(StoragePrinter): @@ -27,6 +29,8 @@ for i in range(self.val['numElements']): yield 'elements[%u]' % i, elements[i] + def to_string(self): + return 'mlir::TupleTypeStorage of %u elements' % self.val['numElements'] class FusedLocationStoragePrinter(StoragePrinter): @@ -38,6 +42,9 @@ for i in range(self.val['numLocs']): yield 'locs[%u]' % i, elements[i] + def to_string(self): + return 'mlir::FusedLocationStorage of %u locs' % self.val['numLocs'] + class StorageTypeMap: """Maps a TypeID to the corresponding concrete type. @@ -105,7 +112,10 @@ def children(self): yield 'typeID', self.type_id - yield 'cast<%s>(impl)' % self.impl.type, self.impl + yield 'impl', self.impl + + def to_string(self): + return 'cast<%s>' % self.impl.type if not val['impl']: return None @@ -125,10 +135,15 @@ """Printer for an instance with a single 'impl' member pointer.""" def __init__(self, val): + self.val = val self.impl = val['impl'] def children(self): - yield 'impl', (self.impl.dereference() if self.impl else self.impl) + if self.impl: + yield 'impl', self.impl.dereference() + + def to_string(self): + return self.val.type.name # Printers of types deriving from Attribute::AttrBase or Type::TypeBase.