From patchwork Fri Sep 6 23:27:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 34437 Received: (qmail 37192 invoked by alias); 6 Sep 2019 23:36:56 -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 37090 invoked by uid 89); 6 Sep 2019 23:36:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=decade, kills, checkpoints X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2019 23:36:55 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F5D030A5415 for ; Fri, 6 Sep 2019 23:28:16 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0AFD5D9D3 for ; Fri, 6 Sep 2019 23:28:15 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 07/23] Delete unnecessary code from kill_command Date: Sat, 7 Sep 2019 00:27:51 +0100 Message-Id: <20190906232807.6191-8-palves@redhat.com> In-Reply-To: <20190906232807.6191-1-palves@redhat.com> References: <20190906232807.6191-1-palves@redhat.com> I believe this comment: /* Killing off the inferior can leave us with a core file. If so, print the state we are left in. */ Referred to the fact that a decade ago, by design, GDB would let you type "run" when debugging a core dump, keeping the core open. That "run" would push a process_stratum target on the target stack for the live process, and, the core would remain open -- we used to have a core_stratum. When the live process was killed/detached or exited, GDB would go back to debugging the core, since the core_stratum target was now at the top of the stack. That design had a number of problems, see here for example: https://sourceware.org/ml/gdb-patches/2008-08/msg00290.html In 2010, core_stratum was finaly eliminated and cores now have process_stratum too, with commit c0edd9edadfe ("Make core files the process_stratum."). Pushing a live process on the stack while you're debugging a core discards the core completely. I also thought that this might be in use with checkpoints, but it does not -- "kill" when you have multiple checkpoints kills all the checkpoints. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * infcmd.c (kill_command): Remove dead code. --- gdb/infcmd.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index d7a7e6f933..a12dba23aa 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2503,20 +2503,6 @@ kill_command (const char *arg, int from_tty) printf_unfiltered (_("[Inferior %d (%s) killed]\n"), infnum, pid_str.c_str ()); - /* If we still have other inferiors to debug, then don't mess with - with their threads. */ - if (!have_inferiors ()) - { - init_thread_list (); /* Destroy thread info. */ - - /* Killing off the inferior can leave us with a core file. If - so, print the state we are left in. */ - if (target_has_stack) - { - printf_filtered (_("In %s,\n"), target_longname); - print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1); - } - } bfd_cache_close_all (); }