aboutsummaryrefslogtreecommitdiff
path: root/libs/kstd/gdb/__init__.py
blob: 2d615398d71d02e2a508b1608fc6d1186c173183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gdb.printing

from .vector import KstdVectorPrinter
from .string import KstdStringPrinter
from .smart_pointers import KstdUniquePtrPrinter, KstdSharedPtrPrinter


def build_pretty_printers():
    pp = gdb.printing.RegexpCollectionPrettyPrinter("kstd")
    pp.add_printer("vector", "^kstd::vector<.*>$", KstdVectorPrinter)
    pp.add_printer("string", "^kstd::string$", KstdStringPrinter)
    pp.add_printer("unique_ptr", "^kstd::unique_ptr<.*>$", KstdUniquePtrPrinter)
    pp.add_printer("shared_ptr", "^kstd::shared_ptr<.*>$", KstdSharedPtrPrinter)
    return pp


def register_printers(objfile):
    gdb.printing.register_pretty_printer(objfile, build_pretty_printers(), replace=True)