binutils-gdb/gdb/cli
Tom Tromey f6474de9aa Allow use of Pygments to colorize source code
While GNU Source Highlight is good, it's also difficult to build and
distribute.  For one thing, it needs Boost.  For another, it has an
unusual configuration and installation setup.

Pygments, a Python library, doesn't suffer from these issues, and so I
thought it would be a reasonable fallback.

This patch implements this idea.  GNU Source Highlight is preferred,
but if it is unavailable (or fails), the extension languages are
tried.  This patch also implements support for Pygments.

Something similar could be done for Guile, using:

    https://dthompson.us/projects/guile-syntax-highlight.html

However, I don't know enough about Guile internals to make this
happen, so I have not done it here.

gdb/ChangeLog
2020-01-21  Tom Tromey  <tromey@adacore.com>

	* source-cache.c (source_cache::ensure): Call ext_lang_colorize.
	* python/python.c (python_extension_ops): Update.
	(gdbpy_colorize): New function.
	* python/lib/gdb/__init__.py (colorize): New function.
	* extension.h (ext_lang_colorize): Declare.
	* extension.c (ext_lang_colorize): New function.
	* extension-priv.h (struct extension_language_ops) <colorize>: New
	member.
	* cli/cli-style.c (_initialize_cli_style): Update help text.

Change-Id: I5e21623ee05f1f66baaa6deaeca78b578c031bf4
2020-01-21 12:39:17 -07:00
..
cli-cmds.c gdb: add back declarations for _initialize functions 2020-01-13 14:01:38 -05:00
cli-cmds.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-decode.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-decode.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-dump.c gdb: add back declarations for _initialize functions 2020-01-13 14:01:38 -05:00
cli-interp.c gdb: add back declarations for _initialize functions 2020-01-13 14:01:38 -05:00
cli-interp.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-logging.c gdb: add back declarations for _initialize functions 2020-01-13 14:01:38 -05:00
cli-option.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-option.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-script.c gdb: add back declarations for _initialize functions 2020-01-13 14:01:38 -05:00
cli-script.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-setshow.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-setshow.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-style.c Allow use of Pygments to colorize source code 2020-01-21 12:39:17 -07:00
cli-style.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-utils.c Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00
cli-utils.h Update copyright year range in all GDB files. 2020-01-01 10:20:53 +04:00