]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: make deprecated_show_value_hack use its ui_file parameter
authorSébastien Darche <sdarche@efficios.com>
Mon, 29 Sep 2025 14:50:48 +0000 (10:50 -0400)
committerSébastien Darche <sdarche@efficios.com>
Wed, 8 Oct 2025 20:00:33 +0000 (16:00 -0400)
If a setting does not provide a "show" function, we fall back to the
deprecated_show_value_hack function to print the value in a generic
way. The current version ignores the `file` parameter specifying the
output file in favor of always using gdb_stdout.

To make things consistent with how the values are printed using a
regular show command, the proposed change makes the function use the
ui_file parameter it receives (even though do_show_command passes
gdb_stdout).

Co-Authored-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I54028ed654a1fa4d955e6e46f979472c8d98ace9
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/cli/cli-setshow.c

index 8528ac52148bbf705f6a0d21ab1b1e563f144a05..d92d14e7bb41f4873a311a8ae20b3f558c7fa553 100644 (file)
@@ -118,7 +118,7 @@ parse_cli_boolean_value (const char *arg)
 
 \f
 static void
-deprecated_show_value_hack (struct ui_file *ignore_file,
+deprecated_show_value_hack (struct ui_file *file,
                            int ignore_from_tty,
                            struct cmd_list_element *c,
                            const char *value)
@@ -129,7 +129,7 @@ deprecated_show_value_hack (struct ui_file *ignore_file,
 
   /* Print doc minus "Show " at start.  Tell print_doc_line that
      this is for a 'show value' prefix.  */
-  print_doc_line (gdb_stdout, c->doc + 5, true);
+  print_doc_line (file, c->doc + 5, true);
 
   gdb_assert (c->var.has_value ());
 
@@ -138,17 +138,17 @@ deprecated_show_value_hack (struct ui_file *ignore_file,
     case var_string:
     case var_string_noescape:
     case var_enum:
-      gdb_printf ((" is \"%s\".\n"), value);
+      gdb_printf (file, _(" is \"%s\".\n"), value);
       break;
 
     case var_optional_filename:
     case var_filename:
-      gdb_printf ((" is \"%ps\".\n"),
+      gdb_printf (file, _(" is \"%ps\".\n"),
                  styled_string (file_name_style.style (), value));
       break;
 
     default:
-      gdb_printf ((" is %s.\n"), value);
+      gdb_printf (file, _(" is %s.\n"), value);
       break;
     }
 }
@@ -747,5 +747,3 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
        }
     }
 }
-
-