[1/4] Send some error output to gdb_stderr

Message ID 20220106172825.3856914-2-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.
This changes some code to send some error messages to gdb_stderr
rather than gdb_stdout.
---
 gdb/breakpoint.c | 7 ++++---
 gdb/event-top.c  | 2 +-
 gdb/inf-loop.c   | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

-- 
2.31.1

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index c7d75731621..259069fe86d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13550,9 +13550,10 @@  update_breakpoint_locations (struct breakpoint *b,
       /* Ranged breakpoints have only one start location and one end
 	 location.  */
       b->enable_state = bp_disabled;
-      printf_unfiltered (_("Could not reset ranged breakpoint %d: "
-			   "multiple locations found\n"),
-			 b->number);
+      fprintf_unfiltered (gdb_stderr,
+			  _("Could not reset ranged breakpoint %d: "
+			    "multiple locations found\n"),
+			  b->number);
       return;
     }
 
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 51c6ee803cd..28a1924f9dc 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -494,7 +494,7 @@  stdin_event_handler (int error, gdb_client_data client_data)
       if (main_ui == ui)
 	{
 	  /* If stdin died, we may as well kill gdb.  */
-	  printf_unfiltered (_("error detected on stdin\n"));
+	  fprintf_unfiltered (gdb_stderr, _("error detected on stdin\n"));
 	  quit_command ((char *) 0, 0);
 	}
       else
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index f1298cf3192..2002c4b8966 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -85,7 +85,7 @@  inferior_event_handler (enum inferior_event_type event_type)
       break;
 
     default:
-      printf_unfiltered (_("Event type not recognized.\n"));
+      fprintf_unfiltered (gdb_stderr, _("Event type not recognized.\n"));
       break;
     }
 }