Move common linux procfs code to common/
authorLuis Machado <luisgpm@br.ibm.com>
Wed, 24 Aug 2011 12:07:28 +0000 (12:07 +0000)
committerLuis Machado <luisgpm@br.ibm.com>
Wed, 24 Aug 2011 12:07:28 +0000 (12:07 +0000)
24 files changed:
gdb/ChangeLog
gdb/Makefile.in
gdb/common/linux-procfs.c [new file with mode: 0644]
gdb/common/linux-procfs.h [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/sparc/linux.mh
gdb/config/sparc/linux64.mh
gdb/config/xtensa/linux.mh
gdb/gdbserver/ChangeLog
gdb/gdbserver/configure.srv
gdb/linux-nat.c
gdb/linux-nat.h
gdb/linux-thread-db.c

index 4779484abc251765c2eb146afcefb4981e4e7597..1da536e7fdc3a2dcdb116f60c4f1e2f06e24c905 100644 (file)
@@ -1,3 +1,29 @@
+2011-08-24  Luis Machado  <lgustavo@codesourcery.com>
+
+       * linux-nat.h (linux_proc_get_tgid): Remove declaration.
+       * linux-nat.c: Include linux-procfs.h.
+       (linux_proc_get_tgid): Move to ...
+       * common/linux-procfs.c: ... here. New file.
+       * common/linux-procfs.h: New file.
+       * linux-thread-db.c: Include linux-procfs.h.
+       * Makefile.in: Update dependencies.
+       * config/alpha/alpha-linux.mh: Add linux-procfs.o dependency.
+       * 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/pa/linux.mh: Likewise.
+       * config/powerpc/linux.mh: Likewise.
+       * config/powerpc/ppc64-linux.mh: Likewise.
+       * config/powerpc/spu-linux.mh: Likewise.
+       * config/sparc/linux.mh: Likewise.
+       * config/sparc/linux64.mh: Likewise.
+       * config/xtensa/linux.mh: Likewise.
+
 2011-08-24  Hui Zhu  <teawater@gmail.com>
 
        * tracepoint.c (cond_string_is_same): New function.
index bd006443b22ed36edb9e4b6d92461c1a24cd8c63..a3bd1f9d2946e787b20571ab239d8cccf5a8a4e2 100644 (file)
@@ -1959,6 +1959,10 @@ linux-osdata.o: ${srcdir}/common/linux-osdata.c
        $(COMPILE) $(srcdir)/common/linux-osdata.c
        $(POSTCOMPILE)
 
+linux-procfs.o: $(srcdir)/common/linux-procfs.c
+       $(COMPILE) $(srcdir)/common/linux-procfs.c
+       $(POSTCOMPILE)
+
 #
 # gdb/tui/ dependencies
 #
diff --git a/gdb/common/linux-procfs.c b/gdb/common/linux-procfs.c
new file mode 100644 (file)
index 0000000..33730b2
--- /dev/null
@@ -0,0 +1,55 @@
+/* Linux-specific PROCFS manipulation routines.
+   Copyright (C) 2009, 2010, 2011 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-procfs.h"
+
+/* Return the TGID of LWPID from /proc/pid/status.  Returns -1 if not
+   found.  */
+
+int
+linux_proc_get_tgid (int lwpid)
+{
+  FILE *status_file;
+  char buf[100];
+  int tgid = -1;
+
+  snprintf (buf, sizeof (buf), "/proc/%d/status", (int) lwpid);
+  status_file = fopen (buf, "r");
+  if (status_file != NULL)
+    {
+      while (fgets (buf, sizeof (buf), status_file))
+       {
+         if (strncmp (buf, "Tgid:", 5) == 0)
+           {
+             tgid = strtoul (buf + strlen ("Tgid:"), NULL, 10);
+             break;
+           }
+       }
+
+      fclose (status_file);
+    }
+
+  return tgid;
+}
diff --git a/gdb/common/linux-procfs.h b/gdb/common/linux-procfs.h
new file mode 100644 (file)
index 0000000..bdfa569
--- /dev/null
@@ -0,0 +1,29 @@
+/* Linux-specific PROCFS manipulation routines.
+   Copyright (C) 2011 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/>.  */
+
+#ifndef COMMON_LINUX_PROCFS_H
+#define COMMON_LINUX_PROCFS_H
+
+#include <unistd.h>
+
+/* Return the TGID of LWPID from /proc/pid/status.  Returns -1 if not
+   found.  */
+
+extern int linux_proc_get_tgid (int lwpid);
+
+#endif /* COMMON_LINUX_PROCFS_H */
index 1a6949d8bb0d1c592ff9c050263901f20ca54ce5..ddfb19bd71742626766f4a26ebf6fef9de20faad 100644 (file)
@@ -2,7 +2,7 @@
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o corelow.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-nat.o linux-osdata.o linux-fork.o linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index c5e93f3cbc61e27538b2380495159ec0e2ccba27..78918d26606d8ee71a9d0a362327122a3045077e 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-nat.o linux-osdata.o linux-fork.o linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES= -ldl $(RDYNAMIC)
index 3d7745bb5d0b6c6fc7bbeb86c67de005e9b2c393..3a158c65977e2fa8ec6e29cd4fca604b0188be7a 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-nat.o linux-osdata.o linux-fork.o linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index c826dc9ab67b736aa74b71453fe86ee267e97541..a5e8c14b3a6c6f07098f0e93ad460a0bc54cb364 100644 (file)
@@ -2,7 +2,8 @@
 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
+       proc-service.o linux-thread-db.o linux-fork.o \
+       linux-procfs.o
 NAT_FILE= config/nm-linux.h
 NAT_CDEPS = $(srcdir)/proc-service.list
 
index df45b9743922b9cf7c2070e7760236c3d2a7d337..5114899114a6e9490a6b8dbe900244bcd4b35247 100644 (file)
@@ -4,7 +4,8 @@ NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o corelow.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-nat.o linux-osdata.o linux-fork.o \
+       linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index 241520d198fd1a5127a5d9d5e681abcd0fd2ed75..b4849ae70b5227236bc552b33bc64f7cad0ee0d9 100644 (file)
@@ -3,7 +3,7 @@
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o corelow.o       \
        m32r-linux-nat.o proc-service.o linux-thread-db.o       \
-       linux-nat.o linux-osdata.o linux-fork.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES= -ldl $(RDYNAMIC)
index b54921c533e004b3a997716e365657e67e8c87cc..3a95828d658403a9414154a5c02013a7398b678d 100644 (file)
@@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o \
        corelow.o m68klinux-nat.o \
        proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o
+       linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index 4f735ba6e43b4187ddab44fbe181d8cf7d4fc048..1ef3bce5659786b6b29868fe84609b99b23f676a 100644 (file)
@@ -2,7 +2,8 @@
 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-nat.o linux-osdata.o linux-fork.o \
+       linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index e49c91e22330988b06accc04b3c42b4c066e026c..4ed8cbff858481db5d802830bf344cd12ac1baf7 100644 (file)
@@ -2,7 +2,8 @@
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
        hppa-linux-nat.o proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o
+       linux-nat.o linux-osdata.o linux-fork.o \
+       linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index 49fac1d5c12f01a650365fc8a30610e644c65580..0ae93681f4abc6ac169de55df449e3434bddb0ce 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-nat.o linux-osdata.o linux-fork.o linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index c822e83e73148d979749c835a16e130a774e88f6..bf1bb5bde08c2624cbacd6ec838191f5273c5774 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-nat.o linux-osdata.o linux-fork.o linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The PowerPC has severe limitations on TOC size, and uses them even
index 068d294df1367d7ab7102b9de7c04a3fedd5141a..f6e7396881e9cefcd9260240271f6f6adc57ef88 100644 (file)
@@ -3,5 +3,6 @@
 # This implements a 'pseudo-native' GDB running on the
 # PPU side of the Cell BE and debugging the SPU side.
 
-NATDEPFILES = spu-linux-nat.o fork-child.o inf-ptrace.o
+NATDEPFILES = spu-linux-nat.o fork-child.o inf-ptrace.o \
+             linux-procfs.o
 
index fe8e1e71285ad75e47ff20eb82d1454287077eb5..a9a768cb44ae33ec471658d5c64572d8b71567c0 100644 (file)
@@ -3,7 +3,8 @@ NAT_FILE= config/nm-linux.h
 NATDEPFILES= sparc-nat.o sparc-linux-nat.o \
        corelow.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-nat.o linux-osdata.o linux-fork.o \
+       linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index 639e3d0150e765d4463c170304ebcd8cabbce37d..30eef2be50a77894bf9769207096a30d4499f4ba 100644 (file)
@@ -4,7 +4,8 @@ NATDEPFILES= sparc-nat.o sparc64-nat.o sparc64-linux-nat.o \
        corelow.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-nat.o linux-osdata.o linux-fork.o \
+       linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 # The dynamically loaded libthread_db needs access to symbols in the
index 4abd242f004e5e06e1beed6c743253f997216d36..c637ec757f6144582375a2b2ce29ad35727dde6f 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-nat.o linux-osdata.o linux-fork.o linux-procfs.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
index c9a1375144a8c98749e558a5fba9762703381560..7176e8b35b8194233b6fa6f4175ac058195be48c 100644 (file)
@@ -1,3 +1,7 @@
+2011-08-24  Luis Machado  <lgustavo@codesourcery.com>
+
+       * configure.srv: Add linux-procfs.o dependencies.
+
 2011-08-14  Yao Qi  <yao@codesourcery.com>
 
        * target.h (struct target_ops): Fix indent.
index 811dfdc0c5d4f8ad517d2f9e91fc28550e5af049..5c4900e8e413b4e901467ceffd1f12473bf3599c 100644 (file)
@@ -46,7 +46,7 @@ case "${target}" in
                        srv_regobj="${srv_regobj} arm-with-vfpv2.o"
                        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"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-arm-low.o linux-procfs.o"
                        srv_xmlfiles="arm-with-iwmmxt.xml"
                        srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv2.xml"
                        srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv3.xml"
@@ -68,17 +68,17 @@ case "${target}" in
                        srv_mingwce=yes
                        ;;
   bfin-*-*linux*)      srv_regobj=reg-bfin.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-bfin-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-bfin-low.o linux-procfs.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"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-crisv32-low.o linux-procfs.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"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-cris-low.o linux-procfs.o"
                        srv_linux_usrregs=yes
                        srv_linux_thread_db=yes
                        ;;
