<div dir="ltr">I've added a few LLVM GDB pretty printers a while back (& just added llvm::Optional earlier today) & thought people might be interested in how to use them, etc.<br><br>I use them by adding the following to my .gdbinit:<br><font face="monospace"><br>  source /path/to/llvm/src/utils/gdb-scripts/prettyprinters.py</font><br><br>Also, I can suggest adding:<br><br><font face="monospace">  set print pretty on</font><br><br>there too, it helps a lot when printing complex nested data structures.<br><br>Once you have that, you can get pretty output like this:<br><br><div><font face="monospace">(gdb) p Abbrev->AbbrDeclSets</font></div><div><font face="monospace">$1 = std::map with 1 elements = {</font></div><div><font face="monospace">  [0] = {</font></div><div><font face="monospace">    Offset = 0,</font></div><div><font face="monospace">    FirstAbbrCode = 1,</font></div><div><font face="monospace">    Decls = std::vector of length 1, capacity 1 = {{</font></div><div><font face="monospace">        Code = 1,</font></div><div><font face="monospace">        Tag = llvm::dwarf::Tag::DW_TAG_compile_unit,</font></div><div><font face="monospace">        CodeByteSize = 1 '\001',</font></div><div><font face="monospace">        HasChildren = false,</font></div><div><font face="monospace">        AttributeSpecs = llvm::SmallVector of length 8, capacity 8 = {{</font></div><div><font face="monospace">            Attr = llvm::dwarf::Attribute::DW_AT_low_pc,</font></div><div><font face="monospace">            Form = llvm::dwarf::Form::DW_FORM_addr,</font></div><div><font face="monospace">            ByteSize = llvm::Optional is not initialized</font></div><div><font face="monospace">          }, {</font></div><div><font face="monospace">            Attr = llvm::dwarf::Attribute::DW_AT_high_pc,</font></div><div><font face="monospace">            Form = llvm::dwarf::Form::DW_FORM_data8,</font></div><div><font face="monospace">            ByteSize = llvm::Optional is initialized = {</font></div><div><font face="monospace">              value = 8 '\b'</font></div><div><font face="monospace">            }</font><br><br>Here you can see the pretty printers for SmallVector and Optional, but there's also support for StringRef, SmallString, and ArrayRef.<br><br>I've tried doing a DenseMap pretty printer, but haven't quite figured it out yet (having trouble calling member functions to do some of teh more complicated parts of DenseMap iteration - may end up printing it with the tombstone/empty values present, but not sure how easy that'll be to read, etc). Happy to take requests or talk people through adding more pretty printers anyone wants to add :)<br><br>Enjoy!<br>- Dave</div></div>