diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2019-12-15 17:58:16 +0100 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2020-01-03 21:13:21 +0100 |
commit | 6ec1d75e05a646eb602de4034366ec5fec7545ce (patch) | |
tree | 69c29a3159e27912cd1faa5d665543b37ff07c36 /gdb/top.c | |
parent | 44f81a76542dbeada2541a05de191ae0ac0fbc2c (diff) | |
download | gdb-6ec1d75e05a646eb602de4034366ec5fec7545ce.zip gdb-6ec1d75e05a646eb602de4034366ec5fec7545ce.tar.gz gdb-6ec1d75e05a646eb602de4034366ec5fec7545ce.tar.bz2 |
Ensure GDB warnings are styled.
While handling the comments of Tom related to
[RFC] Have an option to tell GDB to detect and possibly handle mismatched exec-files.
https://sourceware.org/ml/gdb-patches/2019-12/msg00621.html
I saw that GDB warnings are produced ignoring the given styles.
This patch:
* ensures that style markups are properly handled by "warning".
* changes 'set/show data-directory' so that file style is used
in warnings and in 'show message'
* changes all other messages in top.c to use file style when appropriate.
* Uses the above data-directory changes in gdb.base/style.exp
2020-01-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* ui-file.c (stdio_file::can_emit_style_escape)
(tee_file::can_emit_style_escape): Ensure style is used also on
gdb_stderr when gdb_stderr is a tty supporting styling, similarly
to gdb_stdout.
* main.c (set_gdb_data_directory): Use file style to output the
warning that the given pathname is not a directory.
* top.c (show_history_filename, gdb_safe_append_history)
(show_gdb_datadir): Use file style.
2020-01-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/style.exp: Test that warnings are styled.
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -55,6 +55,7 @@ #include "gdbsupport/scope-exit.h" #include "gdbarch.h" #include "gdbsupport/pathstuff.h" +#include "cli/cli-style.h" /* readline include files. */ #include "readline/readline.h" @@ -924,8 +925,8 @@ show_history_filename (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { fprintf_filtered (file, _("The filename in which to record " - "the command history is \"%s\".\n"), - value); + "the command history is \"%ps\".\n"), + styled_string (file_name_style.style (), value)); } /* This is like readline(), but it has some gdb-specific behavior. @@ -1192,8 +1193,10 @@ gdb_safe_append_history (void) saved_errno = errno; if (ret < 0 && saved_errno != ENOENT) { - warning (_("Could not rename %s to %s: %s"), - history_filename, local_history_filename.c_str (), + warning (_("Could not rename %ps to %ps: %s"), + styled_string (file_name_style.style (), history_filename), + styled_string (file_name_style.style (), + local_history_filename.c_str ()), safe_strerror (saved_errno)); } else @@ -2094,8 +2097,9 @@ static void show_gdb_datadir (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - fprintf_filtered (file, _("GDB's data directory is \"%s\".\n"), - gdb_datadir.c_str ()); + fprintf_filtered (file, _("GDB's data directory is \"%ps\".\n"), + styled_string (file_name_style.style (), + gdb_datadir.c_str ())); } static void |