From 782feedbc7b8a7f2e786969d28bbb62ba19aaf04 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 17 Jan 2026 09:09:22 -0700 Subject: [PATCH] Remove gdb_stdtargin gdb_stdtargin is only used in a single place; and, strangely, does not follow the current UI. This patch removes the global and changes the one user to use gdb_stdin instead. Approved-By: Andrew Burgess --- gdb/main.c | 5 ----- gdb/remote-fileio.c | 2 +- gdb/utils.h | 4 ---- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/gdb/main.c b/gdb/main.c index ac83b953cf2..c9bd79a4f8b 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -79,9 +79,6 @@ static int gdb_datadir_provided = 0; the possibly relocated path to python's lib directory. */ std::string python_libdir; -/* Target IO streams. */ -struct ui_file *gdb_stdtargin; - /* True if --batch or --batch-silent was seen. */ int batch_flag = 0; @@ -694,8 +691,6 @@ captured_main_1 (struct captured_main_args *context) gdb_internal_backtrace_init_str (); current_ui = main_ui; - gdb_stdtargin = gdb_stdin; - /* Put a CLI based uiout in place early. If the early initialization files trigger any I/O then it isn't hard to reach parts of GDB that assume current_uiout is not nullptr. Maybe we should just install the diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c index 61dfb2552aa..459f249d37b 100644 --- a/gdb/remote-fileio.c +++ b/gdb/remote-fileio.c @@ -542,7 +542,7 @@ remote_fileio_func_read (remote_target *remote, char *buf) limit this read to something smaller than that - by a safe margin, in case the limit depends on system resources or version. */ - ret = gdb_stdtargin->read ((char *) buffer, 16383); + ret = gdb_stdin->read ((char *) buffer, 16383); if (ret > 0 && (size_t)ret > length) { remaining_buf = (char *) xmalloc (ret - length); diff --git a/gdb/utils.h b/gdb/utils.h index 28824ad2e1a..4d888b80274 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -189,10 +189,6 @@ extern void gdb_flush (struct ui_file *stream); /* Target output. */ #define gdb_stdtarg (*current_ui_gdb_stdtarg_ptr ()) -/* Truly global ui_file streams. These are all defined in main.c. */ - -extern struct ui_file *gdb_stdtargin; - /* Set the screen dimensions to WIDTH and HEIGHT. */ extern void set_screen_width_and_height (int width, int height); -- 2.47.3