gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 13 Mar 2012 15:00:37 +0000 (15:00 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Tue, 13 Mar 2012 15:00:37 +0000 (15:00 +0000)
* Makefile.in (linux-ptrace.o): New.
* common/linux-procfs.c (linux_proc_pid_is_zombie): New,
from linux-nat.c.
* common/linux-procfs.h (linux_proc_pid_is_zombie): New declaration.
* common/linux-ptrace.c: New file.
* config/alpha/alpha-linux.mh (NATDEPFILES): Add linux-ptrace.o.
* config/arm/linux.mh: Likewise.
* config/i386/linux.mh: Likewise.
* config/i386/linux64.mh: Likewise.
* config/ia64/linux.mh: Likewise.
* config/m32r/linux.mh: Likewise.
* config/m68k/linux.mh: Likewise.
* config/mips/linux.mh: Likewise.
* config/pa/linux.mh: Likewise.
* config/powerpc/linux.mh: Likewise.
* config/powerpc/ppc64-linux.mh: Likewise.
* config/powerpc/spu-linux.mh: Likewise.
* config/s390/s390.mh: Likewise.
* config/sparc/linux.mh: Likewise.
* config/sparc/linux64.mh: Likewise.
* config/xtensa/linux.mh: Likewise.
* linux-nat.c (linux_lwp_is_zombie): Remove, move it to
common/linux-procfs.c.
(wait_lwp): Rename linux_lwp_is_zombie to linux_proc_pid_is_zombie.

gdb/gdbserver/
* Makefile.in (linux-ptrace.o): New.
* configure.srv (arm*-*-linux*, bfin-*-*linux*, crisv32-*-linux*)
(cris-*-linux*, i[34567]86-*-linux*, ia64-*-linux*, m32r*-*-linux*)
(m68*-*-linux*, m68*-*-uclinux*, mips*-*-linux*, powerpc*-*-linux*)
(s390*-*-linux*, sh*-*-linux*, sparc*-*-linux*, tic6x-*-uclinux)
(x86_64-*-linux*, xtensa*-*-linux*): Add linux-ptrace.o to SRV_TGTOBJ
of these targets.
* linux-low.c (linux_attach_lwp_1): Remove redundent else clause.

26 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/common/linux-procfs.c
gdb/common/linux-procfs.h
gdb/common/linux-ptrace.c [new file with mode: 0644]
gdb/config/alpha/alpha-linux.mh
gdb/config/arm/linux.mh
gdb/config/i386/linux.mh
gdb/config/i386/linux64.mh
gdb/config/ia64/linux.mh
gdb/config/m32r/linux.mh
gdb/config/m68k/linux.mh
gdb/config/mips/linux.mh
gdb/config/pa/linux.mh
gdb/config/powerpc/linux.mh
gdb/config/powerpc/ppc64-linux.mh
gdb/config/powerpc/spu-linux.mh
gdb/config/s390/s390.mh
gdb/config/sparc/linux.mh
gdb/config/sparc/linux64.mh
gdb/config/xtensa/linux.mh
gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gdbserver/configure.srv
gdb/gdbserver/linux-low.c
gdb/linux-nat.c

index c422451c7e87dce09ee36d84513d81d2bf23aa65..f7f564c6dabf96dd497bb0ca3c9c6c90624e4409 100644 (file)
@@ -1,3 +1,30 @@
+2012-03-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * Makefile.in (linux-ptrace.o): New.
+       * common/linux-procfs.c (linux_proc_pid_is_zombie): New,
+       from linux-nat.c.
+       * common/linux-procfs.h (linux_proc_pid_is_zombie): New declaration.
+       * common/linux-ptrace.c: New file.
+       * config/alpha/alpha-linux.mh (NATDEPFILES): Add linux-ptrace.o.
+       * config/arm/linux.mh: Likewise.
+       * config/i386/linux.mh: Likewise.
+       * config/i386/linux64.mh: Likewise.
+       * config/ia64/linux.mh: Likewise.
+       * config/m32r/linux.mh: Likewise.
+       * config/m68k/linux.mh: Likewise.
+       * config/mips/linux.mh: Likewise.
+       * config/pa/linux.mh: Likewise.
+       * config/powerpc/linux.mh: Likewise.
+       * config/powerpc/ppc64-linux.mh: Likewise.
+       * config/powerpc/spu-linux.mh: Likewise.
+       * config/s390/s390.mh: Likewise.
+       * config/sparc/linux.mh: Likewise.
+       * config/sparc/linux64.mh: Likewise.
+       * config/xtensa/linux.mh: Likewise.
+       * linux-nat.c (linux_lwp_is_zombie): Remove, move it to
+       common/linux-procfs.c.
+       (wait_lwp): Rename linux_lwp_is_zombie to linux_proc_pid_is_zombie.
+
 2012-03-13  Hui Zhu  <teawater@gmail.com>
            Pedro Alves  <palves@redhat.com>
 
index 84eda7da02a88358bc1966e294053c2b4136cc2c..4d8566245527aba0c26a1f771f17878c653e92a7 100644 (file)
@@ -1929,6 +1929,10 @@ linux-procfs.o: $(srcdir)/common/linux-procfs.c
        $(COMPILE) $(srcdir)/common/linux-procfs.c
        $(POSTCOMPILE)
 
+linux-ptrace.o: $(srcdir)/common/linux-ptrace.c
+       $(COMPILE) $(srcdir)/common/linux-ptrace.c
+       $(POSTCOMPILE)
+
 common-agent.o: $(srcdir)/common/agent.c
        $(COMPILE) $(srcdir)/common/agent.c
        $(POSTCOMPILE)
index 165383e8755813948bd74765c4cc8b3458097e3b..b7d98a53983774caabc1e4d32ea7443c1f5e8a49 100644 (file)
@@ -84,3 +84,34 @@ linux_proc_pid_is_stopped (pid_t pid)
     }
   return retval;
 }
