aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2003-06-18 23:33:31 +0000
committerDaniel Jacobowitz <drow@false.org>2003-06-18 23:33:31 +0000
commitae087d0195ddbd57e4e065c617076c6236237837 (patch)
tree10853c798b5dbe5edab759ea32f617476a6bcb82 /gdb/linux-nat.c
parent931e13a666718cee753747c6fa61b413db1ca6e2 (diff)
downloadgdb-ae087d0195ddbd57e4e065c617076c6236237837.zip
gdb-ae087d0195ddbd57e4e065c617076c6236237837.tar.gz
gdb-ae087d0195ddbd57e4e065c617076c6236237837.tar.bz2
* 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.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 046544d..bef737b 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -54,12 +54,53 @@
#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 (). */
static void