tfile_target::close: trace_fd can't be -1
authorPedro Alves <palves@redhat.com>
Fri, 10 Jan 2020 20:05:50 +0000 (20:05 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 10 Jan 2020 20:05:50 +0000 (20:05 +0000)
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  <palves@redhat.com>

* tracefile-tfile.c (tfile_target::close): Assert that trace_fd is
not -1.

gdb/ChangeLog
gdb/tracefile-tfile.c

index 2d18e3e4399aa6b49a80a3eae82664b420a2f804..49501dfd4f2edf52933d35ea0fccd62841114708 100644 (file)
@@ -1,3 +1,8 @@
+2020-01-10  Pedro Alves  <palves@redhat.com>
+
+       * tracefile-tfile.c (tfile_target::close): Assert that trace_fd is
+       not -1.
+
 2020-01-10  Pedro Alves  <palves@redhat.com>
 
        * break-catch-sig.c (signal_catchpoint_print_it): Don't pass a
index 1ceb03e6918ec418c119a52da284380d7619d67b..977c0dab06b0c8b94867ea7538060d469f668b79 100644 (file)
@@ -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 ());
This page took 0.027792 seconds and 4 git commands to generate.