dotfiles

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

plugins.py (527B)


      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=min(max(len, 0), 64))
     11         return '{len = %d, data = "%s"}' % (len, str)
     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 )