1 http://sourceware.org/ml/gdb-cvs/2012-02/msg00181.html
3 ### src/gdb/ChangeLog 2012/02/24 23:48:37 1.13869
4 ### src/gdb/ChangeLog 2012/02/27 16:22:06 1.13870
6 +2012-02-27 Pedro Alves <palves@redhat.com>
8 + * linux-nat.c (pid_is_stopped): Delete, moved to common/.
9 + (linux_nat_post_attach_wait): Adjust to use
10 + linux_proc_pid_is_stopped.
11 + * common/linux-procfs.h (linux_proc_pid_is_stopped): Declare.
12 + * common/linux-procfs.c (linux_proc_pid_is_stopped): New function,
13 + based on pid_is_stopped from both linux-nat.c and
14 + gdbserver/linux-low.c, and renamed.
16 2012-02-24 Maciej W. Rozycki <macro@codesourcery.com>
18 * remote.c (remote_watchpoint_addr_within_range): New function.
19 --- src/gdb/linux-nat.c 2012/02/16 21:07:20 1.239
20 +++ src/gdb/linux-nat.c 2012/02/27 16:22:13 1.240
21 @@ -1356,37 +1356,6 @@
22 delete_lwp (lp->ptid);
25 -/* Detect `T (stopped)' in `/proc/PID/status'.
26 - Other states including `T (tracing stop)' are reported as false. */
29 -pid_is_stopped (pid_t pid)
35 - snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
36 - status_file = fopen (buf, "r");
37 - if (status_file != NULL)
41 - while (fgets (buf, sizeof (buf), status_file))
43 - if (strncmp (buf, "State:", 6) == 0)
49 - if (have_state && strstr (buf, "T (stopped)") != NULL)
51 - fclose (status_file);
56 /* Wait for the LWP specified by LP, which we have just attached to.
57 Returns a wait status for that LWP, to cache. */
60 pid_t new_pid, pid = GET_LWP (ptid);
63 - if (pid_is_stopped (pid))
64 + if (linux_proc_pid_is_stopped (pid))
67 fprintf_unfiltered (gdb_stdlog,
68 --- src/gdb/common/linux-procfs.c 2012/01/04 08:17:18 1.2
69 +++ src/gdb/common/linux-procfs.c 2012/02/27 16:22:14 1.3
75 +/* Detect `T (stopped)' in `/proc/PID/status'.
76 + Other states including `T (tracing stop)' are reported as false. */
79 +linux_proc_pid_is_stopped (pid_t pid)
85 + snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
86 + status_file = fopen (buf, "r");
87 + if (status_file != NULL)
91 + while (fgets (buf, sizeof (buf), status_file))
93 + if (strncmp (buf, "State:", 6) == 0)
99 + if (have_state && strstr (buf, "T (stopped)") != NULL)
101 + fclose (status_file);
105 --- src/gdb/common/linux-procfs.h 2012/01/04 08:17:18 1.2
106 +++ src/gdb/common/linux-procfs.h 2012/02/27 16:22:15 1.3
109 extern int linux_proc_get_tgid (int lwpid);
111 +/* Detect `T (stopped)' in `/proc/PID/status'.
112 + Other states including `T (tracing stop)' are reported as false. */
114 +extern int linux_proc_pid_is_stopped (pid_t pid);
116 #endif /* COMMON_LINUX_PROCFS_H */
117 ### src/gdb/gdbserver/ChangeLog 2012/02/27 16:19:19 1.557
118 ### src/gdb/gdbserver/ChangeLog 2012/02/27 16:22:15 1.558
120 2012-02-27 Pedro Alves <palves@redhat.com>
122 + * linux-low.c (pid_is_stopped): Delete, moved to common/.
123 + (linux_attach_lwp_1): Adjust to use linux_proc_pid_is_stopped.
125 +2012-02-27 Pedro Alves <palves@redhat.com>
128 * linux-low.c (pid_is_stopped): New.
129 (linux_attach_lwp_1): Handle attaching to 'T (stopped)' processes.
130 --- src/gdb/gdbserver/linux-low.c 2012/02/27 16:19:19 1.194
131 +++ src/gdb/gdbserver/linux-low.c 2012/02/27 16:22:16 1.195
136 -/* Detect `T (stopped)' in `/proc/PID/status'.
137 - Other states including `T (tracing stop)' are reported as false. */
140 -pid_is_stopped (pid_t pid)
146 - snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
147 - status_file = fopen (buf, "r");
148 - if (status_file != NULL)
150 - int have_state = 0;
152 - while (fgets (buf, sizeof (buf), status_file))
154 - if (strncmp (buf, "State:", 6) == 0)
160 - if (have_state && strstr (buf, "T (stopped)") != NULL)
162 - fclose (status_file);
167 /* Attach to an inferior process. */
171 ptrace call on this LWP. */
172 new_lwp->must_set_ptrace_flags = 1;
174 - if (pid_is_stopped (lwpid))
175 + if (linux_proc_pid_is_stopped (lwpid))