Bug 475645 - utrace: gdb-"start" does NOT stop program at main() + unhandled SIGTRAPs occur
utrace: gdb-"start" does NOT stop program at main() + unhandled SIGTRAPs occur
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
rawhide
x86_64 Linux
high Severity high
: ---
: ---
Assigned To: Roland McGrath
Fedora Extras Quality Assurance
:
: 476753 479380 479578 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-09 16:38 EST by Jason Vas Dias
Modified: 2009-02-25 13:55 EST (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-02-25 13:55:55 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
$ find . -name '[up]trace.c' | while read f; do diff -U0 $f ${upstream_2_6_28_rc8}/$f; done (35.95 KB, text/plain)
2008-12-18 14:54 EST, Jason Vas Dias
no flags Details

  None (edit)
Description Jason Vas Dias 2008-12-09 16:38:18 EST
Description of problem:

gdb-6.8-29.fc11.x86_64 seems to be unable function at all, 
on an x86_64 box fully up-to-date with FC11/Rawhide repos
as of 2008-12-09 .

Version-Release number of selected component (if applicable):
6.8-29.fc11.x86_64

How reproducible:
100%

Steps to Reproduce:
$ echo 'int main(){return 1;}' > t.c; gcc -g -o t t.c; gdb t
GNU gdb Fedora (6.8-29.fc11)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) start
Breakpoint 1 at 0x400550: file t.c, line 1.
Starting program: /tmp/t 

Program exited with code 01.
(gdb)
  
Actual results:

gdb responds to 'start' command by running program until it exits.

Expected results:

Program should be in stopped state at main() program entry address.

Additional info:

Attempting to debug a bigger program (e.g. one linking with GTK) produces
spurious unhandled SIGTRAP signals:

(gdb) start
Breakpoint 1 at 0x420e10: file R_0.c, line 6506.
Starting program: /home/jason/D/Dupdate_TEST_FC10/DG_TEST/Dupdate_DG_TEST 
Detaching after fork from child process 4758.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000037e0ea805b in ?? ()
(gdb)

SIGTRAP is the signal that GDB and ptrace() use to make the program 
enter the STOPPED state and return to parent control , so something
has gone wrong with the way gdb is doing this. gdb-6.5-37.el5_2.2rh
of RHEL-5.1 has no such problems , with the same packages having 
debuginfo rpms installed:

atk-debuginfo-1.25.2-1.fc11.x86_64
cairo-debuginfo-1.8.0-1.fc10.x86_64
cairomm-debuginfo-1.6.2-1.fc10.x86_64
fontconfig-debuginfo-2.6.0-3.fc10.x86_64
freetype1-debuginfo-1.4-0.6.pre.fc10.x86_64
freetype-debuginfo-2.3.7-2.fc11.x86_64
gd-debuginfo-2.0.35-6.fc10.x86_64
glib2-debuginfo-2.19.2-2.fc11.x86_64
glibc-debuginfo-2.8.90-17.x86_64
gstreamer-plugins-ugly-debuginfo-0.10.10-1.gst.x86_64
gtk2-debuginfo-2.14.5-4.fc11.x86_64
gtk2-engines-debuginfo-2.17.1-2.fc11.x86_64
libdvdcss-debuginfo-1.2.9-1.x86_64
libtool-debuginfo-2.2.6-5.fc11.x86_64
libX11-debuginfo-1.1.4-6.fc11.x86_64
mesa-debuginfo-7.2-0.14.fc10.x86_64
pango-debuginfo-1.22.3-2.fc11.x86_64
pangomm-debuginfo-2.14.1-1.fc11.x86_64
rpm-debuginfo-4.6.0-0.rc2.9.x86_64
xorg-x11-drv-radeonhd-debuginfo-1.2.3-1.7.20081206git.fc11.x86_64
xorg-x11-server-debuginfo-1.5.3-5.fc10.x86_64
yum-metadata-parser-debuginfo-1.1.2-11.fc11.x86_64
Comment 1 Jason Vas Dias 2008-12-09 16:49:17 EST
Should have shown more what happens with the large program debug:

