public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv2 1/3] gdb: don't try to style content in error calls
Date: Tue,  2 Jan 2024 14:43:11 +0000	[thread overview]
Message-ID: <bc0485ade3896ca899db18a0a09b415d31d8df9b.1704206350.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1704206350.git.aburgess@redhat.com>

While working on a later commit in this series I realised that the
error() function doesn't support output styling.  Due to the way that
output from error() calls is passed around within the exception
object and often combined with other output, it's not immediately
obvious to me if we should be trying to support styling in this
context or not.

On inspection, I found two places in GDB where we apparently try to
apply styling within the error() output, however, both of these places
are in infrequently used (and likely untested) code.

So, rather than try to implement styling in the error() output, right
now I'm proposing to just remove these two attempts to style error()
output.

This doesn't mean that someone shouldn't add error() styling in the
future, but right now, I'm not planning to do that, so I just wanted
to fix these two mistakes as I saw them.
---
 gdb/procfs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gdb/procfs.c b/gdb/procfs.c
index 1410bbc0d7d..0eafc2eddcc 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -605,10 +605,8 @@ static void
 proc_error (procinfo *pi, const char *func, int line)
 {
   int saved_errno = errno;
-  error ("procfs: %s line %d, %ps: %s",
-	 func, line, styled_string (file_name_style.style (),
-				    pi->pathname),
-	 safe_strerror (saved_errno));
+  error ("procfs: %s line %d, %s: %s",
+	 func, line, pi->pathname, safe_strerror (saved_errno));
 }
 
 /* Updates the status struct in the procinfo.  There is a 'valid'
-- 
2.25.4


  reply	other threads:[~2024-01-02 14:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-23 19:56 [PATCH 0/2] Changes to error reporting from the expression parser Andrew Burgess
2023-12-23 19:56 ` [PATCH 1/2] gdb: improve error reporting from " Andrew Burgess
2023-12-28 19:12   ` John Baldwin
2023-12-23 19:56 ` [PATCH 2/2] gdb: don't try to style content in error calls Andrew Burgess
2024-01-02 14:43 ` [PATCHv2 0/3] Changes to error reporting from the expression parser Andrew Burgess
2024-01-02 14:43   ` Andrew Burgess [this message]
2024-01-03 19:50     ` [PATCHv2 1/3] gdb: don't try to style content in error calls John Baldwin
2024-01-02 14:43   ` [PATCHv2 2/3] gdb: merge error handling from different expression parsers Andrew Burgess
2024-01-02 15:01     ` Lancelot SIX
2024-01-03  9:39       ` Andrew Burgess
2024-01-02 14:43   ` [PATCHv2 3/3] gdb: improve error reporting from expression parser Andrew Burgess
2024-01-03 19:52   ` [PATCHv2 0/3] Changes to error reporting from the " John Baldwin
2024-01-04  9:43     ` Andrew Burgess

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=bc0485ade3896ca899db18a0a09b415d31d8df9b.1704206350.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@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).