]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: don't try to style content in error calls
authorAndrew Burgess <aburgess@redhat.com>
Fri, 22 Dec 2023 11:48:54 +0000 (11:48 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Thu, 4 Jan 2024 09:24:18 +0000 (09:24 +0000)
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 one place in GDB where we apparently try to
apply styling within the error() output (in procfs.c).  I suspect this
error() call might not be tested.

Rather than try to implement styling in the error() output, right now
I'm proposing to just remove the attempt 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, I just wanted to
fix this in passing.

Approved-By: John Baldwin <jhb@FreeBSD.org>
gdb/procfs.c

index 1410bbc0d7d652a398ca379befb51dffa813026d..0eafc2eddcc146fd0fce37094969bb410a214a7a 100644 (file)
@@ -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'