This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) start
Breakpoint 1 at 0x420e10: file R_0.c, line 6506.
Starting program: /home/jason/D/Dupdate_TEST_FC10/DG_TEST/Dupdate_DG_TEST 
Detaching after fork from child process 4758.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000037e0ea805b in ?? ()
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000037e0ea805d in ?? ()
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000037e0ea8060 in ?? ()
(gdb) c
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000037e0ea81a8 in ?? ()
(gdb) c
Continuing.


This is from a program where every object it contains was compiled with '-O -g'
flags, and where ALL *debuginfo* packages for ALL the libraries it links to
were installed; this really makes this version of gdb rather unusable!
Comment 2 Jan Kratochvil 2008-12-09 17:00:52 EST
Roland: Reassigning only for a verification after ptrace-tests PASS.

Not reproducible on F-10 running kernel-2.6.25.10-86.fc9.x86_64, temporarily I have to recommend this kernel version for GDB use in F-9/F-10/F-11.
Sorry I did not verify it on F-11 but the current F-9 (updated) and F-10+F-11 (all) kernel versions are know to have problems with the kernel ptrace(2) syscall.
Fixed kernel updates are expected to be released soon.

/tmp/rh475645# cat /proc/version 
Linux version 2.6.25.10-86.fc9.x86_64 (mockbuild@) (gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC) ) #1 SMP Mon Jul 7 20:23:46 EDT 2008
/tmp/rh475645# echo 'int main(){return 1;}' > t.c; gcc -g -o t t.c; /tmp/gdb-6.8-29.fc11.x86_64/usr/bin/gdb ./t
GNU gdb Fedora (6.8-29.fc11)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) start
Breakpoint 1 at 0x400480: file t.c, line 1.
Starting program: /tmp/rh475645/t 
main () at t.c:1
1	int main(){return 1;}
(gdb)
Comment 3 Jason Vas Dias 2008-12-18 14:54:31 EST
Created attachment 327359 [details]
$ find . -name '[up]trace.c' | while read f; do diff -U0 $f ${upstream_2_6_28_rc8}/$f; done
Comment 4 Jason Vas Dias 2008-12-18 14:58:13 EST
I'd like to know exactly which problems the Fedora kernel has with ptrace() -
I have confirmed that the very latest upstream kernels from kernel.org - both
   stable linux-2.6.27.tar.bz2  +  patch-2.6.28-rc8.bz2   AND
   2.6.28-rc8 GIT linus+-tip-x86 git trees of 2008-12-18
do NOT have such problems, so it must be some code unique to Fedora kernels.

I am able to manually boot Fedora 11 under the upstream 2.6.28-rc8 kernel I 
built myself, and no such problems with gdb occur .

Here is a trace of gdb-6.8.50.20081214-1.fc11.x86_64 running
under kernel-2.6.28-0.129.rc8.git2.fc11.x86_64
showing the problem:

