[PATCH 06/12] Use filtered output in kill command

Tom Tromey tom@tromey.com
Sat Jan 1 17:55:14 GMT 2022


This changes the kill command to use filtered output.  I split this
one into its own patch because, out of an abundance of caution, I
changed the function to call bfd_cache_close_all a bit earlier, in
case pagination caused an exception.
---
 gdb/infcmd.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index e0e317d0757..8bf58018bdd 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2349,12 +2349,11 @@ kill_command (const char *arg, int from_tty)
   int infnum = current_inferior ()->num;
 
   target_kill ();
+  bfd_cache_close_all ();
 
   if (print_inferior_events)
-    printf_unfiltered (_("[Inferior %d (%s) killed]\n"),
-		       infnum, pid_str.c_str ());
-
-  bfd_cache_close_all ();
+    printf_filtered (_("[Inferior %d (%s) killed]\n"),
+		     infnum, pid_str.c_str ());
 }
 
 /* Used in `attach&' command.  Proceed threads of inferior INF iff
-- 
2.31.1



More information about the Gdb-patches mailing list