public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Add more filename styling
Date: Mon, 28 Feb 2022 18:34:58 +0000 (GMT)	[thread overview]
Message-ID: <20220228183458.640F43858C39@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=972f7a4b97f81a0a5e6f46b9fb163796dc12ead5

commit 972f7a4b97f81a0a5e6f46b9fb163796dc12ead5
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Feb 28 08:21:55 2022 -0700

    Add more filename styling
    
    I found a few spots where filename styling ought to be applied, but is
    not.

Diff:
---
 gdb/auto-load.c       | 9 ++++++---
 gdb/gdb_bfd.c         | 4 +++-
 gdb/infcmd.c          | 3 ++-
 gdb/inferior.c        | 4 +++-
 gdb/linux-thread-db.c | 3 ++-
 gdb/progspace.c       | 4 +++-
 gdb/symtab.c          | 3 ++-
 7 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 680b87936b1..9a1ccec87ce 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -476,15 +476,18 @@ file_is_auto_load_safe (const char *filename)
       printf_filtered (_("\
 To enable execution of this file add\n\
 \tadd-auto-load-safe-path %s\n\
-line to your configuration file \"%s\".\n\
+line to your configuration file \"%ps\".\n\
 To completely disable this security protection add\n\
 \tset auto-load safe-path /\n\
-line to your configuration file \"%s\".\n\
+line to your configuration file \"%ps\".\n\
 For more information about this security protection see the\n\
 \"Auto-loading safe path\" section in the GDB manual.  E.g., run from the shell:\n\
 \tinfo \"(gdb)Auto-loading safe path\"\n"),
 		       filename_real.get (),
-		       home_config.c_str (), home_config.c_str ());
+		       styled_string (file_name_style.style (),
+				      home_config.c_str ()),
+		       styled_string (file_name_style.style (),
+				      home_config.c_str ()));
       advice_printed = true;
     }
 
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index d28c32352bc..b2e896f7c52 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -32,6 +32,7 @@
 #include "target.h"
 #include "gdb/fileio.h"
 #include "inferior.h"
+#include "cli/cli-style.h"
 
 /* An object of this type is stored in the section's user data when
    mapping a section.  */
@@ -1101,7 +1102,8 @@ print_one_bfd (void **slot, void *data)
   ui_out_emit_tuple tuple_emitter (uiout, NULL);
   uiout->field_signed ("refcount", gdata->refc);
   uiout->field_string ("addr", host_address_to_string (abfd));
-  uiout->field_string ("filename", bfd_get_filename (abfd));
+  uiout->field_string ("filename", bfd_get_filename (abfd),
+		       file_name_style.style ());
   uiout->text ("\n");
 
   return 1;
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 682bebe1229..ea06ceb992c 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -438,7 +438,8 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
       uiout->field_string (NULL, "Starting program");
       uiout->text (": ");
       if (exec_file)
-	uiout->field_string ("execfile", exec_file);
+	uiout->field_string ("execfile", exec_file,
+			     file_name_style.style ());
       uiout->spaces (1);
       uiout->field_string ("infargs", current_inferior ()->args ());
       uiout->text ("\n");
diff --git a/gdb/inferior.c b/gdb/inferior.c
index bebddb44173..1abdde3b3b4 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -36,6 +36,7 @@
 #include "readline/tilde.h"
 #include "progspace-and-thread.h"
 #include "gdbsupport/buildargv.h"
+#include "cli/cli-style.h"
 
 /* Keep a registry of per-inferior data-pointers required by other GDB
    modules.  */
@@ -521,7 +522,8 @@ print_inferior (struct ui_out *uiout, const char *requested_inferiors)
       uiout->field_string ("connection-id", conn);
 
       if (inf->pspace->exec_filename != nullptr)
-	uiout->field_string ("exec", inf->pspace->exec_filename.get ());
+	uiout->field_string ("exec", inf->pspace->exec_filename.get (),
+			     file_name_style.style ());
       else
 	uiout->field_skip ("exec");
 
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 18d313bf9be..530ece08db1 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1944,7 +1944,8 @@ info_auto_load_libthread_db (const char *args, int from_tty)
 	ui_out_emit_tuple tuple_emitter (uiout, NULL);
 
 	info = array[i];
-	uiout->field_string ("filename", info->filename);
+	uiout->field_string ("filename", info->filename,
+			     file_name_style.style ());
 
 	std::string pids;
 	while (i < array.size () && strcmp (info->filename,
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 4a2ac84ca06..8dc21fd42c2 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -27,6 +27,7 @@
 #include "gdbthread.h"
 #include "inferior.h"
 #include <algorithm>
+#include "cli/cli-style.h"
 
 /* The last program space number assigned.  */
 static int last_program_space_num = 0;
@@ -321,7 +322,8 @@ print_program_space (struct ui_out *uiout, int requested)
       uiout->field_signed ("id", pspace->num);
 
       if (pspace->exec_filename != nullptr)
-	uiout->field_string ("exec", pspace->exec_filename.get ());
+	uiout->field_string ("exec", pspace->exec_filename.get (),
+			     file_name_style.style ());
       else
 	uiout->field_skip ("exec");
 
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 1a39372aad0..a867e1db9fd 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4508,7 +4508,8 @@ info_sources_worker (struct ui_out *uiout,
       if (group_by_objfile)
 	{
 	  output_tuple.emplace (uiout, nullptr);
-	  uiout->field_string ("filename", objfile_name (objfile));
+	  uiout->field_string ("filename", objfile_name (objfile),
+			       file_name_style.style ());
 	  uiout->text (":\n");
 	  bool debug_fully_readin = !objfile->has_unexpanded_symtabs ();
 	  if (uiout->is_mi_like_p ())


                 reply	other threads:[~2022-02-28 18:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220228183458.640F43858C39@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).