[PATCH] Prune program spaces in remove-inferiors

Doug Evans xdje42@gmail.com
Sun Mar 2 21:23:00 GMT 2014


Hi.

While writing a test for Guile program space support I found that
after I removed an inferior I would still see it show up in the
progspaces list.  And then if I did "mt info program-spaces" it would
then go away.  While info commands shouldn't in general exhibit side
effects like this, I'm not too worried here (*1).

But I think remove-inferiors should call prune_program_spaces.
Is there a reason for it to not to?

Regression tested on amd64-linux.

2014-03-02  Doug Evans  <xdje42@gmail.com>

	* inferior.c (prune_inferiors): Fix comment.
	(remove_inferior_command): Call prune_program_spaces.

diff --git a/gdb/inferior.c b/gdb/inferior.c
index 90d9649..23da0c7 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -475,8 +475,8 @@ have_live_inferiors (void)
   return inf != NULL;
 }
 
-/* Prune away automatically added program spaces that aren't required
-   anymore.  */
+/* Prune away any unused inferiors, and then prune away no longer used
+   program spaces.  */
 
 void
 prune_inferiors (void)
@@ -788,6 +788,8 @@ remove_inferior_command (char *args, int from_tty)
 
       delete_inferior_1 (inf, 1);
     }
+
+  prune_program_spaces ();
 }
 
 struct inferior *


---
(*1): For reference sake, "info threads" is a more serious
case of this when debugging remotely, ref: "Finding new threads in the
inferior" in https://sourceware.org/gdb/wiki/LocalRemoteFeatureParity



More information about the Gdb-patches mailing list