+
+/* See linux-procfs.h declaration.  */
+
+int
+linux_proc_pid_is_zombie (pid_t pid)
+{
+  char buffer[100];
+  FILE *procfile;
+  int retval;
+  int have_state;
+
+  xsnprintf (buffer, sizeof (buffer), "/proc/%d/status", (int) pid);
+  procfile = fopen (buffer, "r");
+  if (procfile == NULL)
+    {
+      warning (_("unable to open /proc file '%s'"), buffer);
+      return 0;
+    }
+
+  have_state = 0;
+  while (fgets (buffer, sizeof (buffer), procfile) != NULL)
+    if (strncmp (buffer, "State:", 6) == 0)
+      {
+       have_state = 1;
+       break;
+      }
+  retval = (have_state
+           && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
+  fclose (procfile);
+  return retval;
+}
index c1e55474ad75bcc00721061c8bcbfedb0650d58e..130adeb14a72bdefb3dc95c13ce197fcdbbb481e 100644 (file)
@@ -31,4 +31,8 @@ extern int linux_proc_get_tgid (int lwpid);
 
 extern int linux_proc_pid_is_stopped (pid_t pid);
 
+/* Return non-zero if PID is a zombie.  */
+
+extern int linux_proc_pid_is_zombie (pid_t pid);
+
 #endif /* COMMON_LINUX_PROCFS_H */
diff --git a/gdb/common/linux-ptrace.c b/gdb/common/linux-ptrace.c
new file mode 100644 (file)
index 0000000..6dea677
--- /dev/null
@@ -0,0 +1,26 @@
+/* Linux-specific ptrace manipulation routines.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef GDBSERVER
+#include "server.h"
+#else
+#include "defs.h"
+#include "gdb_string.h"
+#endif
+
+#include "linux-ptrace.h"
index 15dc9894a3982a5e4ac2bda5473c197e9c888484..9eb9e4b72913f31c7908b8480e4645cf3a5bd825 100644 (file)
@@ -2,7 +2,7 @@
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o alpha-linux-nat.o \
        fork-child.o proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index 78918d26606d8ee71a9d0a362327122a3045077e..c0a1c66804a9b63d0545492c304db9ab1df16dd9 100644 (file)
@@ -3,7 +3,7 @@
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o arm-linux-nat.o \
        proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES= -ldl $(RDYNAMIC)
index 3a158c65977e2fa8ec6e29cd4fca604b0188be7a..8316d870eac9d6dd0b0e7b18400bb7b28f2a6c37 100644 (file)
@@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o \
        i386-nat.o i386-linux-nat.o \
        proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index a5e8c14b3a6c6f07098f0e93ad460a0bc54cb364..d2b95fd605c042ee9c72b1f2f22e3695ac183255 100644 (file)
@@ -3,7 +3,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
        i386-nat.o amd64-nat.o amd64-linux-nat.o \
        linux-nat.o linux-osdata.o \
        proc-service.o linux-thread-db.o linux-fork.o \
-       linux-procfs.o
+       linux-procfs.o linux-ptrace.o
 NAT_FILE= config/nm-linux.h
 NAT_CDEPS = $(srcdir)/proc-service.list
 
index c72929c6f368c33a753e1fffc967a9e3ecc0f704..1a4c68e093769234b79e3040ed15baf8978d15d2 100644 (file)
@@ -5,7 +5,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
        core-regset.o ia64-linux-nat.o \
        proc-service.o linux-thread-db.o \
        linux-nat.o linux-osdata.o linux-fork.o \
-       linux-procfs.o
+       linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index 32a442848a8df91fd3a89a26f1a34df1705c5ae0..b4618064bffc7d2e1379fe90f96fce265f3a84d9 100644 (file)
@@ -3,7 +3,7 @@
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o                         \
        m32r-linux-nat.o proc-service.o linux-thread-db.o       \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES= -ldl $(RDYNAMIC)
index b116819c863c0f177a99b627f5eb25f2d8ac8e19..e3aaf382c8c8e31ed0ee286d8252398e3080d639 100644 (file)
@@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o \
        m68klinux-nat.o \
        proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index 1ef3bce5659786b6b29868fe84609b99b23f676a..2f8e5dd3094a75f9e5dda5596cb82e79fc0b7ad6 100644 (file)
@@ -3,7 +3,7 @@ NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o mips-linux-nat.o \
        linux-thread-db.o proc-service.o \
        linux-nat.o linux-osdata.o linux-fork.o \
-       linux-procfs.o
+       linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index e9b7114117ec7f1933f0d357741dddae0ba3a8ab..fa46db6ebe5187e35b56fcd3a43b0e606cdbefa3 100644 (file)
@@ -3,7 +3,7 @@ NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o \
        hppa-linux-nat.o proc-service.o linux-thread-db.o \
        linux-nat.o linux-osdata.o linux-fork.o \
-       linux-procfs.o
+       linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index 0ae93681f4abc6ac169de55df449e3434bddb0ce..b0d4ce7c55c38a8c35961224e936a88efe3ff35c 100644 (file)
@@ -5,7 +5,7 @@ XM_CLIBS=
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o \
        ppc-linux-nat.o proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index bf1bb5bde08c2624cbacd6ec838191f5273c5774..367a81853b530ef729421a3282153915594cf490 100644 (file)
@@ -5,7 +5,7 @@ XM_CLIBS=
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o \
        ppc-linux-nat.o proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The PowerPC has severe limitations on TOC size, and uses them even
index f6e7396881e9cefcd9260240271f6f6adc57ef88..1bc279a8138515bdec10e85657d35637006b23cb 100644 (file)
@@ -4,5 +4,5 @@
 # PPU side of the Cell BE and debugging the SPU side.
 
 NATDEPFILES = spu-linux-nat.o fork-child.o inf-ptrace.o \
-             linux-procfs.o
+             linux-procfs.o linux-ptrace.o
 
index 44c7a9a6c3bbe8c5bf7b7741c4990878558d98dc..a53835c4fa5887f0660b1566b21b5e6d21eec977 100644 (file)
@@ -2,6 +2,6 @@
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o s390-nat.o \
        linux-thread-db.o proc-service.o \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 LOADLIBES = -ldl $(RDYNAMIC)
index 25c4ad5b94eec2c6258cd37d9b7e76927c172766..6a2cefd7b5c8f87fda17145a08281dfa4232e223 100644 (file)
@@ -4,7 +4,7 @@ NATDEPFILES= sparc-nat.o sparc-linux-nat.o \
        core-regset.o fork-child.o inf-ptrace.o \
        proc-service.o linux-thread-db.o \
        linux-nat.o linux-osdata.o linux-fork.o \
-       linux-procfs.o
+       linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index 363e19b99569e4a99a4bdbc64facb0a56fee1c4b..d1e1a97162f5545acda336d0c54bf11176fb6b19 100644 (file)
@@ -5,7 +5,7 @@ NATDEPFILES= sparc-nat.o sparc64-nat.o sparc64-linux-nat.o \
        fork-child.o inf-ptrace.o \
        proc-service.o linux-thread-db.o \
        linux-nat.o linux-osdata.o linux-fork.o \
-       linux-procfs.o
+       linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index c637ec757f6144582375a2b2ce29ad35727dde6f..deffe25ed4281945c5288d18138876cdc4789101 100644 (file)
@@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
 
 NATDEPFILES= inf-ptrace.o fork-child.o xtensa-linux-nat.o \
        linux-thread-db.o proc-service.o \
-       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index 04c0709b2fe63062584bae7d55d88dd50dab808b..726a6b438718dd13c332ae19e0c6eb2ca990952a 100644 (file)
@@ -1,3 +1,14 @@
+2012-03-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * Makefile.in (linux-ptrace.o): New.
+       * configure.srv (arm*-*-linux*, bfin-*-*linux*, crisv32-*-linux*)
+       (cris-*-linux*, i[34567]86-*-linux*, ia64-*-linux*, m32r*-*-linux*)
+       (m68*-*-linux*, m68*-*-uclinux*, mips*-*-linux*, powerpc*-*-linux*)
+       (s390*-*-linux*, sh*-*-linux*, sparc*-*-linux*, tic6x-*-uclinux)
+       (x86_64-*-linux*, xtensa*-*-linux*): Add linux-ptrace.o to SRV_TGTOBJ
+       of these targets.
+       * linux-low.c (linux_attach_lwp_1): Remove redundent else clause.
+
 2012-03-08  Yao Qi  <yao@codesourcery.com>
            Pedro Alves  <palves@redhat.com>
 
index ce220cbc099e6044c4ed64cbe5279d2676b57e17..6d77ce2fed2e65e083fe22518eaa5fa7a8d11e01 100644 (file)
@@ -415,6 +415,9 @@ signals.o: ../common/signals.c $(server_h) $(signals_def)
 linux-procfs.o: ../common/linux-procfs.c $(server_h)
        $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
 
+linux-ptrace.o: ../common/linux-ptrace.c $(server_h)
+       $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
+
 common-utils.o: ../common/common-utils.c $(server_h)
        $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
 
index 3358c3377d52cffe4e716aeaabcdb59479001971..bdd99167b34541741f7bcf895cf4a30dbf74791f 100644 (file)
@@ -47,6 +47,7 @@ case "${target}" in
                        srv_regobj="${srv_regobj} arm-with-vfpv3.o"
                        srv_regobj="${srv_regobj} arm-with-neon.o"
                        srv_tgtobj="linux-low.o linux-osdata.o linux-arm-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_xmlfiles="arm-with-iwmmxt.xml"
                        srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv2.xml"
                        srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv3.xml"
@@ -69,16 +70,19 @@ case "${target}" in
                        ;;
   bfin-*-*linux*)      srv_regobj=reg-bfin.o
                        srv_tgtobj="linux-low.o linux-osdata.o linux-bfin-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_usrregs=yes
                        srv_linux_thread_db=yes
                        ;;
   crisv32-*-linux*)    srv_regobj=reg-crisv32.o
                        srv_tgtobj="linux-low.o linux-osdata.o linux-crisv32-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
                        ;;
   cris-*-linux*)       srv_regobj=reg-cris.o
                        srv_tgtobj="linux-low.o linux-osdata.o linux-cris-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_usrregs=yes
                        srv_linux_thread_db=yes
                        ;;
@@ -93,6 +97,7 @@ case "${target}" in
                            srv_xmlfiles="${srv_xmlfiles} $srv_amd64_linux_xmlfiles"
                        fi
                        srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_usrregs=yes
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
@@ -124,10 +129,12 @@ case "${target}" in
                        ;;
   ia64-*-linux*)       srv_regobj=reg-ia64.o
                        srv_tgtobj="linux-low.o linux-osdata.o linux-ia64-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_usrregs=yes
                        ;;
   m32r*-*-linux*)      srv_regobj=reg-m32r.o
                        srv_tgtobj="linux-low.o linux-osdata.o linux-m32r-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_usrregs=yes
                        srv_linux_thread_db=yes
                        ;;
@@ -137,6 +144,7 @@ case "${target}" in
                           srv_regobj=reg-m68k.o
                         fi
                        srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_usrregs=yes
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
@@ -147,6 +155,7 @@ case "${target}" in
                           srv_regobj=reg-m68k.o
                         fi
                        srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_usrregs=yes
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
@@ -156,6 +165,7 @@ case "${target}" in
                        srv_regobj="${srv_regobj} mips64-linux.o"
                        srv_regobj="${srv_regobj} mips64-dsp-linux.o"
                        srv_tgtobj="linux-low.o linux-osdata.o linux-mips-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_xmlfiles="mips-linux.xml"
                        srv_xmlfiles="${srv_xmlfiles} mips-dsp-linux.xml"
                        srv_xmlfiles="${srv_xmlfiles} mips-cpu.xml"
@@ -188,6 +198,7 @@ case "${target}" in
                        srv_regobj="${srv_regobj} powerpc-isa205-altivec64l.o"
                        srv_regobj="${srv_regobj} powerpc-isa205-vsx64l.o"
                        srv_tgtobj="linux-low.o linux-osdata.o linux-ppc-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_xmlfiles="rs6000/powerpc-32l.xml"
                        srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml"
                        srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell32l.xml"
@@ -230,6 +241,7 @@ case "${target}" in
                        srv_regobj="${srv_regobj} s390x-linux64v1.o"
                        srv_regobj="${srv_regobj} s390x-linux64v2.o"
                        srv_tgtobj="linux-low.o linux-osdata.o linux-s390-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_xmlfiles="s390-linux32.xml"
                        srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml"
                        srv_xmlfiles="${srv_xmlfiles} s390-linux32v2.xml"
@@ -250,12 +262,14 @@ case "${target}" in
                        ;;
   sh*-*-linux*)                srv_regobj=reg-sh.o
                        srv_tgtobj="linux-low.o linux-osdata.o linux-sh-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_usrregs=yes
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
                        ;;
   sparc*-*-linux*)     srv_regobj=reg-sparc64.o
                        srv_tgtobj="linux-low.o linux-osdata.o linux-sparc-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
                        ;;
@@ -272,12 +286,14 @@ case "${target}" in
                        srv_xmlfiles="${srv_xmlfiles} tic6x-gp.xml"
                        srv_xmlfiles="${srv_xmlfiles} tic6x-c6xp.xml"
                        srv_tgtobj="linux-low.o linux-osdata.o linux-tic6x-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_regsets=yes
                        srv_linux_usrregs=yes
                        srv_linux_thread_db=yes
                        ;;
   x86_64-*-linux*)     srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
                        srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_xmlfiles="$srv_i386_linux_xmlfiles $srv_amd64_linux_xmlfiles"
                        srv_linux_usrregs=yes # This is for i386 progs.
                        srv_linux_regsets=yes
@@ -292,6 +308,7 @@ case "${target}" in
 
   xtensa*-*-linux*)    srv_regobj=reg-xtensa.o
                        srv_tgtobj="linux-low.o linux-osdata.o linux-xtensa-low.o linux-procfs.o"
+                       srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
                        srv_linux_regsets=yes
                        ;;
   *)                   echo "Error: target not supported by gdbserver."
index 997e5a009c4ada89c0db699e0459cc29807fd3a6..06ec5763c624d66f1be540f7268688da6b459215 100644 (file)
@@ -660,10 +660,10 @@ linux_attach_lwp_1 (unsigned long lwpid, int initial)
          fflush (stderr);
          return;
        }
-      else
-       /* If we fail to attach to a process, report an error.  */
-       error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
-              strerror (errno), errno);
+
+      /* If we fail to attach to a process, report an error.  */
+      error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
+            strerror (errno), errno);
     }
 
   if (initial)
