Unregister the the rocm event handler
authorLaurent Morichetti <laurent.morichetti@amd.com>
Fri, 24 Apr 2020 01:04:41 +0000 (18:04 -0700)
committerLaurent Morichetti <laurent.morichetti@amd.com>
Wed, 6 May 2020 20:50:55 +0000 (13:50 -0700)
When the target closes, unregister our event handler from the
event loop.

Change-Id: Ic3c072c4de6f90c2c55a1d681a9a2d7e4c507609

gdb/rocm-tdep.c

index de92f5aaf2b3dd39138b99fe611a189aba79e975..4cd14a6b15dd1f7e7ea9c5dd54f263cfc3ea0922 100644 (file)
@@ -129,6 +129,7 @@ struct rocm_target_ops final : public target_ops
     return arch_stratum;
   }
 
+  void close () override;
   void mourn_inferior () override;
 
   void async (int enable) override;
@@ -659,11 +660,11 @@ rocm_target_ops::async (int enable)
     }
   else
     {
-      delete_file_handler (rocm_event_pipe[0]);
-
       if (rocm_event_pipe[0] == -1)
         return;
 
+      delete_file_handler (rocm_event_pipe[0]);
+
       ::close (rocm_event_pipe[0]);
       ::close (rocm_event_pipe[1]);
       rocm_event_pipe[0] = -1;
@@ -899,6 +900,14 @@ rocm_target_ops::stopped_by_sw_breakpoint ()
   return software_breakpoint_inserted_here_p (regcache->aspace (), bkpt_pc);
 }
 
+void
+rocm_target_ops::close ()
+{
+  /* Unregister from the event loop.  */
+  async (0);
+  beneath ()->close ();
+}
+
 void
 rocm_target_ops::mourn_inferior ()
 {
This page took 0.025926 seconds and 4 git commands to generate.