This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 11/24] tfile_target::close: trace_fd can't be -1
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 17 Oct 2019 23:50:13 +0100
- Subject: [PATCH v2 11/24] tfile_target::close: trace_fd can't be -1
- References: <20191017225026.30496-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 <palves@redhat.com>
* 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