gdb: more filename styling in remote.c and target.c

I spotted a few more places where we could apply filename styling in
remote.c and target.c.  Other than the styling, there should be no
user visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Andrew Burgess
2024-05-21 16:20:43 +01:00
parent 7b9cfd7f3d
commit 5260dcf0c6
2 changed files with 17 additions and 9 deletions

View File

@@ -79,6 +79,7 @@
#include <unordered_map>
#include "async-event.h"
#include "gdbsupport/selftest.h"
#include "cli/cli-style.h"
/* The remote target. */
@@ -12751,8 +12752,8 @@ remote_target::remote_hostio_open (inferior *inf, const char *filename,
{
static int warning_issued = 0;
gdb_printf (_("Reading %s from remote target...\n"),
filename);
gdb_printf (_("Reading %ps from remote target...\n"),
styled_string (file_name_style.style (), filename));
if (!warning_issued)
{
@@ -13291,7 +13292,8 @@ remote_target::remote_file_put (const char *local_file, const char *remote_file,
remote_hostio_error (remote_errno);
if (from_tty)
gdb_printf (_("Successfully sent file \"%s\".\n"), local_file);
gdb_printf (_("Successfully sent file \"%ps\".\n"),
styled_string (file_name_style.style (), local_file));
}
void
@@ -13351,7 +13353,8 @@ remote_target::remote_file_get (const char *remote_file, const char *local_file,
remote_hostio_error (remote_errno);
if (from_tty)
gdb_printf (_("Successfully fetched file \"%s\".\n"), remote_file);
gdb_printf (_("Successfully fetched file \"%ps\".\n"),
styled_string (file_name_style.style (), remote_file));
}
void
@@ -13376,7 +13379,8 @@ remote_target::remote_file_delete (const char *remote_file, int from_tty)
remote_hostio_error (remote_errno);
if (from_tty)
gdb_printf (_("Successfully deleted file \"%s\".\n"), remote_file);
gdb_printf (_("Successfully deleted file \"%ps\".\n"),
styled_string (file_name_style.style (), remote_file));
}
static void

View File

@@ -54,6 +54,7 @@
#include "target-connection.h"
#include "valprint.h"
#include "cli/cli-decode.h"
#include "cli/cli-style.h"
static void generic_tls_error (void) ATTRIBUTE_NORETURN;
@@ -2397,8 +2398,9 @@ info_target_command (const char *args, int from_tty)
if (current_program_space->symfile_object_file != NULL)
{
objfile *objf = current_program_space->symfile_object_file;
gdb_printf (_("Symbols from \"%s\".\n"),
objfile_name (objf));
gdb_printf (_("Symbols from \"%ps\".\n"),
styled_string (file_name_style.style (),
objfile_name (objf)));
}
for (target_ops *t = current_inferior ()->top_target ();
@@ -3577,7 +3579,8 @@ target_announce_detach (int from_tty)
gdb_printf ("Detaching from pid %s\n",
target_pid_to_str (ptid_t (pid)).c_str ());
else
gdb_printf (_("Detaching from program: %s, %s\n"), exec_file,
gdb_printf (_("Detaching from program: %ps, %s\n"),
styled_string (file_name_style.style (), exec_file),
target_pid_to_str (ptid_t (pid)).c_str ());
}
@@ -3592,7 +3595,8 @@ target_announce_attach (int from_tty, int pid)
const char *exec_file = get_exec_file (0);
if (exec_file != nullptr)
gdb_printf ("Attaching to program: %s, %s\n", exec_file,
gdb_printf ("Attaching to program: %ps, %s\n",
styled_string (file_name_style.style (), exec_file),
target_pid_to_str (ptid_t (pid)).c_str ());
else
gdb_printf ("Attaching to %s\n",