[8/8] Use styled_string for "show logging filename"

Message ID 20190927212520.20073-9-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Sept. 27, 2019, 9:25 p.m. UTC
  This changes "show logging filename" to style its output.

gdb/ChangeLog
2019-09-27  Tom Tromey  <tom@tromey.com>

	* cli/cli-logging.c (show_logging_filename): Use styled_string.

gdb/testsuite/ChangeLog
2019-09-27  Tom Tromey  <tom@tromey.com>

	* gdb.base/style.exp: Test "show logging filename".
---
 gdb/ChangeLog                    | 4 ++++
 gdb/cli/cli-logging.c            | 5 +++--
 gdb/testsuite/ChangeLog          | 4 ++++
 gdb/testsuite/gdb.base/style.exp | 3 +++
 4 files changed, 14 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index 22b540b4812..e20ebd5dc82 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -21,6 +21,7 @@ 
 #include "gdbcmd.h"
 #include "ui-out.h"
 #include "interps.h"
+#include "cli/cli-style.h"
 
 static char *saved_filename;
 
@@ -29,8 +30,8 @@  static void
 show_logging_filename (struct ui_file *file, int from_tty,
 		       struct cmd_list_element *c, const char *value)
 {
-  fprintf_filtered (file, _("The current logfile is \"%s\".\n"),
-		    value);
+  fprintf_filtered (file, _("The current logfile is \"%ps\".\n"),
+		    styled_string (file_name_style.style (), value));
 }
 
 static bool logging_overwrite;
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 0f812f7f1bc..72b5f4efb21 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -137,4 +137,7 @@  save_vars { env(TERM) } {
     gdb_test_no_output "set print repeat 3"
     gdb_test "print {0,0,0,0,0,0,0,0}" \
 	" = \\{0 [style {<repeats.*8.*times>} metadata]\\}"
+
+    gdb_test "show logging file" \
+	"The current logfile is \"[style .*? file]\"\\..*"
 }