PR python/18299

gdb/ChangeLog:

	PR python/18299
	* python/lib/gdb/printing.py (register_pretty_printer): Handle
	name or __name__ attributes.  Handle gdb module as first argument.

gdb/testsuite/ChangeLog:

	* gdb.python/py-pp-maint.py: Move "replace" testing to ...
	* gdb.python/py-pp-registration.exp: ... here.  New file.
	* gdb.python/py-pp-registration.c: New file.
	* gdb.python/py-pp-registration.py: New file.
This commit is contained in:
Doug Evans 2015-04-28 22:14:23 -07:00
parent 69b4374a87
commit 34f5f757b3
7 changed files with 273 additions and 14 deletions

View file

@ -76,14 +76,3 @@ def build_pretty_printer():
gdb.printing.register_pretty_printer(gdb, lookup_function_lookup_test)
my_pretty_printer = build_pretty_printer()
gdb.printing.register_pretty_printer(gdb, my_pretty_printer)
# Exercise the "replace" argument to register pretty_printer.
saw_runtime_error = False
try:
gdb.printing.register_pretty_printer(gdb, my_pretty_printer, replace=False)
except RuntimeError:
saw_runtime_error = True
pass
if not saw_runtime_error:
raise RuntimeError("Missing RuntimeError from register_pretty_printer")
gdb.printing.register_pretty_printer(gdb, my_pretty_printer, replace=True)