@@ -92,7 +92,7 @@ case "${target}" in
                            srv_regobj="$srv_regobj $srv_amd64_linux_regobj"
                            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"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
                        srv_linux_usrregs=yes
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
@@ -123,11 +123,11 @@ case "${target}" in
                        srv_qnx="yes"
                        ;;
   ia64-*-linux*)       srv_regobj=reg-ia64.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-ia64-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-ia64-low.o linux-procfs.o"
                        srv_linux_usrregs=yes
                        ;;
   m32r*-*-linux*)      srv_regobj=reg-m32r.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-m32r-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-m32r-low.o linux-procfs.o"
                        srv_linux_usrregs=yes
                        srv_linux_thread_db=yes
                        ;;
@@ -136,7 +136,7 @@ case "${target}" in
                         else
                           srv_regobj=reg-m68k.o
                         fi
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
                        srv_linux_usrregs=yes
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
@@ -146,13 +146,13 @@ case "${target}" in
                         else
                           srv_regobj=reg-m68k.o
                         fi
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
                        srv_linux_usrregs=yes
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
                        ;;
   mips*-*-linux*)      srv_regobj="mips-linux.o mips64-linux.o"
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-mips-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-mips-low.o linux-procfs.o"
                        srv_xmlfiles="mips-linux.xml"
                        srv_xmlfiles="${srv_xmlfiles} mips-cpu.xml"
                        srv_xmlfiles="${srv_xmlfiles} mips-cp0.xml"