$ strace -e trace=ptrace gdb t
GNU gdb (GDB) Fedora (6.8.50.20081214-1.fc11)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) start
Temporary breakpoint 1 at 0x400560: file t.c, line 1.
Starting program: /tmp/t 
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(0x4202 /* PTRACE_??? */, 5461, 0, 0xc39880) = 0
ptrace(PTRACE_CONT, 5461, 0x1, SIG_0)   = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(0x4202 /* PTRACE_??? */, 5461, 0, 0xc39880) = 0
ptrace(PTRACE_GETREGS, 5461, 0, 0x7fff17165df0) = 0
ptrace(0x4200 /* PTRACE_??? */, 5461, 0, 0x2) = 0
ptrace(0x4200 /* PTRACE_??? */, 5462, 0, 0x2) = 0
ptrace(0x4200 /* PTRACE_??? */, 5462, 0, 0x22) = 0
ptrace(PTRACE_CONT, 5462, 0, SIG_0)     = 0
ptrace(0x4201 /* PTRACE_??? */, 5462, 0, 0x7fff17166030) = 0
ptrace(PTRACE_KILL, 5463, 0, 0)         = 0
ptrace(PTRACE_KILL, 5462, 0, 0)         = 0
ptrace(0x4200 /* PTRACE_??? */, 5461, 0, 0x3e) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x6007e8, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x6007e8, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x6007e8, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400558, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400560, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400568, [0x9090909090909090]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400558, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400558, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400558, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400560, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400568, [0x9090909090909090]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400558, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400558, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400560, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400560, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_POKEDATA, 5461, 0x400560, 0x90c3c900000001cc) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x37dfa0f440, [0x909090909090c3f3]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x37dfa0f440, [0x909090909090c3f3]) = 0
ptrace(PTRACE_POKEDATA, 5461, 0x37dfa0f440, 0x909090909090c3cc) = 0
ptrace(PTRACE_CONT, 5461, 0x1, SIG_0)   = 0
ptrace(0x4202 /* PTRACE_??? */, 5461, 0, 0xc39880) = 0
ptrace(PTRACE_GETREGS, 5461, 0, 0x7fff17165b20) = 0
ptrace(PTRACE_GETREGS, 5461, 0, 0x7fff17165b30) = 0
ptrace(PTRACE_SETREGS, 5461, 0, 0x7fff17165b30) = 0
ptrace(PTRACE_PEEKUSER, 5461, offsetof(struct user, u_debugreg) + 48, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x6007e8, [0x37dfc20c40]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x37dfc20c48, [0x7ffff7ffd000]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400200, [0x6c2f343662696c2f]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400200, [0x6c2f343662696c2f]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400208, [0x2d78756e696c2d64]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400208, [0x2d78756e696c2d64]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400210, [0x732e34362d363878]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400210, [0x732e34362d363878]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400218, [0x400322e6f]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x37dfa1a818, [0x69000a09203a003a]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x37dfc20c40, [0x1]) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x400560, [0x90c3c900000001cc]) = 0
ptrace(PTRACE_POKEDATA, 5461, 0x400560, 0x90c3c900000001b8) = 0
ptrace(PTRACE_PEEKTEXT, 5461, 0x37dfa0f440, [0x909090909090c3cc]) = 0
ptrace(PTRACE_POKEDATA, 5461, 0x37dfa0f440, 0x909090909090c3f3) = 0
ptrace(PTRACE_SINGLESTEP, 5461, 0x1, SIG_0) = 0

Program exited with code 01.
(gdb) 

I've attached a patch of the differences between the . 
kernel-2.6.28-0.129.rc8.git2.fc11.x86_64 and latest
upstream linux-2.6.28-rc8 ptrace/utrace related code. 

Why not sync-up your kernel with the upstream source and these problems
will disappear ?
Comment 5 Jason Vas Dias 2008-12-18 15:13:09 EST
Here is a trace of the same gdb process running in a chroot
under the 2.6.28-rc8 upstream kernel:


