[4/4] Always print the "host libthread-db" message to stdout

Message ID 20220106172825.3856914-5-tom@tromey.com
State New
Headers show
Series
  • Audit uses of unfiltered output to gdb_stdout
Related show

Commit Message

Tom Tromey Jan. 6, 2022, 5:28 p.m.
linux-thread-db.c has a bit of unusual code that unconditionally
prints a message, but decides whether to print to gdb_stdout or
gdb_stdlog based on a debug flag.  It seems better to me to simply
always print this; and this is the only spot in gdb where we
conditionally pass gdb_stdout to one of the f*_unfiltered functions.
---
 gdb/linux-thread-db.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

-- 
2.31.1

Patch

diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index a0cfeb1685b..18d313bf9be 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -940,21 +940,14 @@  try_thread_db_load_1 (struct thread_db_info *info)
 
   if (!libthread_db_search_path.empty () || libthread_db_debug)
     {
-      struct ui_file *file;
       const char *library;
 
       library = dladdr_to_soname ((const void *) *info->td_ta_new_p);
       if (library == NULL)
 	library = LIBTHREAD_DB_SO;
 
-      /* If we'd print this to gdb_stdout when debug output is
-	 disabled, still print it to gdb_stdout if debug output is
-	 enabled.  User visible output should not depend on debug
-	 settings.  */
-      file = !libthread_db_search_path.empty () ? gdb_stdout : gdb_stdlog;
-      fprintf_unfiltered (file,
-			  _("Using host libthread_db library \"%ps\".\n"),
-			  styled_string (file_name_style.style (), library));
+      printf_unfiltered (_("Using host libthread_db library \"%ps\".\n"),
+			 styled_string (file_name_style.style (), library));
     }
 
   /* The thread library was detected.  Activate the thread_db target