I have no idea what I'm doing
pig-gdb.py:
import gdb
def real_to_string(self):
    # print self.val
    return self.val['list']['items'].string()
def real_lookup_type(val):
    # print val.type
    # print 'fsjodifsiohfiosehfoshifhioehsfihseiofhs'
    if str(val.type) == 'Buf':
        print '!!!!!!!!!!!!!!!!!!!!!!!'
        return BufPrinter(val)
    else:
        print '======================='
    return None
class BufPrinter:
    def __init__(self, val):
        self.val = val
    def to_string(self):
        return real_to_string(self)
def lookup_type (val):
    return real_lookup_type(val)
gdb.pretty_printers.append(lookup_type)
python execfile("pig-gdb.py")
Spam this until it works:
p.py:
def real_to_string(self):
    # print self.val
    return '"' + self.val['list']['items'].string() + '"'
def real_lookup_type(val):
    # print val.type
    # print 'fsjodifsiohfiosehfoshifhioehsfihseiofhs'
    if str(val.type) == 'Buf':
        # print '!!!!!!!!!!!!!!!!!!!!!!!'
        return BufPrinter(val)
    # else:
    #     print '=======================>'
    #     print val.type
    #     print '<======================='
    return None
This worked, but for some reason it doesn't autoload. Well, I guess copypasting an extra line at every debug session isn't that bad. Any ideas?