mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-28 01:50:48 +00:00
* config/nm-linux.h (linux_record_stopped_pid): New prototype.
* lin-lwp.c (child_wait): Call linux_record_stopped_pid. (lin_lwp_wait): Likewise. Update comments. * linux-nat.c (struct simple_pid_list, add_to_pid_list) (pull_pid_from_list, linux_record_stopped_pid): New.
This commit is contained in:
@@ -54,11 +54,52 @@
|
||||
#define __WALL 0x40000000 /* Wait for any child. */
|
||||
#endif
|
||||
|
||||
struct simple_pid_list
|
||||
{
|
||||
int pid;
|
||||
struct simple_pid_list *next;
|
||||
};
|
||||
struct simple_pid_list *stopped_pids;
|
||||
|
||||
/* This variable is a tri-state flag: -1 for unknown, 0 if PTRACE_O_TRACEFORK
|
||||
can not be used, 1 if it can. */
|
||||
|
||||
static int linux_supports_tracefork_flag = -1;
|
||||
|
||||
|
||||
/* Trivial list manipulation functions to keep track of a list of
|
||||
new stopped processes. */
|
||||
static void
|
||||
add_to_pid_list (struct simple_pid_list **listp, int pid)
|
||||
{
|
||||
struct simple_pid_list *new_pid = xmalloc (sizeof (struct simple_pid_list));
|
||||
new_pid->pid = pid;
|
||||
new_pid->next = *listp;
|
||||
*listp = new_pid;
|
||||
}
|
||||
|
||||
static int
|
||||
pull_pid_from_list (struct simple_pid_list **listp, int pid)
|
||||
{
|
||||
struct simple_pid_list **p;
|
||||
|
||||
for (p = listp; *p != NULL; p = &(*p)->next)
|
||||
if ((*p)->pid == pid)
|
||||
{
|
||||
struct simple_pid_list *next = (*p)->next;
|
||||
xfree (*p);
|
||||
*p = next;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
linux_record_stopped_pid (int pid)
|
||||
{
|
||||
add_to_pid_list (&stopped_pids, pid);
|
||||
}
|
||||
|
||||
|
||||
/* A helper function for linux_test_for_tracefork, called after fork (). */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user