Adding PrintAssembly method for new custom dialect ops

I have defined a custom dialect in tablegen and added a new operation in the dialect. Can someone point me to where I can find examples to specialize print method needed for PrintAssembly to emit the mlir containing instances of these new ops ? The default print seems to lead to a segfault in the OperationPrinter::printGenericOp(…) method (in particular when it calls ModulePrinter::printOptionalAttrDict(…)). I do have few attributes defined as part of the operation - wondering if printer needs to be taught about these ?


printGenericOp should always work, if it fails it likely mean that the IR in memory isn’t correct. This isn’t something you can or should try to fix with a custom printer.
I would try to debug the source of the crash and understand it first.