Add support for enabling/disabling individual pretty-printers.

* python/py-prettyprint.c (search_pp_list): Skip disabled printers.
	* python/python-internal.h (gdbpy_enabled_cst): Declare.
	* python/python.c (gdbpy_enabled_cst): Define.
	(_initialize_python): Initialize gdbpy_enabled_cst.
	* NEWS: Add entry.

	doc/
	* gdb.texinfo (Python API): New node `Disabling Pretty-Printers'.

	testsuite/
	* gdb.python/py-prettyprint.exp: Add new test for enabled and
	disabled printers.
	* gdb.python/py-prettyprint.py (disable_lookup_function): New function.
	(enable_lookup_function): New function.
This commit is contained in:
Doug Evans 2010-06-04 18:18:28 +00:00
parent 2dec564e91
commit 967cf47793
10 changed files with 102 additions and 5 deletions

View file

@ -194,6 +194,11 @@ def lookup_function (val):
return None
def disable_lookup_function ():
lookup_function.enabled = False
def enable_lookup_function ():
lookup_function.enabled = True
def register_pretty_printers ():
pretty_printers_dict[re.compile ('^struct s$')] = pp_s