This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] Resubmit: get shared libs after attach (linux)
- From: Michael Snyder <msnyder at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: dmj+ at andrew dot cmu dot edu, kettenis at science dot uva dot nl, kevinb at redhat dot com
- Date: Tue, 8 Jan 2002 12:30:54 -0800
- Subject: [RFA] Resubmit: get shared libs after attach (linux)
Taking everybody's feedback into account:
1) I now only use the child_pid_to_exec_file method in linux-proc.c.
I preserved the file linux-proc.c because this method still depends
on /proc, and because I will plan to put the linux-gcore.c code
in there too.
2) I moved the define to config/nm-linux.h
3) So now I must add linux-proc.o to all versions of linux.mh
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.
* 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.
Index: linux-proc.c
===================================================================
RCS file: linux-proc.c
diff -N linux-proc.c
*** /dev/null Tue May 5 13:32:27 1998
--- linux-proc.c Tue Jan 8 12:24:25 2002
***************
*** 0 ****
--- 1,31 ----
+ /* 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);
+ return fname;
+ }
Index: config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.10
diff -c -3 -p -r1.10 nm-linux.h
*** nm-linux.h 2001/10/14 20:42:07 1.10
--- nm-linux.h 2002/01/08 20:24:25
*************** extern void lin_thread_get_thread_signal
*** 67,69 ****
--- 67,74 ----
#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
+
+
Index: config/alpha/alpha-linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/alpha/alpha-linux.mh,v
retrieving revision 1.6
diff -c -3 -p -r1.6 alpha-linux.mh
*** alpha-linux.mh 2001/03/20 21:40:47 1.6
--- alpha-linux.mh 2002/01/08 20:24:25
***************
*** 2,8 ****
XDEPFILES=
XM_FILE= xm-alphalinux.h
NAT_FILE= nm-linux.h
! NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
fork-child.o proc-service.o thread-db.o lin-lwp.o
LOADLIBES = -ldl -rdynamic
--- 2,8 ----
XDEPFILES=
XM_FILE= xm-alphalinux.h
NAT_FILE= nm-linux.h
! 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
Index: config/arm/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/linux.mh,v
retrieving revision 1.7
diff -c -3 -p -r1.7 linux.mh
*** linux.mh 2001/02/06 19:59:06 1.7
--- linux.mh 2002/01/08 20:24:25
*************** XDEPFILES=
*** 5,11 ****
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
! core-regset.o arm-linux-nat.o \
proc-service.o thread-db.o lin-lwp.o
LOADLIBES= -ldl -rdynamic
--- 5,11 ----
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
! core-regset.o arm-linux-nat.o linux-proc.o \
proc-service.o thread-db.o lin-lwp.o
LOADLIBES= -ldl -rdynamic
Index: config/i386/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux.mh,v
retrieving revision 1.8
diff -c -3 -p -r1.8 linux.mh
*** linux.mh 2001/07/31 19:22:57 1.8
--- linux.mh 2002/01/08 20:24:25
*************** XM_FILE= xm-i386.h
*** 4,12 ****
XDEPFILES=
NAT_FILE= nm-linux.h
! NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
core-aout.o i386-nat.o i386-linux-nat.o i387-nat.o \
! proc-service.o thread-db.o lin-lwp.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
--- 4,13 ----
XDEPFILES=
NAT_FILE= nm-linux.h
! 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 linux-proc.o \
! gcore.o linux-gcore.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
Index: config/i386/x86-64linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/x86-64linux.mh,v
retrieving revision 1.1
diff -c -3 -p -r1.1 x86-64linux.mh
*** x86-64linux.mh 2001/09/21 12:19:15 1.1
--- x86-64linux.mh 2002/01/08 20:24:25
*************** XDEPFILES=
*** 6,11 ****
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
LOADLIBES = -ldl -rdynamic
--- 6,11 ----
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 linux-proc.o
LOADLIBES = -ldl -rdynamic
Index: config/ia64/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/linux.mh,v
retrieving revision 1.9
diff -c -3 -p -r1.9 linux.mh
*** linux.mh 2001/03/31 23:07:10 1.9
--- linux.mh 2002/01/08 20:24:25
*************** XDEPFILES=
*** 5,11 ****
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 \
proc-service.o thread-db.o lin-lwp.o
LOADLIBES = -ldl -rdynamic
--- 5,11 ----
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 linux-proc.o \
proc-service.o thread-db.o lin-lwp.o
LOADLIBES = -ldl -rdynamic
Index: config/m68k/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/linux.mh,v
retrieving revision 1.6
diff -c -3 -p -r1.6 linux.mh
*** linux.mh 2001/10/14 20:42:07 1.6
--- linux.mh 2002/01/08 20:24:25
*************** XDEPFILES=
*** 5,12 ****
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
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
--- 5,12 ----
NAT_FILE= nm-linux.h
NATDEPFILES= infptrace.o inftarg.o fork-child.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.
Index: config/mips/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/linux.mh,v
retrieving revision 1.1
diff -c -3 -p -r1.1 linux.mh
*** linux.mh 2001/07/10 20:41:54 1.1
--- linux.mh 2002/01/08 20:24:25
*************** XDEPFILES=
*** 3,8 ****
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
LOADLIBES = -ldl -rdynamic
--- 3,8 ----
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 linux-proc.o
LOADLIBES = -ldl -rdynamic
Index: config/powerpc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v
retrieving revision 1.7
diff -c -3 -p -r1.7 linux.mh
*** linux.mh 2001/12/20 23:31:27 1.7
--- linux.mh 2002/01/08 20:24:25
*************** XDEPFILES=
*** 5,11 ****
XM_CLIBS=
NAT_FILE= nm-linux.h
! NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o
LOADLIBES = -ldl -rdynamic
--- 5,11 ----
XM_CLIBS=
NAT_FILE= nm-linux.h
! 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
Index: config/sparc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux.mh,v
retrieving revision 1.4
diff -c -3 -p -r1.4 linux.mh
*** linux.mh 2001/11/17 18:38:29 1.4
--- linux.mh 2002/01/08 20:24:25
*************** XDEPFILES=
*** 5,11 ****
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
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
--- 5,11 ----
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 linux-proc.o
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.