$ strace -e trace=ptrace gdb t
GNU gdb (GDB) Fedora (6.8.50.20081214-1.fc11)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) start
Temporary breakpoint 1 at 0x400480: file t.c, line 1.
Starting program: /tmp/t
ptrace(0x4202 /* PTRACE_??? */, 7121, 0, 0xa8d4a0) = 0
ptrace(PTRACE_CONT, 7121, 0x1, SIG_0)   = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(0x4202 /* PTRACE_??? */, 7121, 0, 0xa8d4a0) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e3716e0) = 0
ptrace(0x4200 /* PTRACE_??? */, 7121, 0, 0x2) = 0
ptrace(0x4200 /* PTRACE_??? */, 7122, 0, 0x2) = 0
ptrace(0x4200 /* PTRACE_??? */, 7122, 0, 0x22) = 0
ptrace(PTRACE_CONT, 7122, 0, SIG_0)     = 0
ptrace(0x4201 /* PTRACE_??? */, 7122, 0, 0x7fff3e371920) = 0
ptrace(PTRACE_KILL, 7123, 0, 0)         = 0
ptrace(PTRACE_KILL, 7122, 0, 0)         = 0
ptrace(0x4200 /* PTRACE_??? */, 7121, 0, 0x3e) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x6006f8, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x6006f8, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x6006f8, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400488, [0x9090909090909090]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400488, [0x9090909090909090]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x400480, 0x90c3c900000001cc) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3f3]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3f3]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x37dfa0f440, 0x909090909090c3cc) = 0
ptrace(PTRACE_CONT, 7121, 0x1, SIG_0)   = 0
ptrace(0x4202 /* PTRACE_??? */, 7121, 0, 0xa8d4a0) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371410) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371420) = 0
ptrace(PTRACE_SETREGS, 7121, 0, 0x7fff3e371420) = 0
ptrace(PTRACE_PEEKUSER, 7121, offsetof(struct user, u_debugreg) + 48, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x6006f8, [0x37dfc20c40]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfc20c48, [0x7ffff7ffd000]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400200, [0x6c2f343662696c2f]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400200, [0x6c2f343662696c2f]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400208, [0x2d78756e696c2d64]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400208, [0x2d78756e696c2d64]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400210, [0x732e34362d363878]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400210, [0x732e34362d363878]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400218, [0x400322e6f]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa1a818, [0x69000a09203a003a]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfc20c40, [0x1]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001cc]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x400480, 0x90c3c900000001b8) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3cc]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x37dfa0f440, 0x909090909090c3f3) = 0
ptrace(PTRACE_SINGLESTEP, 7121, 0x1, SIG_0) = 0
ptrace(0x4202 /* PTRACE_??? */, 7121, 0, 0xa8d4a0) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371410) = 0
ptrace(PTRACE_PEEKUSER, 7121, offsetof(struct user, u_debugreg) + 48, [0xffff4ff0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x400480, 0x90c3c900000001cc) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3f3]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3f3]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x37dfa0f440, 0x909090909090c3cc) = 0
ptrace(PTRACE_CONT, 7121, 0x1, SIG_0)   = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(0x4202 /* PTRACE_??? */, 7121, 0, 0xa8d4a0) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371410) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371420) = 0
ptrace(PTRACE_SETREGS, 7121, 0, 0x7fff3e371420) = 0
ptrace(PTRACE_PEEKUSER, 7121, offsetof(struct user, u_debugreg) + 48, [0xffff4ff0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x6006f8, [0x37dfc20c40]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfc20c48, [0x7ffff7ffd000]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa1a818, [0x69000a09203a003a]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x7ffff7ffc640, [0x6c2f343662696c2f]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x7ffff7ffc640, [0x6c2f343662696c2f]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x7ffff7ffc648, [0x362e6f732e636269]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x7ffff7ffc648, [0x362e6f732e636269]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x7ffff7ffc650, [0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400200, [0x6c2f343662696c2f]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400200, [0x6c2f343662696c2f]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400208, [0x2d78756e696c2d64]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400208, [0x2d78756e696c2d64]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400210, [0x732e34362d363878]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400210, [0x732e34362d363878]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400218, [0x400322e6f]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfc20c40, [0x1]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001cc]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400488, [0x9090909090909090]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001cc]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400488, [0x9090909090909090]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400478, [0xe58948559090c3c9]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001cc]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x400480, 0x90c3c900000001b8) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3cc]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x37dfa0f440, 0x909090909090c3f3) = 0
ptrace(PTRACE_SINGLESTEP, 7121, 0x1, SIG_0) = 0
ptrace(0x4202 /* PTRACE_??? */, 7121, 0, 0xa8d4a0) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371410) = 0
ptrace(PTRACE_PEEKUSER, 7121, offsetof(struct user, u_debugreg) + 48, [0xffff4ff0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001b8]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x400480, 0x90c3c900000001cc) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3f3]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3f3]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x37dfa0f440, 0x909090909090c3cc) = 0
ptrace(PTRACE_CONT, 7121, 0x1, SIG_0)   = 0
ptrace(0x4202 /* PTRACE_??? */, 7121, 0, 0xa8d4a0) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371410) = 0
ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371420) = 0
ptrace(PTRACE_SETREGS, 7121, 0, 0x7fff3e371420) = 0
ptrace(PTRACE_PEEKUSER, 7121, offsetof(struct user, u_debugreg) + 48, [0xffff4ff0]) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x400480, [0x90c3c900000001cc]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x400480, 0x90c3c900000001b8) = 0
ptrace(PTRACE_PEEKTEXT, 7121, 0x37dfa0f440, [0x909090909090c3cc]) = 0
ptrace(PTRACE_POKEDATA, 7121, 0x37dfa0f440, 0x909090909090c3f3) = 0

