From patchwork Thu Dec 29 17:13:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sbaugh@catern.com X-Patchwork-Id: 18722 Received: (qmail 15909 invoked by alias); 29 Dec 2016 17:45:27 -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 15895 invoked by uid 89); 29 Dec 2016 17:45:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=2100, sk:number_, Hx-languages-length:1788, H*r:Unknown X-HELO: blaine.gmane.org Received: from Unknown (HELO blaine.gmane.org) (195.159.176.226) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Dec 2016 17:45:25 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cMelG-0005Vm-F1 for gdb-patches@sourceware.org; Thu, 29 Dec 2016 18:45:06 +0100 To: gdb-patches@sourceware.org From: sbaugh@catern.com Subject: [PATCH] gdb: add -a option for remove-inferior Date: Thu, 29 Dec 2016 12:13:59 -0500 Lines: 63 Message-ID: <87a8bebqug.fsf@catern.com> Mime-Version: 1.0 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) X-IsSubscribed: yes I find myself frequently wanting to wipe out the current set of inferiors: detaching from all of them, or killing them all, and then starting anew. A -a flag to the various inferior commands which currently just take ranges of ids would make this a lot easier. Does that sound like a reasonable enhancement? If this patch is acceptable I'll go ahead and add -a flags like this to all the inferior commands where it makes sense, and add docs, and resubmit. This adds a -a option for remove-inferior; when passed, all inferiors will be removed. --- gdb/inferior.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gdb/inferior.c b/gdb/inferior.c index 32b6db2..f4cd062 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -775,13 +775,25 @@ info_inferiors_command (char *args, int from_tty) print_inferior (current_uiout, args); } -/* remove-inferior ID */ +/* remove-inferior [-a] ID */ static void remove_inferior_command (char *args, int from_tty) { if (args == NULL || *args == '\0') - error (_("Requires an argument (inferior id(s) to remove)")); + error (_("Requires an argument (inferior id(s) to remove or -a)")); + + if (startswith (args, "-a")) + { + struct inferior *inf, *cur; + cur = current_inferior(); + ALL_INFERIORS(inf) + { + if (inf != cur) + delete_inferior (inf); + } + return; + } number_or_range_parser parser (args); while (!parser.finished ()) @@ -1056,7 +1068,7 @@ as main program.")); add_com ("remove-inferiors", no_class, remove_inferior_command, _("\ Remove inferior ID (or list of IDs).\n\ -Usage: remove-inferiors ID...")); +Usage: remove-inferiors [-a] ID...")); add_com ("clone-inferior", no_class, clone_inferior_command, _("\ Clone inferior ID.\n\