Gdb pretty printers for UE4 classes

Are there already some gdb pretty printers for UE4 classes avaiable?

I was able to extend my .gdbinit with the following script, so I now can at least inspect FStrings directly:

python

import gdb
import gdb.printing

class FStringPrinter(object):
    "Print a FString"

    def __init__(self, val):
        self.val = val

    def to_string(self):
        dataAsCharPointer = self.val['Data']['AllocatorInstance']['Data'].cast(gdb.lookup_type("char").pointer())
        size = self.val['Data']['ArrayNum']
        return dataAsCharPointer.string(encoding = 'UTF-32', length = size * 4 )

    def display_hint(self):
        return 'string'


def build_pretty_printer():
    pp = gdb.printing.RegexpCollectionPrettyPrinter( "UE4 Pretty Printers" )
    pp.add_printer('FString', '^FString$', FStringPrinter)
    return pp

gdb.printing.register_pretty_printer( gdb.current_objfile(), build_pretty_printer(), True )

But since I have little expertise in Python and GDBs API to it. any hints to a gdb initialization script covering more UE4 classes would a great help.

Kind regards and thanks in advance for any advice.

Right now there are none, but we are working on them and they will be added for 4.17 (you may be able to pick them up earlier from the master branch on GitHub). Stay tuned :slight_smile:

In case someone will be revisiting this post, pretty printers for GDB and LLDB are here:

These should also be automatically exported into ~/ after running Setup.