Temporary breakpoint 1, main () at t.c:1
1       int main(){ return 1; }
(gdb)  


Let me know if you'd like any further information.

Thanks & Regards,
Jason
Comment 6 Jason Vas Dias 2008-12-18 15:36:08 EST
From the trace, it appears that the Fedora kernel does not honor the call:

    ptrace(PTRACE_SINGLESTEP, 5461, 0x1, SIG_0) = 0
    Program exited with code 01.

While the upstream 2.6.28-rc8 kernel does:
    ptrace(PTRACE_SINGLESTEP, 7121, 0x1, SIG_0) = 0
    ptrace(PTRACE_SINGLESTEP, 7121, 0x1, SIG_0) = 0
    ptrace(0x4202 /* PTRACE_??? */, 7121, 0, 0xa8d4a0) = 0
    ptrace(PTRACE_GETREGS, 7121, 0, 0x7fff3e371410) = 0
    ptrace(PTRACE_PEEKUSER, 7121, offsetof(struct user, u_debugreg) + 48,
    [0xffff4ff0]) = 0
    ...
Comment 7 Jan Kratochvil 2009-01-09 03:20:43 EST
*** Bug 479380 has been marked as a duplicate of this bug. ***
Comment 8 Michal Jaegermann 2009-01-10 02:18:58 EST
Even if a program does not return, for example because it went into some kind of an "event loop", and can be interrupted a "(gdb)" prompt can be reached, then every stepping command responds with "Cannot find bounds of current function".
Also emacs "gud" mode, probably because of that, does not display any sources
and in general does not seem to be doing anything much useful.  All in all - quite thorougly messed up.
Comment 9 Jan Kratochvil 2009-01-11 11:29:19 EST
*** Bug 476753 has been marked as a duplicate of this bug. ***
Comment 10 Jan Kratochvil 2009-01-11 15:23:38 EST
*** Bug 479578 has been marked as a duplicate of this bug. ***
Comment 11 Denys Vlasenko 2009-01-12 12:22:35 EST
Data point:

Tried it on latest F10 and it worked on this machine:

intel-greencity-01.rhts.bos.redhat.com 2.6.27.9-159.fc10.x86_64

So, the problem seems to appear after this kernel?

Wanted to test latest kernel (2.6.29-0.28.rc1.fc11.x86_64.rpm) but that machine didn't return back from reboot after I installed it :(

Guess I might try this kernel locally...
Comment 12 Michal Jaegermann 2009-01-12 12:38:09 EST
> Wanted to test latest kernel (2.6.29-0.28.rc1.fc11.x86_64.rpm) but that machine
> didn't return back from reboot

See bug 479525.  Most likely the same trouble.
Comment 13 Denys Vlasenko 2009-01-12 13:42:13 EST
Works for me with 2.6.29-0.28.rc1.fc11.x86_64 kernel on my F9 laptop:

# echo 'int main(){return 1;}' > t.c; gcc -g -o t t.c

# gdb ./t
GNU gdb Fedora (6.8-23.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) start
Breakpoint 1 at 0x400480: file t.c, line 1.
Starting program: /tmp/t
main () at t.c:1
1       int main(){return 1;}
Missing separate debuginfos, use: debuginfo-install glibc.x86_64
(gdb) continue
Continuing.

