From patchwork Wed Sep 24 21:18:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 2965 Received: (qmail 21221 invoked by alias); 24 Sep 2014 21:19:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 21185 invoked by uid 89); 24 Sep 2014 21:19:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 24 Sep 2014 21:19:07 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id E5.D5.25146.6ACD2245; Wed, 24 Sep 2014 17:00:54 +0200 (CEST) Received: from simark-hp.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.90) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 24 Sep 2014 17:19:04 -0400 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH] Add call to prune_program_spaces in mi_cmd_remove_inferior Date: Wed, 24 Sep 2014 17:18:59 -0400 Message-ID: <1411593539-6507-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes ...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 (); }