From c17e02e1b55b5e9cbdc6581f05bfec96dc8436f4 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 10 Jan 2020 20:05:50 +0000 Subject: [PATCH] tfile_target::close: trace_fd can't be -1 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: 2020-01-10 Pedro Alves * tracefile-tfile.c (tfile_target::close): Assert that trace_fd is not -1. --- gdb/ChangeLog | 5 +++++ gdb/tracefile-tfile.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2d18e3e4399..49501dfd4f2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-01-10 Pedro Alves + + * tracefile-tfile.c (tfile_target::close): Assert that trace_fd is + not -1. + 2020-01-10 Pedro Alves * break-catch-sig.c (signal_catchpoint_print_it): Don't pass a diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 1ceb03e6918..977c0dab06b 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.30.2