index e3a5e9d973f22903e39c050e6fc4a5a693a3564a..442d6f40a47b578720ce445c514951c22253cadb 100644 (file)
@@ -2465,37 +2465,6 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
                  _("unknown ptrace event %d"), event);
 }
 
-/* Return non-zero if LWP is a zombie.  */
-
-static int
-linux_lwp_is_zombie (long lwp)
-{
-  char buffer[MAXPATHLEN];
-  FILE *procfile;
-  int retval;
-  int have_state;
-
-  xsnprintf (buffer, sizeof (buffer), "/proc/%ld/status", lwp);
-  procfile = fopen (buffer, "r");
-  if (procfile == NULL)
-    {
-      warning (_("unable to open /proc file '%s'"), buffer);
-      return 0;
-    }
-
-  have_state = 0;
-  while (fgets (buffer, sizeof (buffer), procfile) != NULL)
-    if (strncmp (buffer, "State:", 6) == 0)
-      {
-       have_state = 1;
-       break;
-      }
-  retval = (have_state
-           && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
-  fclose (procfile);
-  return retval;
-}
-
 /* Wait for LP to stop.  Returns the wait status, or 0 if the LWP has
    exited.  */
 
@@ -2549,10 +2518,10 @@ wait_lwp (struct lwp_info *lp)
 
         This is racy, what if the tgl becomes a zombie right after we check?
         Therefore always use WNOHANG with sigsuspend - it is equivalent to
-        waiting waitpid but the linux_lwp_is_zombie is safe this way.  */
+        waiting waitpid but linux_proc_pid_is_zombie is safe this way.  */
 
       if (GET_PID (lp->ptid) == GET_LWP (lp->ptid)
-         && linux_lwp_is_zombie (GET_LWP (lp->ptid)))
+         && linux_proc_pid_is_zombie (GET_LWP (lp->ptid)))
        {
          thread_dead = 1;
          if (debug_linux_nat)
@@ -3499,7 +3468,7 @@ check_zombie_leaders (void)
          /* Check if there are other threads in the group, as we may
             have raced with the inferior simply exiting.  */
          && num_lwps (inf->pid) > 1
-         && linux_lwp_is_zombie (inf->pid))
+         && linux_proc_pid_is_zombie (inf->pid))
        {
          if (debug_linux_nat)
            fprintf_unfiltered (gdb_stdlog,
This page took 0.238859 seconds and 4 git commands to generate.