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
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;
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);