]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-attach-fail-reasons-2of5.patch
- upstream patch updated (dwarf-4 performance fixes), release 2.
[packages/gdb.git] / gdb-attach-fail-reasons-2of5.patch
CommitLineData
f412e1b4
PS
1http://sourceware.org/ml/gdb-cvs/2012-02/msg00181.html
2
3### src/gdb/ChangeLog 2012/02/24 23:48:37 1.13869
4### src/gdb/ChangeLog 2012/02/27 16:22:06 1.13870
5## -1,3 +1,13 @@
6+2012-02-27 Pedro Alves <palves@redhat.com>
7+
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.
15+
16 2012-02-24 Maciej W. Rozycki <macro@codesourcery.com>
17
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);
23 }
24
25-/* Detect `T (stopped)' in `/proc/PID/status'.
26- Other states including `T (tracing stop)' are reported as false. */
27-
28-static int
29-pid_is_stopped (pid_t pid)
30-{
31- FILE *status_file;
32- char buf[100];
33- int retval = 0;
34-
35- snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
36- status_file = fopen (buf, "r");
37- if (status_file != NULL)
38- {
39- int have_state = 0;
40-
41- while (fgets (buf, sizeof (buf), status_file))
42- {
43- if (strncmp (buf, "State:", 6) == 0)
44- {
45- have_state = 1;
46- break;
47- }
48- }
49- if (have_state && strstr (buf, "T (stopped)") != NULL)
50- retval = 1;
51- fclose (status_file);
52- }
53- return retval;
54-}
55-
56 /* Wait for the LWP specified by LP, which we have just attached to.
57 Returns a wait status for that LWP, to cache. */
58
59@@ -1397,7 +1366,7 @@
60 pid_t new_pid, pid = GET_LWP (ptid);
61 int status;
62
63- if (pid_is_stopped (pid))
64+ if (linux_proc_pid_is_stopped (pid))
65 {
66 if (debug_linux_nat)
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
70@@ -53,3 +53,34 @@
71
72 return tgid;
73 }
74+
75+/* Detect `T (stopped)' in `/proc/PID/status'.
76+ Other states including `T (tracing stop)' are reported as false. */
77+
78+int
79+linux_proc_pid_is_stopped (pid_t pid)
80+{
81+ FILE *status_file;
82+ char buf[100];
83+ int retval = 0;
84+
85+ snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
86+ status_file = fopen (buf, "r");
87+ if (status_file != NULL)
88+ {
89+ int have_state = 0;
90+
91+ while (fgets (buf, sizeof (buf), status_file))
92+ {
93+ if (strncmp (buf, "State:", 6) == 0)
94+ {
95+ have_state = 1;
96+ break;
97+ }
98+ }
99+ if (have_state && strstr (buf, "T (stopped)") != NULL)
100+ retval = 1;
101+ fclose (status_file);
102+ }
103+ return retval;
104+}
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
107@@ -26,4 +26,9 @@
108
109 extern int linux_proc_get_tgid (int lwpid);
110
111+/* Detect `T (stopped)' in `/proc/PID/status'.
112+ Other states including `T (tracing stop)' are reported as false. */
113+
114+extern int linux_proc_pid_is_stopped (pid_t pid);
115+
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
119## -1,5 +1,10 @@
120 2012-02-27 Pedro Alves <palves@redhat.com>
121
122+ * linux-low.c (pid_is_stopped): Delete, moved to common/.
123+ (linux_attach_lwp_1): Adjust to use linux_proc_pid_is_stopped.
124+
125+2012-02-27 Pedro Alves <palves@redhat.com>
126+
127 PR server/9684
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
132@@ -598,37 +598,6 @@
133 return pid;
134 }
135
136-/* Detect `T (stopped)' in `/proc/PID/status'.
137- Other states including `T (tracing stop)' are reported as false. */
138-
139-static int
140-pid_is_stopped (pid_t pid)
141-{
142- FILE *status_file;
143- char buf[100];
144- int retval = 0;
145-
146- snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
147- status_file = fopen (buf, "r");
148- if (status_file != NULL)
149- {
150- int have_state = 0;
151-
152- while (fgets (buf, sizeof (buf), status_file))
153- {
154- if (strncmp (buf, "State:", 6) == 0)
155- {
156- have_state = 1;
157- break;
158- }
159- }
160- if (have_state && strstr (buf, "T (stopped)") != NULL)
161- retval = 1;
162- fclose (status_file);
163- }
164- return retval;
165-}
166-
167 /* Attach to an inferior process. */
168
169 static void
170@@ -674,7 +643,7 @@
171 ptrace call on this LWP. */
172 new_lwp->must_set_ptrace_flags = 1;
173
174- if (pid_is_stopped (lwpid))
175+ if (linux_proc_pid_is_stopped (lwpid))
176 {
177 if (debug_threads)
178 fprintf (stderr,
This page took 0.219513 seconds and 4 git commands to generate.