@@ -180,7 +180,7 @@ case "${target}" in
                        srv_regobj="${srv_regobj} powerpc-isa205-64l.o"
                        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"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-ppc-low.o linux-procfs.o"
                        srv_xmlfiles="rs6000/powerpc-32l.xml"
                        srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml"
                        srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell32l.xml"
@@ -216,7 +216,7 @@ case "${target}" in
   s390*-*-linux*)      srv_regobj="s390-linux32.o"
                        srv_regobj="${srv_regobj} s390-linux64.o"
                        srv_regobj="${srv_regobj} s390x-linux64.o"
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-s390-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-s390-low.o linux-procfs.o"
                        srv_xmlfiles="s390-linux32.xml"
                        srv_xmlfiles="${srv_xmlfiles} s390-linux64.xml"
                        srv_xmlfiles="${srv_xmlfiles} s390x-linux64.xml"
@@ -230,13 +230,13 @@ case "${target}" in
                        srv_linux_thread_db=yes
                        ;;
   sh*-*-linux*)                srv_regobj=reg-sh.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-sh-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-sh-low.o linux-procfs.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"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-sparc-low.o linux-procfs.o"
                        srv_linux_regsets=yes
                        srv_linux_thread_db=yes
                        ;;
@@ -252,13 +252,13 @@ case "${target}" in
                        srv_xmlfiles="${srv_xmlfiles} tic6x-core.xml"
                        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"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-tic6x-low.o linux-procfs.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"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
                        srv_xmlfiles="$srv_i386_linux_xmlfiles $srv_amd64_linux_xmlfiles"
                        srv_linux_usrregs=yes # This is for i386 progs.
                        srv_linux_regsets=yes