Program exited with code 01.
(gdb) quit

# uname -a
Linux localhost.localdomain 2.6.29-0.28.rc1.fc11.x86_64 #1 SMP Sun Jan 11 20:52:37 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
Comment 14 Denys Vlasenko 2009-01-12 14:03:44 EST
Reproduced with older kernel 2.6.28-0.129.rc8.git2.fc11.x86_64.

As compared to previous comment, the difference is only the kernel.
Otherwise, it is standard F9.

# rpm -q gdb
gdb-6.8-23.fc9.x86_64
Comment 15 Denys Vlasenko 2009-01-12 14:19:23 EST
Testing dups on 2.6.29-0.28.rc1.fc11.x86_64:

Bug 479578 - works:

# gdb ./foo
GNU gdb Fedora (6.8-23.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) run
Starting program: /root/srcdevel/gdb/foo

Program received signal SIGSEGV, Segmentation fault.
0x0000003824880f60 in strlen () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc.x86_64
(gdb) bt
#0  0x0000003824880f60 in strlen () from /lib64/libc.so.6
#1  0x000000382484a570 in vfprintf () from /lib64/libc.so.6
#2  0x000000382485107a in printf () from /lib64/libc.so.6
#3  0x00000000004004e8 in main () at foo.c:4
(gdb)


Bug 476753 - works:

