Bug 6281

Summary: Attaching to external process segfaults. Process being attached to locks up.
Product: [Retired] Red Hat Linux Reporter: Sam Varshavchik <mrsam>
Component: gdbAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 6.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-10-26 16:55:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sam Varshavchik 1999-10-23 03:07:56 UTC
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
egcs-1.1.2-24
[mrsam@gwl testdir]$ rpm -q gdb
gdb-4.18-4
[mrsam@gwl testdir]$ cat t.c

int main()
{
        sleep(500);
        return (0);
}

[mrsam@gwl testdir]$ gcc -g -o t t.c
[mrsam@gwl testdir]$ ./t &
[1] 9788
[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
certain conditions.
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
from...
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

Comment 1 Jim Kingdon 1999-10-26 16:55:59 UTC
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).