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

from .vector import KstdVectorPrinter
from .string import KstdStringPrinter
from .std_types import StdBytePrinter


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("std_byte", "^std::byte$", StdBytePrinter)
    return pp


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