dotfiles

personal dotfiles
git clone anongit@rnpnr.xyz:dotfiles.git
Log | Files | Refs | Feed | Submodules

plugins.py (510B)


      1 import gdb.printing
      2 
      3 
      4 class s8_printer(gdb.ValuePrinter):
      5     def __init__(self, val):
      6         self.val = val
      7 
      8     def to_string(self):
      9         len = self.val["len"]
     10         str = self.val["data"].string(length=len)
     11         return '{data = "%s", len = %s}' % (str, len)
     12 
     13 
     14 def build_pretty_printer():
     15     pp = gdb.printing.RegexpCollectionPrettyPrinter("rnpnr")
     16     pp.add_printer("s8", "s8", s8_printer)
     17     return pp
     18 
     19 
     20 gdb.printing.register_pretty_printer(
     21     gdb.current_objfile(), build_pretty_printer()
     22 )