示例#1
0
def register_dealii_printers():
    """Register deal.II pretty-printers with gdb."""
    printers = {
        AlignedVectorPrinter: ['AlignedVector'],
        PointPrinter: ['Point'],
        TensorPrinter: ['Tensor'],
        VectorPrinter: ['Vector'],
        TriaIteratorPrinter:
        ['TriaRawIterator', 'TriaIterator', 'TriaActiveIterator'],
        QuadraturePrinter:
        ['Quadrature', 'QGauss', 'QGaussLobatto', 'QMidpoint', 'QSimpson',
         'QTrapezoid',
         # The following name has been deprecated in deal.II 9.3 and can
         # be removed at a later time.
         'QTrapez',
         'QMilne', 'QWeddle', 'QGaussLog', 'QGaussLogR',
         'QGaussOneOverR', 'QSorted', 'QTelles', 'QGaussChebyshev',
         'QGaussRadauChebyshev', 'QIterated', 'QAnisotropic']
    }
    for printer, class_names in printers.items():
        for class_name in class_names:
            dealii_printer.add('dealii::' + class_name, printer)
    try:
        from gdb import printing
        printing.register_pretty_printer(gdb, dealii_printer)
    except ImportError:
        gdb.pretty_printers.append(dealii_printer)
示例#2
0
def register_dealii_printers():
    """Register deal.II pretty-printers with gdb."""
    printers = {
        PointPrinter: ['Point'],
        TensorPrinter: ['Tensor'],
        VectorPrinter: ['Vector'],
        TriaIteratorPrinter:
        ['TriaRawIterator', 'TriaIterator', 'TriaActiveIterator'],
        QuadraturePrinter:
        ['Quadrature', 'QGauss', 'QGaussLobatto', 'QMidpoint', 'QSimpson',
         'QTrapez', 'QMilne', 'QWeddle', 'QGaussLog', 'QGaussLogR',
         'QGaussOneOverR', 'QSorted', 'QTelles', 'QGaussChebyshev',
         'QGaussRadauChebyshev', 'QIterated', 'QAnisotropic']
    }
    for printer, class_names in printers.items():
        for class_name in class_names:
            dealii_printer.add('dealii::' + class_name, printer)
    try:
        from gdb import printing
        printing.register_pretty_printer(gdb, dealii_printer)
    except ImportError:
        gdb.pretty_printers.append(dealii_printer)
示例#3
0
        if not found:
            gdb.Breakpoint (i)
            pass
        pass
    return

# Quit if not in gcc


TreeDebug()
TreeGenericExpr()
GimpleDebug()
RtxDebug()
CgnDebug()

VecGetLength()
VecGetItem()
register_pretty_printer(gdb.current_objfile(), TreePrettyPrinter(), True)
register_pretty_printer(gdb.current_objfile(), SymtabPrinterDispatcher(), True)
    
CgraphNodeCountCallers()
CgraphNodeCountCallees()
register_pretty_printer(gdb.current_objfile(), IPAPropPrinterDispatcher(),
                        True)

set_basic_breakpoints()

gdb.execute("set unwindonsignal on")
gdb.execute("skip file tree.h")
gdb.execute("set check type off")
示例#4
0
    @property
    def contents_visualizer(self):
        return obj


def _build_pretty_printer():
    pp = CxxCollectionPrettyPrinter("Bee-DMR")
    pp.add_printer("HeapObject::SmallHeader", '^HeapObject::SmallHeader', None)
    pp.add_printer("HeapObject::LargeHeader", '^HeapObject::LargeHeader', None)
    pp.add_printer("HeapObject", "^HeapObject", oop)
    pp.add_printer("Object", "^Object", oop)
    return pp


register_pretty_printer(gdb, _build_pretty_printer(), replace=True)


#
# Frame Decorators
#
class FrameDecorator(gdb.FrameDecorator.FrameDecorator):
    def __init__(self, base_frame, symbol):
        super().__init__(base_frame)
        self.symbol = symbol

    def function(self):
        return self.symbol.name


class FrameFilter(object):
示例#5
0
    def ParseList(self, head, type, offset):
        ll_p = head
        while ll_p != 0:
            element = ll_p.cast(gdb.lookup_type("uint8_t").pointer()) - offset
            print("Found element at address 0x%08x, printing:" % element)
            gdb.execute("p *(%s)0x%x" % (type.pointer(), element))
            ll_p = ll_p.dereference()["next"]


class CustomPrettyPrinterLocator(PrettyPrinter):
    """Given a gdb.Value, search for a custom pretty printer"""
    def __init__(self):
        super(CustomPrettyPrinterLocator,
              self).__init__("Cortex-M Scheduler Pretty Printers", [])

    def __call__(self, val):
        """Return the custom formatter if the type can be handled"""

        typename = gdb.types.get_basic_type(val.type).tag
        if typename is None:
            typename = val.type.name

        if typename == "Popcorn::task_control_block":
            return TCBPrettyPrinter(val)


if __name__ == "__main__":
    register_pretty_printer(None, CustomPrettyPrinterLocator(), replace=True)
    LinkedListParser()
示例#6
0
import re

from gnatdbg.printers import GDBPrettyPrinters, PrettyPrinter
from gnatdbg.generics import Match
from gdb.printing import register_pretty_printer


class TimePrettyPrinter(PrettyPrinter):
    name = "main.time"
    type_pattern = Match.TypeName(
        name=re.compile('universal_calendar__(T?)time(B?).*'),
        recursive=True,
        match_pretty_name=False,
    )

    def to_string(self):
        return 'time'


printers = GDBPrettyPrinters('custom')
printers.append(TimePrettyPrinter)
register_pretty_printer(None, printers)
示例#7
0
文件: efi_gdb.py 项目: tianocore/edk2
        # keep running
        return False


# Get python backtraces to debug errors in this script
gdb.execute("set python print-stack full")

# tell efi_debugging how to walk data structures with pointers
try:
    pointer_width = gdb.lookup_type('int').pointer().sizeof
except ValueError:
    pointer_width = 8
patch_ctypes(pointer_width)

register_pretty_printer(None, build_pretty_printer(), replace=True)

# gdb commands that we are adding
# add `efi` prefix gdb command
EfiCmd()

# subcommands for `efi`
EfiSymbolsCmd()
EfiTablesCmd()
EfiHobCmd()
EfiDevicePathCmd()
EfiGuidCmd()

#
bp = LoadEmulatorEfiSymbols('SecGdbScriptBreak', internal=True)
if bp.pending: