Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 4/5] Use function style with throw_error
Date: Fri, 10 Apr 2026 16:59:44 -0600	[thread overview]
Message-ID: <20260410-unify-exceptions-v1-4-ea64dae971a8@tromey.com> (raw)
In-Reply-To: <20260410-unify-exceptions-v1-0-ea64dae971a8@tromey.com>

This changes some calls to throw_error to use function_name_style.
---
 gdb/infcall.c  |  1 +
 gdb/linespec.c | 12 +++++++-----
 gdb/valarith.c |  7 +++++--
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/gdb/infcall.c b/gdb/infcall.c
index a1328479d0a..8b26f541de6 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -29,6 +29,7 @@
 #include "language.h"
 #include "objfiles.h"
 #include "cli/cli-cmds.h"
+#include "cli/cli-style.h"
 #include "command.h"
 #include "dummy-frame.h"
 #include "ada-lang.h"
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 493ad47e76a..bd3b1c9386a 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1553,12 +1553,13 @@ symbol_not_found_error (const char *symbol, const char *filename)
     {
       if (filename)
 	throw_error (NOT_FOUND_ERROR,
-		     _("Function \"%s\" not defined in \"%ps\"."),
-		     symbol,
+		     _("Function \"%ps\" not defined in \"%ps\"."),
+		     styled_string (function_name_style.style (), symbol),
 		     styled_string (file_name_style.style (), filename));
       else
 	throw_error (NOT_FOUND_ERROR,
-		     _("Function \"%s\" not defined."), symbol);
+		     _("Function \"%ps\" not defined."),
+		     styled_string (function_name_style.style (), symbol));
     }
 }
 
@@ -1597,8 +1598,9 @@ undefined_label_error (const char *function, const char *label)
 {
   if (function != NULL)
     throw_error (NOT_FOUND_ERROR,
-		_("No label \"%s\" defined in function \"%s\"."),
-		label, function);
+		 _("No label \"%s\" defined in function \"%ps\"."),
+		 label,
+		 styled_string (function_name_style.style (), function));
   else
     throw_error (NOT_FOUND_ERROR,
 		_("No label \"%s\" defined in current function."),
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 673bdee2d11..ed5b5d8adf9 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -30,6 +30,7 @@
 #include "gdbarch.h"
 #include "rust-lang.h"
 #include "ada-lang.h"
+#include "cli/cli-style.h"
 
 /* Forward declarations.  */
 static struct value *value_subscripted_rvalue (struct value *array,
@@ -559,7 +560,8 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
 				    argvec.slice (1, 2 - static_memfuncp));
     }
   throw_error (NOT_FOUND_ERROR,
-	       _("member function %s not found"), tstr);
+	       _("member function %ps not found"),
+	       styled_string (function_name_style.style (), tstr));
 }
 
 /* We know that arg1 is a structure, so try to find a unary user
@@ -672,7 +674,8 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
 				    argvec.slice (1, nargs));
     }
   throw_error (NOT_FOUND_ERROR,
-	       _("member function %s not found"), tstr);
+	       _("member function %ps not found"),
+	       styled_string (function_name_style.style (), tstr));
 }
 \f
 

-- 
2.49.0


  parent reply	other threads:[~2026-04-10 23:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 22:59 [PATCH 0/5] Allow throw_* functions to style message Tom Tromey
2026-04-10 22:59 ` [PATCH 1/5] Allow styling when using throw_* functions Tom Tromey
2026-04-10 22:59 ` [PATCH 2/5] Use file- and line-styling with throw_error Tom Tromey
2026-04-10 22:59 ` [PATCH 3/5] Use command style " Tom Tromey
2026-04-10 22:59 ` Tom Tromey [this message]
2026-04-10 22:59 ` [PATCH 5/5] Use address " Tom Tromey
2026-05-08 19:02 ` [PATCH 0/5] Allow throw_* functions to style message Tom Tromey

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=20260410-unify-exceptions-v1-4-ea64dae971a8@tromey.com \
    --to=tom@tromey.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