# gdb --args ./hello
GNU gdb Fedora (6.8-23.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(gdb) start
Breakpoint 1 at 0x4004d0: file hello.c, line 3.
Starting program: /root/srcdevel/gdb/hello
main (argc=1, argv=0x7fff9e39c578) at hello.c:3
3       int main(int argc, char *argv[]) {
Missing separate debuginfos, use: debuginfo-install glibc.x86_64
(gdb)


Bug 479380 - works:

# printf '#include <stdio.h>\nint main(){printf("foo");return 0;}\n' > k.c
# gcc -g k.c
# gdb -q a.out
(gdb) b main
Breakpoint 1 at 0x4004d0: file k.c, line 2.
(gdb) r
Starting program: /root/srcdevel/gdb/a.out

Breakpoint 1, main () at k.c:2
2       int main(){printf("foo");return 0;}
Missing separate debuginfos, use: debuginfo-install glibc.x86_64
(gdb)
Comment 16 Michal Jaegermann 2009-01-12 20:06:42 EST
Indeed, it works for me with 2.6.29-0.28.rc1.fc11.x86_64 provided I will manage to boot it (which is not given, see bug 479778). But when it works then emacs gud
interface is operational too.
Comment 17 Matt McCutchen 2009-01-12 22:17:43 EST
kernel-2.6.29-0.28.rc1.fc11.i686 works for me.  I'm guessing the "utrace update" in kernel-2.6.29-0.19.rc0.git9.fc11 was the fix.
Comment 18 Jim Meyering 2009-01-13 01:06:44 EST
same here. I upgraded a rawhide system to that very latest kernel, and see that gdb breakpoints once again take effect.
Comment 19 Denys Vlasenko 2009-01-13 13:32:31 EST
BTW, I just committed fixes to strace so that it shows PTRACE_xxx better.
(In previous comments you can see that a lot of them are not parsed).

This is how it looks like now:

--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(PTRACE_GETSIGINFO, 12131, 0, {si_signo=SIGTRAP, si_code=SI_USER, si_pid=12131, si_uid=0, si_value={int=0, ptr=0}}) = 0
ptrace(PTRACE_PEEKUSER, 12131, 8*R15, [0]) = 0
ptrace(PTRACE_GETREGS, 12131, 0, 0x7fff4e997490) = 0
ptrace(PTRACE_PEEKUSER, 12131, offsetof(struct user, u_debugreg) + 48, [0]) = 0
ptrace(PTRACE_CONT, 12131, 0x1, SIG_0)  = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(PTRACE_GETSIGINFO, 12131, 0, {si_signo=SIGTRAP, si_code=SI_USER, si_pid=12131, si_uid=0, si_value={int=0, ptr=0}}) = 0
ptrace(PTRACE_PEEKUSER, 12131, 8*R15, [0]) = 0
ptrace(PTRACE_GETREGS, 12131, 0, 0x7fff4e997490) = 0
ptrace(PTRACE_PEEKUSER, 12131, offsetof(struct user, u_debugreg) + 48, [0]) = 0
ptrace(PTRACE_SETOPTIONS, 12131, 0, PTRACE_O_TRACEFORK) = 0
ptrace(PTRACE_SETOPTIONS, 12132, 0, PTRACE_O_TRACEFORK) = 0
ptrace(PTRACE_SETOPTIONS, 12132, 0, PTRACE_O_TRACEFORK|PTRACE_O_TRACEVFORKDONE) = 0
ptrace(PTRACE_CONT, 12132, 0, SIG_0)    = 0
ptrace(PTRACE_GETEVENTMSG, 12132, 0, 0x7fff4e997958) = 0
ptrace(PTRACE_KILL, 12133, 0, 0)        = 0
ptrace(PTRACE_KILL, 12132, 0, 0)        = 0
ptrace(PTRACE_SETOPTIONS, 12131, 0, PTRACE_O_TRACEFORK|PTRACE_O_TRACEVFORK|PTRACE_O_TRACECLONE|PTRACE_O_TRACEEXEC|PTRACE_O_TRACEVFORKDONE) = 0
ptrace(PTRACE_PEEKTEXT, 12131, 0x6006f8, [0]) = 0
...
Comment 20 Jason Vas Dias 2009-02-04 17:46:06 EST
This still appears to be a problem with latest 2.6.28-0.129.rc8.git2.fc11.x86_64
kernel :
...
(gdb) start
Temporary breakpoint 1 at 0x400560: file t.c, line 1.
Starting program: /tmp/t 

Program exited normally.
(gdb) exit
...

Maybe I missed a fix in kernel-2.6.29-0.28.rc1 which is now dropped from 
2.6.28-0.129.rc8.git2.fc11 ? If so, please could the Fedora Kernel maintainers
replace it ?  

Thanks,
Jason
Comment 21 Denys Vlasenko 2009-02-05 08:59:20 EST
> Maybe I missed a fix in kernel-2.6.29-0.28.rc1 which is now dropped from 
2.6.28-0.129.rc8.git2.fc11

Look at version numbers. Based on them, fix in 2.6.29.something came later than 2.6.28.something. So the fix could not be "dropped from" 2.6.28.something, it wasn't there in the first place.
Comment 22 Jason Vas Dias 2009-02-05 18:43:22 EST
True, but I was referring to the latest version pushed by the yum repo servers -
where can I get the kernel rpms with the fix ?
This is the main reason I prefer running a kernel.org kernel rather than
a Fedora kernel ! yet I need to test in this environment . Please tell me
where I can pick up the fixes if they cannot go out to the repo servers yet - thanks, Jason.
Comment 23 Jason Vas Dias 2009-02-05 18:51:14 EST
I run yum with "development" and "rawhide" repos enabled and yum thinks
the latest kernel is 2.6.28-0.129.rc8.git2.fc11 - where is kernel-2.6.29-0.28.rc1 available from ?
Comment 24 Matt McCutchen 2009-02-05 19:50:41 EST
kernel-2.6.29-0.28.rc1 is on the Koji build system.  AIUI, packages are first built there and a subset of them later make it to the repositories, so it's a place to look for bleeding-edge fixes.

http://koji.fedoraproject.org/koji/packageinfo?packageID=8

The current F10 kernel, 2.6.27.12-170.2.5.fc10.i686, also works for me.
Comment 25 Jason Vas Dias 2009-02-25 13:55:55 EST
Thanks ! This is now fixed with 2.6.29+ based Fedora kernels .

Note You need to log in before you can comment on or make changes to this bug.