This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add call to prune_program_spaces in mi_cmd_remove_inferior


...so the -remove-inferior MI command behaves more like the
remove-inferiors CLI command. The CLI version already calls
prune_program_spaces.

Currently, when removing an inferior with MI, the associated program
space is not removed, even if it is not useful anyore. A visible
consequence of that is that after doing -remove-inferior, you won't get
the =library-unloaded messages yet. Only when prune_program_spaces is
called later, for unrelated reasons (i.e. starting another inferior),
gdb will realize that the program space is useless and will issue the
library events.

Another consequence of that is that breakpoints are not re-evaluated and
"info breakpoints" will still show the locations in the old
inferior/program space.

I also noticed that in the =library-unloaded messages that you get when
removing an inferior, 'thread-group' value is not good. This is because
the code that emits the event uses current_inferior()->num to generate
the value (mi-interp.c:1022). The inferior that is being removed can't be
the current_inferior. I will try to look at it later, but if you have an
idea on how to fix it, I am open to suggestions.

No change in the test results (Ubuntu 14.10).

gdb/Changelog:

	* mi/mi-main.c (mi_cmd_remove_inferior): Add call to
	prune_program_spaces.
---
 gdb/mi/mi-main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 59717ca..ba710ff 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1951,6 +1951,8 @@ mi_cmd_remove_inferior (char *command, char **argv, int argc)
     }
 
   delete_inferior_1 (inf, 1 /* silent */);
+
+  prune_program_spaces ();
 }
 
 
-- 
2.1.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]