From patchwork Fri Sep 6 23:27:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 34422 Received: (qmail 120435 invoked by alias); 6 Sep 2019 23:28:22 -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 120350 invoked by uid 89); 6 Sep 2019 23:28:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= 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:28:20 +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 6D2C630A76BB for ; Fri, 6 Sep 2019 23:28:19 +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 0ACC35DA21 for ; Fri, 6 Sep 2019 23:28:18 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 11/23] tfile_target::close: trace_fd can't be -1 Date: Sat, 7 Sep 2019 00:27:55 +0100 Message-Id: <20190906232807.6191-12-palves@redhat.com> In-Reply-To: <20190906232807.6191-1-palves@redhat.com> References: <20190906232807.6191-1-palves@redhat.com> It's not possible to open a tfile target with an invalid trace_fd, and it's not possible to close a closed target, so this early return is dead. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * tracefile-tfile.c (tfile_target::close): Assert that trace_fd is not -1. --- gdb/tracefile-tfile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 5c3837ec5b..c5063e66b0 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -616,8 +616,7 @@ tfile_interp_line (char *line, struct uploaded_tp **utpp, void tfile_target::close () { - if (trace_fd < 0) - return; + gdb_assert (trace_fd != -1); inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */ exit_inferior_silent (current_inferior ());