mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 06:45:56 +08:00
inf-ptrace: Add an event_pipe to be used for async mode in subclasses.
Subclasses of inf_ptrace_target have to opt-in to using the event_pipe by implementing the can_async_p and async methods. For subclasses which do this, inf_ptrace_target provides is_async_p, async_wait_fd and closes the pipe in the close target method. inf_ptrace_target also provides wrapper routines around the event pipe (async_file_open, async_file_close, async_file_flush, and async_file_mark) for use in target methods such as async. inf_ptrace_target also exports a static async_file_mark_if_open function which can be used in SIGCHLD signal handlers.
This commit is contained in:
@ -48,6 +48,9 @@ gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr,
|
||||
#endif
|
||||
}
|
||||
|
||||
/* The event pipe registered as a waitable file in the event loop. */
|
||||
event_pipe inf_ptrace_target::m_event_pipe;
|
||||
|
||||
inf_ptrace_target::~inf_ptrace_target ()
|
||||
{}
|
||||
|
||||
@ -527,3 +530,15 @@ inf_ptrace_target::pid_to_str (ptid_t ptid)
|
||||
{
|
||||
return normal_pid_to_str (ptid);
|
||||
}
|
||||
|
||||
/* Implement the "close" target method. */
|
||||
|
||||
void
|
||||
inf_ptrace_target::close ()
|
||||
{
|
||||
/* Unregister from the event loop. */
|
||||
if (is_async_p ())
|
||||
async (0);
|
||||
|
||||
inf_child_target::close ();
|
||||
}
|
||||
|
Reference in New Issue
Block a user