[binutils-gdb] Use double quotes in some gdb output

Tom Tromey via Gdb-cvs <[email protected]> Fri, 5 Jun 2026 21:09:36 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aaa46d4b82956ba33c821d2833dd7041f6e138a6

commit aaa46d4b82956ba33c821d2833dd7041f6e138a6
Author: Tom Tromey <[email protected]>
Date:   Wed Apr 22 12:31:57 2026 -0600

    Use double quotes in some gdb output
    
    I looked for spots where gdb was using `...' or ``...'' quoting, and
    changed these to use double quotes instead.
    
    I think it might be good to regularize output quoting in gdb.  My
    proposal is to use double quotes, though single quotes would also be
    fine.  Using `...', though, is a kind of older style and has fallen
    out of favor in GNU; the relevant node is here:
    
        https://www.gnu.org/prep/standards/html_node/Quote-Characters.html
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34044

Diff:
---
 gdb/mi/mi-getopt.c                        |  2 +-
 gdb/std-regs.c                            |  4 ++--
 gdb/testsuite/gdb.base/radix.exp          | 10 +++++-----
 gdb/testsuite/gdb.base/setshow.exp        |  2 +-
 gdb/testsuite/gdb.trace/mi-trace-save.exp |  2 +-
 gdb/valprint.c                            |  4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
index 865bba9abf8..14360fd78b5 100644
--- a/gdb/mi/mi-getopt.c
+++ b/gdb/mi/mi-getopt.c
@@ -72,7 +72,7 @@ mi_getopt_1 (const char *prefix, int argc, const char *const *argv,
     }
 
   if (error_on_unknown)
-    error (_("%s: Unknown option ``%s''"), prefix, arg + 1);
+    error (_("%s: Unknown option \"%s\""), prefix, arg + 1);
   else
     return -1;
 }
diff --git a/gdb/std-regs.c b/gdb/std-regs.c
index d5d946895d6..e8536187323 100644
--- a/gdb/std-regs.c
+++ b/gdb/std-regs.c
@@ -79,7 +79,7 @@ value_of_builtin_frame_sp_reg (const frame_info_ptr &frame, const void *baton)
   if (gdbarch_sp_regnum (gdbarch) >= 0)
     return value_of_register (gdbarch_sp_regnum (gdbarch),
 			      get_next_frame_sentinel_okay (frame));
-  error (_("Standard register ``$sp'' is not available for this target"));
+  error (_("Standard register \"$sp\" is not available for this target"));
 }
 
 static struct value *
@@ -90,7 +90,7 @@ value_of_builtin_frame_ps_reg (const frame_info_ptr &frame, const void *baton)
   if (gdbarch_ps_regnum (gdbarch) >= 0)
     return value_of_register (gdbarch_ps_regnum (gdbarch),
 			      get_next_frame_sentinel_okay (frame));
-  error (_("Standard register ``$ps'' is not available for this target"));
+  error (_("Standard register \"$ps\" is not available for this target"));
 }
 
 INIT_GDB_FILE (frame_reg)
diff --git a/gdb/testsuite/gdb.base/radix.exp b/gdb/testsuite/gdb.base/radix.exp
index 7a4320bbf36..51fac418de8 100644
--- a/gdb/testsuite/gdb.base/radix.exp
+++ b/gdb/testsuite/gdb.base/radix.exp
@@ -157,34 +157,34 @@ gdb_test "set radix" \
     "reset radices"
 
 gdb_test "set input-radix 0" \
-    "Nonsense input radix ``decimal 0''; input radix unchanged\\." \
+    "Nonsense input radix \"decimal 0\"; input radix unchanged\\." \
     "Reject input-radix 0"
 gdb_test "show input-radix" \
     "Default input radix for entering numbers is 10\\." \
     "input radix unchanged after rejecting 0"
 
 gdb_test "set input-radix 1" \
-    "Nonsense input radix ``decimal 1''; input radix unchanged\\." \
+    "Nonsense input radix \"decimal 1\"; input radix unchanged\\." \
     "Reject input-radix 1"
 gdb_test "show input-radix" \
     "Default input radix for entering numbers is 10\\." \
     "input radix unchanged after rejecting 1"
 
 gdb_test "set output-radix 0" \
-    "Unsupported output radix ``decimal 0''; output radix unchanged\\." \
+    "Unsupported output radix \"decimal 0\"; output radix unchanged\\." \
     "Reject output-radix 0"
 gdb_test "show output-radix" \
     "Default output radix for printing of values is 10\\." \
     "Output radix unchanged after rejecting 0"
 gdb_test "set output-radix 1" \
-    "Unsupported output radix ``decimal 1''; output radix unchanged\\." \
+    "Unsupported output radix \"decimal 1\"; output radix unchanged\\." \
     "Reject output-radix 1"
 gdb_test "show output-radix" \
     "Default output radix for printing of values is 10\\." \
     "output radix unchanged after rejecting 1"
 
 gdb_test "set radix 7" \
-    "Unsupported output radix ``decimal 7''; output radix unchanged\\." \
+    "Unsupported output radix \"decimal 7\"; output radix unchanged\\." \
     "set radix 7 rejected"
 gdb_test "show output-radix" \
     "Default output radix for printing of values is 10\\." \
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index b8923492e4b..def07ff7c38 100644
--- a/gdb/testsuite/gdb.base/setshow.exp
+++ b/gdb/testsuite/gdb.base/setshow.exp
@@ -441,7 +441,7 @@ proc_with_prefix test_setshow_radix {} {
     clean_restart
 
     #test set radix 11
-    gdb_test "set radix 11" "Unsupported output radix ``decimal 11''; output radix unchanged..*"
+    gdb_test "set radix 11" "Unsupported output radix \"decimal 11\"; output radix unchanged..*"
 
     #test set radix 16
     gdb_test "set radix 16" "Input and output radices now set to decimal 16, hex 10, octal 20..*"
diff --git a/gdb/testsuite/gdb.trace/mi-trace-save.exp b/gdb/testsuite/gdb.trace/mi-trace-save.exp
index a6493d59339..ab2a7008307 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-save.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-save.exp
@@ -33,7 +33,7 @@ proc test_trace_save_wrong_num_args { } {
 # Test with an unrecognized option.
 
 proc test_trace_save_wrong_opt { } {
-    set err_re [string_to_regexp "^error,msg=\"-trace-save: Unknown option ``hey''\""]
+    set err_re [string_to_regexp "^error,msg=\"-trace-save: Unknown option \\\"hey\\\"\""]
 
     mi_gdb_test "-trace-save -hey" "$err_re" "-trace-save with wrong option"
 }
diff --git a/gdb/valprint.c b/gdb/valprint.c
index b266db550d1..01699c075c6 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -2257,7 +2257,7 @@ set_input_radix_1 (int from_tty, unsigned radix)
   if (radix < 2)
     {
       input_radix_1 = input_radix;
-      error (_("Nonsense input radix ``decimal %u''; input radix unchanged."),
+      error (_("Nonsense input radix \"decimal %u\"; input radix unchanged."),
 	     radix);
     }
   input_radix_1 = input_radix = radix;
@@ -2299,7 +2299,7 @@ set_output_radix_1 (int from_tty, unsigned radix)
       break;
     default:
       output_radix_1 = output_radix;
-      error (_("Unsupported output radix ``decimal %u''; "
+      error (_("Unsupported output radix \"decimal %u\"; "
 	       "output radix unchanged."),
 	     radix);
     }