From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106756 invoked by alias); 17 Oct 2019 22:50:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 106679 invoked by uid 89); 17 Oct 2019 22:50:40 -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 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; Thu, 17 Oct 2019 22:50:39 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36C8110C0930 for ; Thu, 17 Oct 2019 22:50:38 +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 B9EB81001B08 for ; Thu, 17 Oct 2019 22:50:37 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 11/24] tfile_target::close: trace_fd can't be -1 Date: Thu, 17 Oct 2019 22:50:00 -0000 Message-Id: <20191017225026.30496-12-palves@redhat.com> In-Reply-To: <20191017225026.30496-1-palves@redhat.com> References: <20191017225026.30496-1-palves@redhat.com> X-SW-Source: 2019-10/txt/msg00592.txt.bz2 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 ()); -- 2.14.5