From 2533cfb000ccf46174edd4cf9d99b19768e6fb00 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 20 Oct 2013 12:06:34 -0700 Subject: Fix gdb python stuff --- src/main-gdb-head.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main-gdb-head.py') diff --git a/src/main-gdb-head.py b/src/main-gdb-head.py index cfdce2b..394b6d7 100644 --- a/src/main-gdb-head.py +++ b/src/main-gdb-head.py @@ -7,11 +7,16 @@ # This lets us enumerate what *we* added. initial_globals = set(globals()) +import re + def finish(): - diff = set(globals()) - initial_globals + global finish, initial_globals, FastPrinters + + diff = set(globals()) - initial_globals \ + - {'finish', 'initial_globals', 'FastPrinters'} fp = FastPrinters() + # After this, don't access any more globals in this function. - global finish, initial_globals, FastPrinters del finish, initial_globals, FastPrinters for k in diff: @@ -20,6 +25,8 @@ def finish(): fp.add_printer(v) gdb.current_objfile().pretty_printers.append(fp) + print('Added %d custom printers for %s' + % (len(fp.printers), gdb.current_objfile().filename)) class FastPrinters(object): ''' printer dispatch the way gdb *should* have done it -- cgit v1.2.3-60-g2f50