diff options
author | Tom Tromey <tom@tromey.com> | 2018-10-09 22:21:05 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-12-28 12:49:54 -0700 |
commit | 62f29fda90cf1d5a1899f57ef78452471c707fd6 (patch) | |
tree | 4d2e519c41de4248f7b4f169f8f379f73f3f0a51 /gdb/cli | |
parent | 4a3045920bbe4e50a0f4920b0fdc4e88ef23015c (diff) | |
download | fsf-binutils-gdb-62f29fda90cf1d5a1899f57ef78452471c707fd6.zip fsf-binutils-gdb-62f29fda90cf1d5a1899f57ef78452471c707fd6.tar.gz fsf-binutils-gdb-62f29fda90cf1d5a1899f57ef78452471c707fd6.tar.bz2 |
Highlight source code using GNU Source Highlight
This changes gdb to highlight source using GNU Source Highlight, if it
is available.
This affects the output of the "list" command and also the TUI source
window.
No new test because I didn't see a way to make it work when Source
Highlight is not found.
gdb/ChangeLog
2018-12-28 Tom Tromey <tom@tromey.com>
* utils.h (can_emit_style_escape): Declare.
* utils.c (can_emit_style_escape): No longer static.
* cli/cli-style.c (set_style_enabled): New function.
(_initialize_cli_style): Use it.
* tui/tui-winsource.c (tui_show_source_line): Use tui_puts.
(tui_alloc_source_buffer): Change how source lines are allocated.
* tui/tui-source.c (copy_source_line): New function.
(tui_set_source_content): Use source cache.
* tui/tui-io.h (tui_puts): Update.
* tui/tui-io.c (tui_puts_internal): Add window parameter.
(tui_puts): Likewise.
(tui_redisplay_readline): Update.
* tui/tui-data.c (free_content_elements): Change how source window
contents are freed.
* source.c (forget_cached_source_info): Clear the source cache.
(print_source_lines_base): Use the source cache.
* source-cache.h: New file.
* source-cache.c: New file.
* configure.ac: Check for GNU Source Highlight library.
* configure: Update.
* config.in: Update.
* Makefile.in (SRCHIGH_LIBS, SRCHIGH_CFLAGS): New variables.
(INTERNAL_CFLAGS_BASE): Add SRCHIGH_CFLAGS.
(CLIBS): Add SRCHIGH_LIBS.
(COMMON_SFILES): Add source-cache.c.
(HFILES_NO_SRCDIR): Add source-cache.h.
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-style.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c index 0d850b1..0308e1c 100644 --- a/gdb/cli/cli-style.c +++ b/gdb/cli/cli-style.c @@ -20,6 +20,7 @@ #include "defs.h" #include "cli/cli-cmds.h" #include "cli/cli-style.h" +#include "source-cache.h" /* True if styling is enabled. */ @@ -217,6 +218,12 @@ show_style (const char *arg, int from_tty) } static void +set_style_enabled (const char *args, int from_tty, struct cmd_list_element *c) +{ + g_source_cache.clear (); +} + +static void show_style_enabled (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { @@ -245,7 +252,7 @@ Configure various style-related variables, such as colors"), Set whether CLI styling is enabled."), _("\ Show whether CLI is enabled."), _("\ If enabled, output to the terminal is styled."), - NULL, show_style_enabled, + set_style_enabled, show_style_enabled, &style_set_list, &style_show_list); file_name_style.add_setshow_commands ("filename", no_class, |