aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2002-01-08 22:09:50 +0000
committerMichael Snyder <msnyder@vmware.com>2002-01-08 22:09:50 +0000
commit4b09dc8c14cd3dd0030c60976811a2b849bf9989 (patch)
tree6b37162b498f12a02a12e8dc7871b9a4411326e2 /gdb
parent97996af6f2b19f1dabca2a35b90eff5e18959e12 (diff)
downloadgdb-4b09dc8c14cd3dd0030c60976811a2b849bf9989.zip
gdb-4b09dc8c14cd3dd0030c60976811a2b849bf9989.tar.gz
gdb-4b09dc8c14cd3dd0030c60976811a2b849bf9989.tar.bz2
2002-01-07 Michael Snyder <msnyder@redhat.com>
* linux-proc.c: New file. Implement child_pid_to_exec_file, so that attaching to a pid will automatically read the process's symbol file and shlibs. * Makefile.in: Add rule for linux-proc.o. * config/nm-linux.h: Define CHILD_PID_TO_EXEC_FILE. * config/alpha/alpha-linux.mh: Add linux-proc.o to NATDEPFILES. * config/arm/linux.mh: Ditto. * config/i386/linux.mh: Ditto. * config/i386/x86-64linux.mh: Ditto. * config/ia64/linux.mh: Ditto. * config/m68k/linux.mh: Ditto. * config/mips/linux.mh: Ditto. * config/powerpc/linux.mh: Ditto. * config/sparc/linux.mh: Ditto.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/config/alpha/alpha-linux.mh2
-rw-r--r--gdb/config/arm/linux.mh2
-rw-r--r--gdb/config/i386/linux.mh4
-rw-r--r--gdb/config/i386/x86-64linux.mh2
-rw-r--r--gdb/config/ia64/linux.mh2
-rw-r--r--gdb/config/m68k/linux.mh4
-rw-r--r--gdb/config/mips/linux.mh2
-rw-r--r--gdb/config/nm-linux.h5
-rw-r--r--gdb/config/powerpc/linux.mh2
-rw-r--r--gdb/config/sparc/linux.mh2
-rw-r--r--gdb/linux-proc.c32
13 files changed, 67 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5f7936b..87b2ea6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,20 @@
+2002-01-07 Michael Snyder <msnyder@redhat.com>
+
+ * linux-proc.c: New file. Implement child_pid_to_exec_file,
+ so that attaching to a pid will automatically read the process's
+ symbol file and shlibs.
+ * Makefile.in: Add rule for linux-proc.o.
+ * config/nm-linux.h: Define CHILD_PID_TO_EXEC_FILE.
+ * config/alpha/alpha-linux.mh: Add linux-proc.o to NATDEPFILES.
+ * config/arm/linux.mh: Ditto.
+ * config/i386/linux.mh: Ditto.
+ * config/i386/x86-64linux.mh: Ditto.
+ * config/ia64/linux.mh: Ditto.
+ * config/m68k/linux.mh: Ditto.
+ * config/mips/linux.mh: Ditto.
+ * config/powerpc/linux.mh: Ditto.
+ * config/sparc/linux.mh: Ditto.
+
2002-01-06 Pierre Muller <muller@ics.u-strasbg.fr>
* win32-nat.c: Add i386-tdep.h dependency.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 9110a80..d9b79a7 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1848,6 +1848,8 @@ proc-why.o: proc-why.c $(defs_h) proc-utils.h
sol-thread.o: sol-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \
$(gdbcmd_h) $(regcache_h)
+linux-proc.o: linux-proc.c $(defs_h)
+
linux-thread.o: linux-thread.c $(breakpoint_h) $(gdbcmd_h) gdb_wait.h \
$(gdbthread_h) $(gdbcore_h) $(inferior_h) $(target_h) $(defs_h)
diff --git a/gdb/config/alpha/alpha-linux.mh b/gdb/config/alpha/alpha-linux.mh
index f698341..0fe3c48 100644
--- a/gdb/config/alpha/alpha-linux.mh
+++ b/gdb/config/alpha/alpha-linux.mh
@@ -2,7 +2,7 @@
XDEPFILES=
XM_FILE= xm-alphalinux.h
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
+NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o linux-proc.o \
fork-child.o proc-service.o thread-db.o lin-lwp.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/arm/linux.mh b/gdb/config/arm/linux.mh
index c9e9b64..8b386fb 100644
--- a/gdb/config/arm/linux.mh
+++ b/gdb/config/arm/linux.mh
@@ -5,7 +5,7 @@ XDEPFILES=
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
- core-regset.o arm-linux-nat.o \
+ core-regset.o arm-linux-nat.o linux-proc.o \
proc-service.o thread-db.o lin-lwp.o
LOADLIBES= -ldl -rdynamic
diff --git a/gdb/config/i386/linux.mh b/gdb/config/i386/linux.mh
index 25b88b4..50d2445 100644
--- a/gdb/config/i386/linux.mh
+++ b/gdb/config/i386/linux.mh
@@ -4,9 +4,9 @@ XM_FILE= xm-i386.h
XDEPFILES=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o linux-proc.o \
core-aout.o i386-nat.o i386-linux-nat.o i387-nat.o \
- proc-service.o thread-db.o lin-lwp.o
+ proc-service.o thread-db.o lin-lwp.o linux-proc.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
diff --git a/gdb/config/i386/x86-64linux.mh b/gdb/config/i386/x86-64linux.mh
index 0bf1092..f9f31fc 100644
--- a/gdb/config/i386/x86-64linux.mh
+++ b/gdb/config/i386/x86-64linux.mh
@@ -6,6 +6,6 @@ XDEPFILES=
NAT_FILE= nm-x86-64.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
core-aout.o i386-nat.o x86-64-nat.o x86-64-linux-nat.o \
- i387-nat.o proc-service.o thread-db.o lin-lwp.o
+ i387-nat.o proc-service.o thread-db.o lin-lwp.o linux-proc.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/ia64/linux.mh b/gdb/config/ia64/linux.mh
index 00119e6..48268d7 100644
--- a/gdb/config/ia64/linux.mh
+++ b/gdb/config/ia64/linux.mh
@@ -5,7 +5,7 @@ XDEPFILES=
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
- core-aout.o core-regset.o ia64-linux-nat.o \
+ core-aout.o core-regset.o ia64-linux-nat.o linux-proc.o \
proc-service.o thread-db.o lin-lwp.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/m68k/linux.mh b/gdb/config/m68k/linux.mh
index f3d40dd..aa5121b 100644
--- a/gdb/config/m68k/linux.mh
+++ b/gdb/config/m68k/linux.mh
@@ -5,8 +5,8 @@ XDEPFILES=
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o \
- corelow.o core-aout.o m68klinux-nat.o \
- proc-service.o thread-db.o lin-lwp.o
+ corelow.o core-aout.o m68klinux-nat.o linux-proc.o \
+ proc-service.o thread-db.o lin-lwp.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
diff --git a/gdb/config/mips/linux.mh b/gdb/config/mips/linux.mh
index 1a4b45f..47ad1ee 100644
--- a/gdb/config/mips/linux.mh
+++ b/gdb/config/mips/linux.mh
@@ -3,6 +3,6 @@ XDEPFILES=
XM_FILE= xm-linux.h
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o mips-linux-nat.o \
- thread-db.o lin-lwp.o proc-service.o
+ thread-db.o lin-lwp.o proc-service.o linux-proc.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h
index 59e5acb..84448d6 100644
--- a/gdb/config/nm-linux.h
+++ b/gdb/config/nm-linux.h
@@ -67,3 +67,8 @@ extern void lin_thread_get_thread_signals (sigset_t *mask);
#define GDB_GREGSET_T elf_gregset_t
#define GDB_FPREGSET_T elf_fpregset_t
+
+/* Override child_pid_to_exec_file in 'inftarg.c'. */
+#define CHILD_PID_TO_EXEC_FILE
+
+
diff --git a/gdb/config/powerpc/linux.mh b/gdb/config/powerpc/linux.mh
index 07f83bd..7f04a48 100644
--- a/gdb/config/powerpc/linux.mh
+++ b/gdb/config/powerpc/linux.mh
@@ -5,7 +5,7 @@ XDEPFILES=
XM_CLIBS=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o linux-proc.o \
core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o
LOADLIBES = -ldl -rdynamic
diff --git a/gdb/config/sparc/linux.mh b/gdb/config/sparc/linux.mh
index 3479ecb..e63b2e6 100644
--- a/gdb/config/sparc/linux.mh
+++ b/gdb/config/sparc/linux.mh
@@ -5,7 +5,7 @@ XDEPFILES=
NAT_FILE= nm-linux.h
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o \
- proc-service.o thread-db.o lin-lwp.o sparc-linux-nat.o
+ proc-service.o thread-db.o lin-lwp.o sparc-linux-nat.o linux-proc.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c
new file mode 100644
index 0000000..4e25923
--- /dev/null
+++ b/gdb/linux-proc.c
@@ -0,0 +1,32 @@
+/* Generate a core file for the inferior process -- Linux version.
+ Copyright 2001 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 2 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include <sys/param.h> /* for MAXPATHLEN */
+
+char *
+child_pid_to_exec_file (int pid)
+{
+ static char fname[MAXPATHLEN];
+
+ sprintf (fname, "/proc/%d/exe", pid);
+ /* FIXME use readlink to get the real name. */
+ return fname;
+}