@@ -272,7 +272,7 @@ case "${target}" in
                        ;;
 
   xtensa*-*-linux*)    srv_regobj=reg-xtensa.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-xtensa-low.o"
+                       srv_tgtobj="linux-low.o linux-osdata.o linux-xtensa-low.o linux-procfs.o"
                        srv_linux_regsets=yes
                        ;;
   *)                   echo "Error: target not supported by gdbserver."
index c832902668bc556b6ae53185ae1cc45ff74189ff..b14688802455566b36234362f03bd9cc6d3c5b6a 100644 (file)
@@ -31,6 +31,7 @@
 #include <sys/ptrace.h>
 #include "linux-nat.h"
 #include "linux-ptrace.h"
+#include "linux-procfs.h"
 #include "linux-fork.h"
 #include "gdbthread.h"
 #include "gdbcmd.h"
@@ -1285,34 +1286,6 @@ exit_lwp (struct lwp_info *lp)
   delete_lwp (lp->ptid);
 }
 
-/* Return an lwp's tgid, found in `/proc/PID/status'.  */
-
-int
-linux_proc_get_tgid (int lwpid)
-{
-  FILE *status_file;
-  char buf[100];
-  int tgid = -1;
-
-  snprintf (buf, sizeof (buf), "/proc/%d/status", (int) lwpid);
-  status_file = fopen (buf, "r");
-  if (status_file != NULL)
-    {
-      while (fgets (buf, sizeof (buf), status_file))
-       {
-         if (strncmp (buf, "Tgid:", 5) == 0)
-           {
-             tgid = strtoul (buf + strlen ("Tgid:"), NULL, 10);
-             break;
-           }
-       }
-
-      fclose (status_file);
-    }
-
-  return tgid;
-}
-
 /* Detect `T (stopped)' in `/proc/PID/status'.
    Other states including `T (tracing stop)' are reported as false.  */
 
index 42cb2fc2049e562dda89633a96a9521439ad584e..12fda0f172b753ab5ef4b397f035712b57209110 100644 (file)
@@ -125,10 +125,6 @@ extern void lin_thread_get_thread_signals (sigset_t *mask);
 void linux_proc_pending_signals (int pid, sigset_t *pending,
                                 sigset_t *blocked, sigset_t *ignored);
 
-/* Return the TGID of LWPID from /proc/pid/status.  Returns -1 if not
-   found.  */
-extern int linux_proc_get_tgid (int lwpid);
-
 /* linux-nat functions for handling fork events.  */
 extern void linux_enable_event_reporting (ptid_t ptid);
 
index 6427f8b9437f4ea4a085a3790f50905080f091d9..dda2bff7a150d482253b7f613edc204e54da57e4 100644 (file)
@@ -40,6 +40,7 @@
 #include "gdbcore.h"
 #include "observer.h"
 #include "linux-nat.h"
+#include "linux-procfs.h"
 
 #include <signal.h>
 
This page took 0.041183 seconds and 4 git commands to generate.