maybe_warn_already_logging ()
{
if (!saved_filename.empty ())
- warning (_("Currently logging to %s. Turn the logging off and on to "
- "make the new setting effective."), saved_filename.c_str ());
+ warning (_("Currently logging to %ps. Turn the logging off and on to "
+ "make the new setting effective."),
+ styled_string (file_name_style.style (),
+ saved_filename.c_str ()));
}
static std::string logging_filename = "gdb.txt";
{
if (!saved_filename.empty ())
{
- gdb_printf ("Already logging to %s.\n",
- saved_filename.c_str ());
+ gdb_printf ("Already logging to %ps.\n",
+ styled_string (file_name_style.style (),
+ saved_filename.c_str ()));
return;
}
if (from_tty)
{
if (!logging_redirect)
- gdb_printf ("Copying output to %s.\n",
- logging_filename.c_str ());
+ gdb_printf ("Copying output to %ps.\n",
+ styled_string (file_name_style.style (),
+ logging_filename.c_str ()));
else
- gdb_printf ("Redirecting output to %s.\n",
- logging_filename.c_str ());
+ gdb_printf ("Redirecting output to %ps.\n",
+ styled_string (file_name_style.style (),
+ logging_filename.c_str ()));
if (!debug_redirect)
- gdb_printf ("Copying debug output to %s.\n",
- logging_filename.c_str ());
+ gdb_printf ("Copying debug output to %ps.\n",
+ styled_string (file_name_style.style (),
+ logging_filename.c_str ()));
else
- gdb_printf ("Redirecting debug output to %s.\n",
- logging_filename.c_str ());
+ gdb_printf ("Redirecting debug output to %ps.\n",
+ styled_string (file_name_style.style (),
+ logging_filename.c_str ()));
}
saved_filename = logging_filename;
log_file.reset ();
if (from_tty)
- gdb_printf ("Done logging to %s.\n",
- saved_filename.c_str ());
+ gdb_printf ("Done logging to %ps.\n",
+ styled_string (file_name_style.style (),
+ saved_filename.c_str ()));
+
saved_filename.clear ();
}
gdb_test "finish" "Value returned is [style ${::valnum_re} variable] = 0"
}
+# Test some logging styling.
+proc test_logging_styling {} {
+ with_ansi_styling_terminal {
+ clean_restart
+ }
+
+ set filename [standard_output_file logging.txt]
+ gdb_test_no_output "set logging file $filename" \
+ "set logging file"
+ gdb_test "set logging enabled on" \
+ [multi_line \
+ "Copying output to [style $filename file]\\." \
+ "Copying debug output to [style $filename file]\\."] \
+ "logging filenames are styled"
+ gdb_test "set logging enabled off" \
+ "Done logging to [style $filename file]\\." \
+ "filename styled when logging disabled"
+}
+
# Check to see if the Python styling of disassembler output is
# expected or not, this styling requires Python support in GDB, and
# the Python pygments module to be available.
test_pagination_prompt_styling
test_pagination_continue_styling
test_finish_styling
+test_logging_styling