Red Hat Bugzilla – Bug 6281
Attaching to external process segfaults. Process being attached to locks up.
Last modified: 2008-05-01 11:37:52 EDT
When gdb is attached to an existing process, the 'info
files' command causes gdb to segfault. The process being
traced locks up, and must be kill -9ed. This severely
impacts the Data Display Debugger front end for gdb. I
cannot find a workaround.
Script started on Fri Oct 22 22:45:31 1999
[mrsam@gwl testdir]$ rpm -q egcs
[mrsam@gwl testdir]$ rpm -q gdb
[mrsam@gwl testdir]$ cat t.c
[mrsam@gwl testdir]$ gcc -g -o t t.c
[mrsam@gwl testdir]$ ./t &
[mrsam@gwl testdir]$ gdb t 9788
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it under
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show
warranty" for details.
This GDB was configured as "i386-redhat-linux"...
/usr/home/mrsam/testdir/9788: No such file or directory.
Attaching to program: /usr/home/mrsam/testdir/t, Pid 9788
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
0x400a87f1 in __libc_nanosleep () from /lib/libc.so.6
(gdb) info files
Symbols from "/usr/home/mrsam/testdir/t".
Unix child process:
Using the running image of attached Pid 9788.
While running this, GDB does not access memory
Local exec file:
`/usr/home/mrsam/testdir/t', file type elf32-i386.
Entry point: 0x8048320
Segmentation fault (core dumped)
[mrsam@gwl testdir]$ exit
Script done on Fri Oct 22 22:46:02 1999
I was able to reproduce this with the GDB which ships with Red Hat
Linux 6.1. I then tried a development version of GDB (see
http://sourceware.cygnus.com/gdb/) and did not see the problem.
So it is presumably fixed in gdb-4.18-6 which is in rawhide (or
failing that, a GDB you build yourself from the development sources).