]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Move stdtarg to ui
authorTom Tromey <tom@tromey.com>
Sun, 7 Dec 2025 23:29:17 +0000 (17:29 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 9 Feb 2026 15:09:08 +0000 (08:09 -0700)
Currently, most of the output streams are handled by the UI -- with
the sole exception of gdb_stdtarg.  This doesn't make sense to me, and
it is is useful in the longer term to make it per-UI so that the
logging approach can be uniform across all streams.  So, this moves it
to the UI, following the implementation approach of all other output
streams.

Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/main.c
gdb/top.c
gdb/ui.c
gdb/ui.h
gdb/utils.h

index 296f59b0b57cf4d0872487334d6026746d1b1a1f..ac83b953cf2be8df27c99bc9243a34d60671aadc 100644 (file)
@@ -81,7 +81,6 @@ std::string python_libdir;
 
 /* Target IO streams.  */
 struct ui_file *gdb_stdtargin;
-struct ui_file *gdb_stdtarg;
 
 /* True if --batch or --batch-silent was seen.  */
 int batch_flag = 0;
@@ -695,7 +694,6 @@ captured_main_1 (struct captured_main_args *context)
   gdb_internal_backtrace_init_str ();
   current_ui = main_ui;
 
-  gdb_stdtarg = gdb_stderr;
   gdb_stdtargin = gdb_stdin;
 
   /* Put a CLI based uiout in place early.  If the early initialization
index f1d0baeb3f4ff90477bf5ab8398e5ad71c99a0d3..e7d1ded96e417c9f582984d50dbaacd201872625 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -115,6 +115,12 @@ current_ui_gdb_stdlog_ptr ()
   return &current_ui->m_gdb_stdlog;
 }
 
+struct ui_file **
+current_ui_gdb_stdtarg_ptr ()
+{
+  return &current_ui->m_gdb_stdtarg;
+}
+
 struct ui_out **
 current_ui_current_uiout_ptr ()
 {
index 3e1ef9f8a34f50e9a2e2c62d007a509eb6285eba..6d29026117e9bad1a74fc6a45e8bcd92b2287414 100644 (file)
--- a/gdb/ui.c
+++ b/gdb/ui.c
@@ -51,7 +51,8 @@ ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)
     m_gdb_stdout (new pager_file (new stdio_file (outstream))),
     m_gdb_stdin (new stdio_file (instream)),
     m_gdb_stderr (new stderr_file (errstream)),
-    m_gdb_stdlog (new timestamped_file (m_gdb_stderr))
+    m_gdb_stdlog (new timestamped_file (m_gdb_stderr)),
+    m_gdb_stdtarg (m_gdb_stderr)
 {
   unbuffer_stream (instream_);
 
index 10159b1c38e503b3376741b25a18bfdf18736a81..ba98d2500afd9e41604d50bcbd62b8002c559469 100644 (file)
--- a/gdb/ui.h
+++ b/gdb/ui.h
@@ -155,6 +155,8 @@ struct ui
   /* Log/debug/trace messages that should bypass normal stdout/stderr
      filtering.  */
   struct ui_file *m_gdb_stdlog;
+  /* Target output.  */
+  struct ui_file *m_gdb_stdtarg;
 
   /* The current ui_out.  */
   struct ui_out *m_current_uiout = nullptr;
index 5f6b54d29534cbbe97c267711ca88b1286e85390..4f11cbf379ffc1dfbfaa4f967bb560e2beb9de44 100644 (file)
@@ -169,6 +169,7 @@ extern struct ui_file **current_ui_gdb_stdout_ptr (void);
 extern struct ui_file **current_ui_gdb_stdin_ptr (void);
 extern struct ui_file **current_ui_gdb_stderr_ptr (void);
 extern struct ui_file **current_ui_gdb_stdlog_ptr (void);
+extern struct ui_file **current_ui_gdb_stdtarg_ptr ();
 
 /* Flush STREAM.  */
 extern void gdb_flush (struct ui_file *stream);
@@ -185,11 +186,11 @@ extern void gdb_flush (struct ui_file *stream);
 /* Log/debug/trace messages that bypasses the pager, if one is in
    use.  */
 #define gdb_stdlog (*current_ui_gdb_stdlog_ptr ())
+/* Target output.  */
+#define gdb_stdtarg (*current_ui_gdb_stdtarg_ptr ())
 
 /* Truly global ui_file streams.  These are all defined in main.c.  */
 
-/* Target output that should bypass the pager, if one is in use.  */
-extern struct ui_file *gdb_stdtarg;
 extern struct ui_file *gdb_stdtargin;
 
 /* Set the screen dimensions to WIDTH and HEIGHT.  */