Bug 56270

Summary: gdb fails to debug a program linked with ld-linux.so.2
Product: [Retired] Red Hat Linux Reporter: Oliver Beckstein <lomenoldur>
Component: gdbAssignee: Trond Eivind Glomsrxd <teg>
Status: CLOSED WORKSFORME QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: rslc
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-11-29 00:07:05 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 Oliver Beckstein 2001-11-14 20:16:31 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.9-12custom i686)

Description of problem:
gdb does not allow to debug a simple program (helloworld.c). It stops with
a SIGTRAP, presumably in ld-linux.so and on 'cont' drops me into a sub
shell. Returning with exit to gdb, I find my program 'finished' (according
to gdb) but I cannot examine it.

Ignoring SIGTRAP in gdb ('handle SIGTRAP nopass') simply terminates my
program.

gdb behaves properly on a variety of systems with glibc 2.1.3 (instead of
2.2.4-19 as on this system).

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.cat >hoo.c <<EOF
#include <strings.h>
int main () { printf("Hello Universe!\n");  return 0; };
EOF
2. gcc -o hoo hoo.c
3. gdb hoo
4. [gdb] run
Additionally, check dynamic linking:
   ldd ./hoo
Program works:
   hoo
	

Actual Results:  3. GNU gdb 5.0rh-5 Red Hat Linux 7.1
4. (gdb) run
Starting program: /sansom/kir/oliver/tmp/hw/hoo 

Program received signal SIGTRAP, Trace/breakpoint trap.
0x15557e90 in ?? ()
(gdb) cont
Continuing.
oliver@homer [oliver/tmp/hw]> logout
bash: logout: not login shell: use `exit'
oliver@homer [oliver/tmp/hw]> exit
exit

Program exited normally.
(gdb) 

Linking: ldd hoo
 	libc.so.6 => /lib/i686/libc.so.6 (0x1557c000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x15556000)
Program runs as expected:
Hello Universe!

Expected Results:  gdb should have run the program without getting a
SIGTRAP, printing Hello Universe!, and it should have also allowed me to
set break points and examine the program.

Additional info:

Detailed versions:

[Linux]
System: Linux RedHat 7.1
Kernel: 2.4.9-12custom   (from RH)

[gcc]
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)

[ld.so]
/lib/ld-linux.so -> ld-2.2.4.so 
in rpm: glibc 2.2.4-19

[gdb]
  GNU gdb 5.0rh-5 Red Hat Linux 7.1
  [...]
  This GDB was configured as "i386-redhat-linux".

in rpm:  gdb-5.0rh-5
and also with a freshly compiled

  GNU gdb 2001-11-14-cvs

Comment 1 Jakub Jelinek 2001-11-28 10:22:10 UTC
Works for me. No matter what, this is a gdb report, not ld.so, so reassigning.

Comment 2 Trond Eivind Glomsrxd 2001-11-29 00:06:57 UTC
Couldn't reproduce, it worked fine here. If you're still experiencing the
problem, please give gdb 5.1 from rawhide a try (do a "rpm --rebuild" of the
SRPM if necesarry).

Comment 3 Richard 2004-10-27 10:10:26 UTC
I get the same problem.
Can't even get a simple hello world to debug in KDevelop.
using DDD somehow works fine as it skip the error from gdb.