Skip to content

Commit 27add1b

Browse files
Move load function to main file and rename it
1 parent 3ad2a27 commit 27add1b

File tree

3 files changed

+15
-26
lines changed

3 files changed

+15
-26
lines changed

scripts/pretty-printers/gdb/auto_load.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

scripts/pretty-printers/gdb/install.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
pretty_printer_folder = '{0}'
1313
if os.path.exists(pretty_printer_folder):
1414
sys.path.insert(1, pretty_printer_folder)
15-
import auto_load
16-
auto_load.load_pretty_printers()
15+
from pretty_printers import load_cbmc_printers
16+
load_cbmc_printers()
1717
end
1818
"""
1919

scripts/pretty-printers/gdb/pretty_printers.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,16 @@ def to_string(self):
4646

4747
def display_hint(self):
4848
return 'string'
49+
50+
51+
# If you change the name of this make sure to change install.py too.
52+
def load_cbmc_printers():
53+
printers = gdb.printing.RegexpCollectionPrettyPrinter("CBMC")
54+
55+
# First argument is the name of the pretty-printer, second is a regex match for which type
56+
# it should be applied too, third is the class that should be called to pretty-print that type.
57+
printers.add_printer('irep_idt', '^irep_idt', DStringPrettyPrinter)
58+
printers.add_printer('dstringt', '^dstringt', DStringPrettyPrinter)
59+
printers.add_printer('instructiont', '^goto_programt::instructiont', InstructionPrettyPrinter)
60+
# We aren't associating with a particular object file, so pass in None instead of gdb.current_objfile()
61+
gdb.printing.register_pretty_printer(None, printers, replace=True)

0 commit comments

Comments
 (0)