]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-attach-fail-reasons-3of5.patch
- updated (performance fixes).
[packages/gdb.git] / gdb-attach-fail-reasons-3of5.patch
1 http://sourceware.org/ml/gdb-patches/2012-03/msg00169.html
2 Subject: [patch 1/3] attach-fail-reasons: Reshuffle code
3
4 Hi,
5
6 this patch does not make sense on its own but it contains all the
7 uninteresting code moves / reconfigurations.
8
9
10 Thanks,
11 Jan
12
13
14 gdb/
15 2012-03-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
16
17         * Makefile.in (linux-ptrace.o): New.
18         * common/linux-procfs.c (linux_proc_pid_is_zombie): New,
19         from linux-nat.c.
20         * common/linux-procfs.h (linux_proc_pid_is_zombie): New declaration.
21         * common/linux-ptrace.c: New file.
22         * config/alpha/alpha-linux.mh (NATDEPFILES): Add linux-ptrace.o.
23         * config/arm/linux.mh: Likewise.
24         * config/i386/linux.mh: Likewise.
25         * config/i386/linux64.mh: Likewise.
26         * config/ia64/linux.mh: Likewise.
27         * config/m32r/linux.mh: Likewise.
28         * config/m68k/linux.mh: Likewise.
29         * config/mips/linux.mh: Likewise.
30         * config/pa/linux.mh: Likewise.
31         * config/powerpc/linux.mh: Likewise.
32         * config/powerpc/ppc64-linux.mh: Likewise.
33         * config/powerpc/spu-linux.mh: Likewise.
34         * config/s390/s390.mh: Likewise.
35         * config/sparc/linux.mh: Likewise.
36         * config/sparc/linux64.mh: Likewise.
37         * config/xtensa/linux.mh: Likewise.
38         * linux-nat.c (linux_lwp_is_zombie): Remove, move it to
39         common/linux-procfs.c.
40         (wait_lwp): Rename linux_lwp_is_zombie to linux_proc_pid_is_zombie.
41
42 gdb/gdbserver/
43 2012-03-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
44
45         * Makefile.in (linux-ptrace.o): New.
46         * configure.srv (arm*-*-linux*, bfin-*-*linux*, crisv32-*-linux*)
47         (cris-*-linux*, i[34567]86-*-linux*, ia64-*-linux*, m32r*-*-linux*)
48         (m68*-*-linux*, m68*-*-uclinux*, mips*-*-linux*, powerpc*-*-linux*)
49         (s390*-*-linux*, sh*-*-linux*, sparc*-*-linux*, tic6x-*-uclinux)
50         (x86_64-*-linux*, xtensa*-*-linux*): Add linux-ptrace.o to SRV_TGTOBJ
51         of these targets.
52         * linux-low.c (linux_attach_lwp_1): Remove redundent else clause.
53
54 Index: gdb-7.4.50.20120120/gdb/Makefile.in
55 ===================================================================
56 --- gdb-7.4.50.20120120.orig/gdb/Makefile.in    2012-03-06 07:39:41.000000000 +0100
57 +++ gdb-7.4.50.20120120/gdb/Makefile.in 2012-03-06 07:39:50.771713128 +0100
58 @@ -1968,6 +1968,10 @@ linux-procfs.o: $(srcdir)/common/linux-p
59         $(COMPILE) $(srcdir)/common/linux-procfs.c
60         $(POSTCOMPILE)
61  
62 +linux-ptrace.o: $(srcdir)/common/linux-ptrace.c
63 +       $(COMPILE) $(srcdir)/common/linux-ptrace.c
64 +       $(POSTCOMPILE)
65 +
66  #
67  # gdb/tui/ dependencies
68  #
69 Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.c
70 ===================================================================
71 --- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.c  2012-03-06 07:39:41.000000000 +0100
72 +++ gdb-7.4.50.20120120/gdb/common/linux-procfs.c       2012-03-06 07:39:50.771713128 +0100
73 @@ -84,3 +84,34 @@ linux_proc_pid_is_stopped (pid_t pid)
74      }
75    return retval;
76  }
77 +
78 +/* See linux-procfs.h declaration.  */
79 +
80 +int
81 +linux_proc_pid_is_zombie (pid_t pid)
82 +{
83 +  char buffer[100];
84 +  FILE *procfile;
85 +  int retval;
86 +  int have_state;
87 +
88 +  xsnprintf (buffer, sizeof (buffer), "/proc/%d/status", (int) pid);
89 +  procfile = fopen (buffer, "r");
90 +  if (procfile == NULL)
91 +    {
92 +      warning (_("unable to open /proc file '%s'"), buffer);
93 +      return 0;
94 +    }
95 +
96 +  have_state = 0;
97 +  while (fgets (buffer, sizeof (buffer), procfile) != NULL)
98 +    if (strncmp (buffer, "State:", 6) == 0)
99 +      {
100 +       have_state = 1;
101 +       break;
102 +      }
103 +  retval = (have_state
104 +           && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
105 +  fclose (procfile);
106 +  return retval;
107 +}
108 Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.h
109 ===================================================================
110 --- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.h  2012-03-06 07:39:41.000000000 +0100
111 +++ gdb-7.4.50.20120120/gdb/common/linux-procfs.h       2012-03-06 07:39:50.771713128 +0100
112 @@ -31,4 +31,8 @@ extern int linux_proc_get_tgid (int lwpi
113  
114  extern int linux_proc_pid_is_stopped (pid_t pid);
115  
116 +/* Return non-zero if PID is a zombie.  */
117 +
118 +extern int linux_proc_pid_is_zombie (pid_t pid);
119 +
120  #endif /* COMMON_LINUX_PROCFS_H */
121 Index: gdb-7.4.50.20120120/gdb/common/linux-ptrace.c
122 ===================================================================
123 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
124 +++ gdb-7.4.50.20120120/gdb/common/linux-ptrace.c       2012-03-06 07:39:50.771713128 +0100
125 @@ -0,0 +1,26 @@
126 +/* Linux-specific ptrace manipulation routines.
127 +   Copyright (C) 2012 Free Software Foundation, Inc.
128 +
129 +   This file is part of GDB.
130 +
131 +   This program is free software; you can redistribute it and/or modify
132 +   it under the terms of the GNU General Public License as published by
133 +   the Free Software Foundation; either version 3 of the License, or
134 +   (at your option) any later version.
135 +
136 +   This program is distributed in the hope that it will be useful,
137 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
138 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
139 +   GNU General Public License for more details.
140 +
141 +   You should have received a copy of the GNU General Public License
142 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
143 +
144 +#ifdef GDBSERVER
145 +#include "server.h"
146 +#else
147 +#include "defs.h"
148 +#include "gdb_string.h"
149 +#endif
150 +
151 +#include "linux-ptrace.h"
152 Index: gdb-7.4.50.20120120/gdb/config/alpha/alpha-linux.mh
153 ===================================================================
154 --- gdb-7.4.50.20120120.orig/gdb/config/alpha/alpha-linux.mh    2012-01-10 17:30:44.000000000 +0100
155 +++ gdb-7.4.50.20120120/gdb/config/alpha/alpha-linux.mh 2012-03-06 07:39:50.771713128 +0100
156 @@ -2,7 +2,7 @@
157  NAT_FILE= config/nm-linux.h
158  NATDEPFILES= inf-ptrace.o alpha-linux-nat.o \
159         fork-child.o proc-service.o linux-thread-db.o \
160 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
161 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
162  NAT_CDEPS = $(srcdir)/proc-service.list
163  
164  # The dynamically loaded libthread_db needs access to symbols in the
165 Index: gdb-7.4.50.20120120/gdb/config/arm/linux.mh
166 ===================================================================
167 --- gdb-7.4.50.20120120.orig/gdb/config/arm/linux.mh    2011-08-24 14:07:25.000000000 +0200
168 +++ gdb-7.4.50.20120120/gdb/config/arm/linux.mh 2012-03-06 07:39:50.772713125 +0100
169 @@ -3,7 +3,7 @@
170  NAT_FILE= config/nm-linux.h
171  NATDEPFILES= inf-ptrace.o fork-child.o arm-linux-nat.o \
172         proc-service.o linux-thread-db.o \
173 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
174 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
175  NAT_CDEPS = $(srcdir)/proc-service.list
176  
177  LOADLIBES= -ldl $(RDYNAMIC)
178 Index: gdb-7.4.50.20120120/gdb/config/i386/linux.mh
179 ===================================================================
180 --- gdb-7.4.50.20120120.orig/gdb/config/i386/linux.mh   2012-03-06 07:39:41.000000000 +0100
181 +++ gdb-7.4.50.20120120/gdb/config/i386/linux.mh        2012-03-06 07:39:50.772713125 +0100
182 @@ -4,7 +4,7 @@ NAT_FILE= nm-linux.h
183  NATDEPFILES= inf-ptrace.o fork-child.o \
184         i386-nat.o i386-linux-nat.o \
185         proc-service.o linux-thread-db.o \
186 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
187 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
188  NAT_CDEPS = $(srcdir)/proc-service.list
189  
190  # The dynamically loaded libthread_db needs access to symbols in the
191 Index: gdb-7.4.50.20120120/gdb/config/i386/linux64.mh
192 ===================================================================
193 --- gdb-7.4.50.20120120.orig/gdb/config/i386/linux64.mh 2012-03-06 07:39:41.000000000 +0100
194 +++ gdb-7.4.50.20120120/gdb/config/i386/linux64.mh      2012-03-06 07:39:50.772713125 +0100
195 @@ -3,7 +3,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
196         i386-nat.o amd64-nat.o amd64-linux-nat.o \
197         linux-nat.o linux-osdata.o \
198         proc-service.o linux-thread-db.o linux-fork.o \
199 -       linux-procfs.o
200 +       linux-procfs.o linux-ptrace.o
201  NAT_FILE= nm-linux64.h
202  NAT_CDEPS = $(srcdir)/proc-service.list
203  
204 Index: gdb-7.4.50.20120120/gdb/config/ia64/linux.mh
205 ===================================================================
206 --- gdb-7.4.50.20120120.orig/gdb/config/ia64/linux.mh   2012-01-10 17:30:44.000000000 +0100
207 +++ gdb-7.4.50.20120120/gdb/config/ia64/linux.mh        2012-03-06 07:39:50.772713125 +0100
208 @@ -5,7 +5,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
209         core-regset.o ia64-linux-nat.o \
210         proc-service.o linux-thread-db.o \
211         linux-nat.o linux-osdata.o linux-fork.o \
212 -       linux-procfs.o
213 +       linux-procfs.o linux-ptrace.o
214  NAT_CDEPS = $(srcdir)/proc-service.list
215  
216  LOADLIBES = -ldl $(RDYNAMIC)
217 Index: gdb-7.4.50.20120120/gdb/config/m32r/linux.mh
218 ===================================================================
219 --- gdb-7.4.50.20120120.orig/gdb/config/m32r/linux.mh   2012-01-10 17:30:44.000000000 +0100
220 +++ gdb-7.4.50.20120120/gdb/config/m32r/linux.mh        2012-03-06 07:39:50.773713122 +0100
221 @@ -3,7 +3,7 @@
222  NAT_FILE= config/nm-linux.h
223  NATDEPFILES= inf-ptrace.o fork-child.o                         \
224         m32r-linux-nat.o proc-service.o linux-thread-db.o       \
225 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
226 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
227  NAT_CDEPS = $(srcdir)/proc-service.list
228  
229  LOADLIBES= -ldl $(RDYNAMIC)
230 Index: gdb-7.4.50.20120120/gdb/config/m68k/linux.mh
231 ===================================================================
232 --- gdb-7.4.50.20120120.orig/gdb/config/m68k/linux.mh   2012-01-10 17:30:45.000000000 +0100
233 +++ gdb-7.4.50.20120120/gdb/config/m68k/linux.mh        2012-03-06 07:39:50.773713122 +0100
234 @@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
235  NATDEPFILES= inf-ptrace.o fork-child.o \
236         m68klinux-nat.o \
237         proc-service.o linux-thread-db.o \
238 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
239 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
240  NAT_CDEPS = $(srcdir)/proc-service.list
241  
242  # The dynamically loaded libthread_db needs access to symbols in the
243 Index: gdb-7.4.50.20120120/gdb/config/mips/linux.mh
244 ===================================================================
245 --- gdb-7.4.50.20120120.orig/gdb/config/mips/linux.mh   2011-08-24 14:07:26.000000000 +0200
246 +++ gdb-7.4.50.20120120/gdb/config/mips/linux.mh        2012-03-06 07:39:50.773713122 +0100
247 @@ -3,7 +3,7 @@ NAT_FILE= config/nm-linux.h
248  NATDEPFILES= inf-ptrace.o fork-child.o mips-linux-nat.o \
249         linux-thread-db.o proc-service.o \
250         linux-nat.o linux-osdata.o linux-fork.o \
251 -       linux-procfs.o
252 +       linux-procfs.o linux-ptrace.o
253  NAT_CDEPS = $(srcdir)/proc-service.list
254  
255  LOADLIBES = -ldl $(RDYNAMIC)
256 Index: gdb-7.4.50.20120120/gdb/config/pa/linux.mh
257 ===================================================================
258 --- gdb-7.4.50.20120120.orig/gdb/config/pa/linux.mh     2012-01-10 17:30:45.000000000 +0100
259 +++ gdb-7.4.50.20120120/gdb/config/pa/linux.mh  2012-03-06 07:39:50.773713122 +0100
260 @@ -3,7 +3,7 @@ NAT_FILE= config/nm-linux.h
261  NATDEPFILES= inf-ptrace.o fork-child.o \
262         hppa-linux-nat.o proc-service.o linux-thread-db.o \
263         linux-nat.o linux-osdata.o linux-fork.o \
264 -       linux-procfs.o
265 +       linux-procfs.o linux-ptrace.o
266  NAT_CDEPS = $(srcdir)/proc-service.list
267  
268  LOADLIBES = -ldl $(RDYNAMIC)
269 Index: gdb-7.4.50.20120120/gdb/config/powerpc/linux.mh
270 ===================================================================
271 --- gdb-7.4.50.20120120.orig/gdb/config/powerpc/linux.mh        2011-08-24 14:07:27.000000000 +0200
272 +++ gdb-7.4.50.20120120/gdb/config/powerpc/linux.mh     2012-03-06 07:39:50.773713122 +0100
273 @@ -5,7 +5,7 @@ XM_CLIBS=
274  NAT_FILE= config/nm-linux.h
275  NATDEPFILES= inf-ptrace.o fork-child.o \
276         ppc-linux-nat.o proc-service.o linux-thread-db.o \
277 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
278 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
279  NAT_CDEPS = $(srcdir)/proc-service.list
280  
281  LOADLIBES = -ldl $(RDYNAMIC)
282 Index: gdb-7.4.50.20120120/gdb/config/powerpc/ppc64-linux.mh
283 ===================================================================
284 --- gdb-7.4.50.20120120.orig/gdb/config/powerpc/ppc64-linux.mh  2011-08-24 14:07:27.000000000 +0200
285 +++ gdb-7.4.50.20120120/gdb/config/powerpc/ppc64-linux.mh       2012-03-06 07:39:50.774713118 +0100
286 @@ -5,7 +5,7 @@ XM_CLIBS=
287  NAT_FILE= config/nm-linux.h
288  NATDEPFILES= inf-ptrace.o fork-child.o \
289         ppc-linux-nat.o proc-service.o linux-thread-db.o \
290 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
291 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
292  NAT_CDEPS = $(srcdir)/proc-service.list
293  
294  # The PowerPC has severe limitations on TOC size, and uses them even
295 Index: gdb-7.4.50.20120120/gdb/config/powerpc/spu-linux.mh
296 ===================================================================
297 --- gdb-7.4.50.20120120.orig/gdb/config/powerpc/spu-linux.mh    2011-08-24 14:07:27.000000000 +0200
298 +++ gdb-7.4.50.20120120/gdb/config/powerpc/spu-linux.mh 2012-03-06 07:39:50.774713118 +0100
299 @@ -4,5 +4,5 @@
300  # PPU side of the Cell BE and debugging the SPU side.
301  
302  NATDEPFILES = spu-linux-nat.o fork-child.o inf-ptrace.o \
303 -             linux-procfs.o
304 +             linux-procfs.o linux-ptrace.o
305  
306 Index: gdb-7.4.50.20120120/gdb/config/s390/s390.mh
307 ===================================================================
308 --- gdb-7.4.50.20120120.orig/gdb/config/s390/s390.mh    2012-01-05 18:07:05.000000000 +0100
309 +++ gdb-7.4.50.20120120/gdb/config/s390/s390.mh 2012-03-06 07:39:50.774713118 +0100
310 @@ -2,6 +2,6 @@
311  NAT_FILE= config/nm-linux.h
312  NATDEPFILES= inf-ptrace.o fork-child.o s390-nat.o \
313         linux-thread-db.o proc-service.o \
314 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
315 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
316  NAT_CDEPS = $(srcdir)/proc-service.list
317  LOADLIBES = -ldl $(RDYNAMIC)
318 Index: gdb-7.4.50.20120120/gdb/config/sparc/linux.mh
319 ===================================================================
320 --- gdb-7.4.50.20120120.orig/gdb/config/sparc/linux.mh  2012-01-10 17:30:49.000000000 +0100
321 +++ gdb-7.4.50.20120120/gdb/config/sparc/linux.mh       2012-03-06 07:39:50.774713118 +0100
322 @@ -4,7 +4,7 @@ NATDEPFILES= sparc-nat.o sparc-linux-nat
323         core-regset.o fork-child.o inf-ptrace.o \
324         proc-service.o linux-thread-db.o \
325         linux-nat.o linux-osdata.o linux-fork.o \
326 -       linux-procfs.o
327 +       linux-procfs.o linux-ptrace.o
328  NAT_CDEPS = $(srcdir)/proc-service.list
329  
330  # The dynamically loaded libthread_db needs access to symbols in the
331 Index: gdb-7.4.50.20120120/gdb/config/sparc/linux64.mh
332 ===================================================================
333 --- gdb-7.4.50.20120120.orig/gdb/config/sparc/linux64.mh        2012-01-10 17:30:49.000000000 +0100
334 +++ gdb-7.4.50.20120120/gdb/config/sparc/linux64.mh     2012-03-06 07:39:50.775713114 +0100
335 @@ -5,7 +5,7 @@ NATDEPFILES= sparc-nat.o sparc64-nat.o s
336         fork-child.o inf-ptrace.o \
337         proc-service.o linux-thread-db.o \
338         linux-nat.o linux-osdata.o linux-fork.o \
339 -       linux-procfs.o
340 +       linux-procfs.o linux-ptrace.o
341  NAT_CDEPS = $(srcdir)/proc-service.list
342  
343  # The dynamically loaded libthread_db needs access to symbols in the
344 Index: gdb-7.4.50.20120120/gdb/config/xtensa/linux.mh
345 ===================================================================
346 --- gdb-7.4.50.20120120.orig/gdb/config/xtensa/linux.mh 2011-08-24 14:07:27.000000000 +0200
347 +++ gdb-7.4.50.20120120/gdb/config/xtensa/linux.mh      2012-03-06 07:39:50.775713114 +0100
348 @@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
349  
350  NATDEPFILES= inf-ptrace.o fork-child.o xtensa-linux-nat.o \
351         linux-thread-db.o proc-service.o \
352 -       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
353 +       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
354  NAT_CDEPS = $(srcdir)/proc-service.list
355  
356  LOADLIBES = -ldl $(RDYNAMIC)
357 Index: gdb-7.4.50.20120120/gdb/gdbserver/Makefile.in
358 ===================================================================
359 --- gdb-7.4.50.20120120.orig/gdb/gdbserver/Makefile.in  2012-01-04 09:17:23.000000000 +0100
360 +++ gdb-7.4.50.20120120/gdb/gdbserver/Makefile.in       2012-03-06 07:39:50.775713114 +0100
361 @@ -408,6 +408,9 @@ signals.o: ../common/signals.c $(server_
362  linux-procfs.o: ../common/linux-procfs.c $(server_h)
363         $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
364  
365 +linux-ptrace.o: ../common/linux-ptrace.c $(server_h)
366 +       $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
367 +
368  common-utils.o: ../common/common-utils.c $(server_h)
369         $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
370  
371 Index: gdb-7.4.50.20120120/gdb/gdbserver/configure.srv
372 ===================================================================
373 --- gdb-7.4.50.20120120.orig/gdb/gdbserver/configure.srv        2011-12-06 15:14:49.000000000 +0100
374 +++ gdb-7.4.50.20120120/gdb/gdbserver/configure.srv     2012-03-06 07:39:50.775713114 +0100
375 @@ -47,6 +47,7 @@ case "${target}" in
376                         srv_regobj="${srv_regobj} arm-with-vfpv3.o"
377                         srv_regobj="${srv_regobj} arm-with-neon.o"
378                         srv_tgtobj="linux-low.o linux-osdata.o linux-arm-low.o linux-procfs.o"
379 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
380                         srv_xmlfiles="arm-with-iwmmxt.xml"
381                         srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv2.xml"
382                         srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv3.xml"
383 @@ -69,16 +70,19 @@ case "${target}" in
384                         ;;
385    bfin-*-*linux*)      srv_regobj=reg-bfin.o
386                         srv_tgtobj="linux-low.o linux-osdata.o linux-bfin-low.o linux-procfs.o"
387 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
388                         srv_linux_usrregs=yes
389                         srv_linux_thread_db=yes
390                         ;;
391    crisv32-*-linux*)    srv_regobj=reg-crisv32.o
392                         srv_tgtobj="linux-low.o linux-osdata.o linux-crisv32-low.o linux-procfs.o"
393 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
394                         srv_linux_regsets=yes
395                         srv_linux_thread_db=yes
396                         ;;
397    cris-*-linux*)       srv_regobj=reg-cris.o
398                         srv_tgtobj="linux-low.o linux-osdata.o linux-cris-low.o linux-procfs.o"
399 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
400                         srv_linux_usrregs=yes
401                         srv_linux_thread_db=yes
402                         ;;
403 @@ -93,6 +97,7 @@ case "${target}" in
404                             srv_xmlfiles="${srv_xmlfiles} $srv_amd64_linux_xmlfiles"
405                         fi
406                         srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
407 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
408                         srv_linux_usrregs=yes
409                         srv_linux_regsets=yes
410                         srv_linux_thread_db=yes
411 @@ -124,10 +129,12 @@ case "${target}" in
412                         ;;
413    ia64-*-linux*)       srv_regobj=reg-ia64.o
414                         srv_tgtobj="linux-low.o linux-osdata.o linux-ia64-low.o linux-procfs.o"
415 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
416                         srv_linux_usrregs=yes
417                         ;;
418    m32r*-*-linux*)      srv_regobj=reg-m32r.o
419                         srv_tgtobj="linux-low.o linux-osdata.o linux-m32r-low.o linux-procfs.o"
420 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
421                         srv_linux_usrregs=yes
422                         srv_linux_thread_db=yes
423                         ;;
424 @@ -137,6 +144,7 @@ case "${target}" in
425                            srv_regobj=reg-m68k.o
426                          fi
427                         srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
428 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
429                         srv_linux_usrregs=yes
430                         srv_linux_regsets=yes
431                         srv_linux_thread_db=yes
432 @@ -147,12 +155,14 @@ case "${target}" in
433                            srv_regobj=reg-m68k.o
434                          fi
435                         srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
436 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
437                         srv_linux_usrregs=yes
438                         srv_linux_regsets=yes
439                         srv_linux_thread_db=yes
440                         ;;
441    mips*-*-linux*)      srv_regobj="mips-linux.o mips64-linux.o"
442                         srv_tgtobj="linux-low.o linux-osdata.o linux-mips-low.o linux-procfs.o"
443 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
444                         srv_xmlfiles="mips-linux.xml"
445                         srv_xmlfiles="${srv_xmlfiles} mips-cpu.xml"
446                         srv_xmlfiles="${srv_xmlfiles} mips-cp0.xml"
447 @@ -181,6 +191,7 @@ case "${target}" in
448                         srv_regobj="${srv_regobj} powerpc-isa205-altivec64l.o"
449                         srv_regobj="${srv_regobj} powerpc-isa205-vsx64l.o"
450                         srv_tgtobj="linux-low.o linux-osdata.o linux-ppc-low.o linux-procfs.o"
451 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
452                         srv_xmlfiles="rs6000/powerpc-32l.xml"
453                         srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml"
454                         srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell32l.xml"
455 @@ -223,6 +234,7 @@ case "${target}" in
456                         srv_regobj="${srv_regobj} s390x-linux64v1.o"
457                         srv_regobj="${srv_regobj} s390x-linux64v2.o"
458                         srv_tgtobj="linux-low.o linux-osdata.o linux-s390-low.o linux-procfs.o"
459 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
460                         srv_xmlfiles="s390-linux32.xml"
461                         srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml"
462                         srv_xmlfiles="${srv_xmlfiles} s390-linux32v2.xml"
463 @@ -243,12 +255,14 @@ case "${target}" in
464                         ;;
465    sh*-*-linux*)                srv_regobj=reg-sh.o
466                         srv_tgtobj="linux-low.o linux-osdata.o linux-sh-low.o linux-procfs.o"
467 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
468                         srv_linux_usrregs=yes
469                         srv_linux_regsets=yes
470                         srv_linux_thread_db=yes
471                         ;;
472    sparc*-*-linux*)     srv_regobj=reg-sparc64.o
473                         srv_tgtobj="linux-low.o linux-osdata.o linux-sparc-low.o linux-procfs.o"
474 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
475                         srv_linux_regsets=yes
476                         srv_linux_thread_db=yes
477                         ;;
478 @@ -265,12 +279,14 @@ case "${target}" in
479                         srv_xmlfiles="${srv_xmlfiles} tic6x-gp.xml"
480                         srv_xmlfiles="${srv_xmlfiles} tic6x-c6xp.xml"
481                         srv_tgtobj="linux-low.o linux-osdata.o linux-tic6x-low.o linux-procfs.o"
482 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
483                         srv_linux_regsets=yes
484                         srv_linux_usrregs=yes
485                         srv_linux_thread_db=yes
486                         ;;
487    x86_64-*-linux*)     srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
488                         srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
489 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
490                         srv_xmlfiles="$srv_i386_linux_xmlfiles $srv_amd64_linux_xmlfiles"
491                         srv_linux_usrregs=yes # This is for i386 progs.
492                         srv_linux_regsets=yes
493 @@ -285,6 +301,7 @@ case "${target}" in
494  
495    xtensa*-*-linux*)    srv_regobj=reg-xtensa.o
496                         srv_tgtobj="linux-low.o linux-osdata.o linux-xtensa-low.o linux-procfs.o"
497 +                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
498                         srv_linux_regsets=yes
499                         ;;
500    *)                   echo "Error: target not supported by gdbserver."
501 Index: gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c
502 ===================================================================
503 --- gdb-7.4.50.20120120.orig/gdb/gdbserver/linux-low.c  2012-03-06 07:39:41.000000000 +0100
504 +++ gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c       2012-03-06 07:39:50.776713111 +0100
505 @@ -630,10 +630,10 @@ linux_attach_lwp_1 (unsigned long lwpid,
506           fflush (stderr);
507           return;
508         }
509 -      else
510 -       /* If we fail to attach to a process, report an error.  */
511 -       error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
512 -              strerror (errno), errno);
513 +
514 +      /* If we fail to attach to a process, report an error.  */
515 +      error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
516 +            strerror (errno), errno);
517      }
518  
519    if (initial)
520 Index: gdb-7.4.50.20120120/gdb/linux-nat.c
521 ===================================================================
522 --- gdb-7.4.50.20120120.orig/gdb/linux-nat.c    2012-03-06 07:39:41.000000000 +0100
523 +++ gdb-7.4.50.20120120/gdb/linux-nat.c 2012-03-06 07:39:50.777713108 +0100
524 @@ -2464,37 +2464,6 @@ linux_handle_extended_wait (struct lwp_i
525                   _("unknown ptrace event %d"), event);
526  }
527  
528 -/* Return non-zero if LWP is a zombie.  */
529 -
530 -static int
531 -linux_lwp_is_zombie (long lwp)
532 -{
533 -  char buffer[MAXPATHLEN];
534 -  FILE *procfile;
535 -  int retval;
536 -  int have_state;
537 -
538 -  xsnprintf (buffer, sizeof (buffer), "/proc/%ld/status", lwp);
539 -  procfile = fopen (buffer, "r");
540 -  if (procfile == NULL)
541 -    {
542 -      warning (_("unable to open /proc file '%s'"), buffer);
543 -      return 0;
544 -    }
545 -
546 -  have_state = 0;
547 -  while (fgets (buffer, sizeof (buffer), procfile) != NULL)
548 -    if (strncmp (buffer, "State:", 6) == 0)
549 -      {
550 -       have_state = 1;
551 -       break;
552 -      }
553 -  retval = (have_state
554 -           && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
555 -  fclose (procfile);
556 -  return retval;
557 -}
558 -
559  /* Wait for LP to stop.  Returns the wait status, or 0 if the LWP has
560     exited.  */
561  
562 @@ -2548,10 +2517,10 @@ wait_lwp (struct lwp_info *lp)
563  
564          This is racy, what if the tgl becomes a zombie right after we check?
565          Therefore always use WNOHANG with sigsuspend - it is equivalent to
566 -        waiting waitpid but the linux_lwp_is_zombie is safe this way.  */
567 +        waiting waitpid but linux_proc_pid_is_zombie is safe this way.  */
568  
569        if (GET_PID (lp->ptid) == GET_LWP (lp->ptid)
570 -         && linux_lwp_is_zombie (GET_LWP (lp->ptid)))
571 +         && linux_proc_pid_is_zombie (GET_LWP (lp->ptid)))
572         {
573           thread_dead = 1;
574           if (debug_linux_nat)
575 @@ -3431,7 +3400,7 @@ check_zombie_leaders (void)
576           /* Check if there are other threads in the group, as we may
577              have raced with the inferior simply exiting.  */
578           && num_lwps (inf->pid) > 1
579 -         && linux_lwp_is_zombie (inf->pid))
580 +         && linux_proc_pid_is_zombie (inf->pid))
581         {
582           if (debug_linux_nat)
583             fprintf_unfiltered (gdb_stdlog,
This page took 0.078794 seconds and 3 git commands to generate.