Fix test failures (timeout)
authorLaurent Morichetti <laurent.morichetti@amd.com>
Sun, 22 Dec 2019 05:07:31 +0000 (21:07 -0800)
committerLaurent Morichetti <laurent.morichetti@amd.com>
Sun, 22 Dec 2019 05:07:31 +0000 (21:07 -0800)
The following tests:

  - gdb.base/catch-fork-kill.exp
  - gdb.base/coredump-filter.exp
  - gdb.base/corefile.exp
  - gdb.base/multi-forks.exp
  - gdb.multi/watchpoint-multi-exit.exp
  - gdb.threads/fork-plus-threads.exp
  - gdb.threads/gcore-thread.exp
  - gdb.threads/process-dies-while-detaching.exp

timeout after a target, for which amd_dbgapi_process_attach failed,
terminates. When amd_dbgapi_process_attach fails, the notifier file
desriptor is left uninitialized, and rocm_target_inferior_exit ends
up closing stdin. Without stdin, gdb no longer receives any input
and hangs.

amd_dbapi_notifier should have a default value of -1 (not a valid
file descriptor), and rocm_target_inferior_exit should test the
notifier file descriptor before closing it.

gdb/ChangeLog:

        * rocm-tdep.c (rocm_inferior_info::process_id): Initialize.
        (rocm_inferior_info::notifier): Initialize.
        (rocm_target_inferior_exit): Test notifier before closing.

Change-Id: Ib7e2404440cb377a1e5235d24844aab70f801eb7

gdb/rocm-tdep.c

index 2989a82081d356586594fc5642c0d676067671ac..06153eeda01edf59e1be790c032146c4b7495199 100644 (file)
@@ -76,10 +76,10 @@ struct rocm_notify_shared_library_info
 struct rocm_inferior_info
 {
   /* The amd_dbgapi_process_id for this inferior.  */
-  amd_dbgapi_process_id_t process_id;
+  amd_dbgapi_process_id_t process_id{ AMD_DBGAPI_PROCESS_NONE };
 
   /* The amd_dbgapi_notifier_t for this inferior.  */
-  amd_dbgapi_notifier_t notifier;
+  amd_dbgapi_notifier_t notifier{ -1 };
 
   /* True if commit_resume should all-start the GPU queues.  */
   bool commit_resume_all_start;
@@ -1210,7 +1210,8 @@ rocm_target_inferior_exit (struct inferior *inf)
 
   amd_dbgapi_deactivated.notify ();
 
-  delete_file_handler (info->notifier);
+  if (info->notifier != -1)
+    delete_file_handler (info->notifier);
 
   amd_dbgapi_process_detach (info->process_id);
 
This page took 0.026164 seconds and 4 git commands to generate.