FS#38153 - [gdb] Debugged programs ignore breakpoints and exit during startup.

Attached to Project: Arch Linux
Opened by Tommi Hirvola (deffi) - Sunday, 15 December 2013, 22:56 GMT
Last edited by Allan McRae (Allan) - Monday, 16 December 2013, 15:22 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Allan McRae (Allan)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Since my last system upgrade gdb fails to stop debuggees at breakpoints. Message "During startup program exited normally" is printed when the debuggee finishes execution. Interestingly, running gdb as a root solves the problem (obviously not a recommended solution).


Additional info:

* package version(s)
core/gcc 4.8.2-6 (base-devel) [installed]
extra/gdb 7.6.2-1 [installed]

* config and/or log files etc.
Default configuration.


Steps to reproduce:

[deffi@arch Desktop]$ cat test.c
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("hello\n");
return 0;
}
[deffi@arch Desktop]$ gcc -g -O0 test.c -o test
[deffi@arch Desktop]$ gdb ./test
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 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-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/deffi/Desktop/test...done.
(gdb) b main
Breakpoint 1 at 0x40050c: file test.c, line 3.
(gdb) r
Starting program: /home/deffi/Desktop/./test
hello
During startup program exited normally.
(gdb)


Now as a root:

[deffi@arch Desktop]$ sudo gdb ./test
[sudo] password for deffi:
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 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-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/deffi/Desktop/test...done.
(gdb) b main
Breakpoint 1 at 0x40050c: file test.c, line 3.
(gdb) r
Starting program: /home/deffi/Desktop/./test
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?

Breakpoint 1, main (argc=1, argv=0x7fffffffebe8) at test.c:3
3 printf("hello\n");
(gdb)
This task depends upon

Closed by  Allan McRae (Allan)
Monday, 16 December 2013, 15:22 GMT
Reason for closing:  Not a bug
Comment by Allan McRae (Allan) - Monday, 16 December 2013, 00:32 GMT
Works for me...
Comment by Gerardo Exequiel Pozzi (djgera) - Monday, 16 December 2013, 01:56 GMT
works fine here.

$ gdb ./test
Reading symbols from /tmp/test...done.
(gdb) b main
Breakpoint 1 at 0x40050c: file test.c, line 3.
(gdb) r
Starting program: /tmp/./test
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?

Breakpoint 1, main (argc=1, argv=0x7fffffffe068) at test.c:3
3 printf("hello\n");
(gdb)
Comment by Allan McRae (Allan) - Monday, 16 December 2013, 13:36 GMT
I'd suggest creating a new user and trying there. That should direct you to the problem.
Comment by Eric Diaz Fernandez (ericdf) - Monday, 16 December 2013, 14:32 GMT
I've got this problem with the last update.
I downgraded to the previous gdb version (gdb-7.6.1-1-x86_64.pkg.tar.xz) and the issue still exists.

GNU gdb (GDB) 7.6.1
Copyright (C) 2013 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-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from ...
(gdb) break main
Breakpoint 1 at 0x41e477: file main.c, line 640.
(gdb) run

... and the program starts without breaking at main

Note that two packages are prevented from upgrade on my system: (probably irrelevant, but let's be thorough)
automake (1.13.2 installed)
openssl (last version with static libs installed)

Here is the upgrade log:

[2013-12-16 09:42] [PACMAN] upgraded linux-api-headers (3.10.6-1 -> 3.12.4-1)
[2013-12-16 09:42] [PACMAN] upgraded glibc (2.18-10 -> 2.18-11)
[2013-12-16 09:42] [PACMAN] upgraded binutils (2.23.2-3 -> 2.24-1)
[2013-12-16 09:42] [PACMAN] upgraded bison (3.0.1-1 -> 3.0.2-1)
[2013-12-16 09:42] [PACMAN] upgraded gstreamer0.10 (0.10.36-2 -> 0.10.36-3)
[2013-12-16 09:42] [PACMAN] upgraded gstreamer0.10-base (0.10.36-1 -> 0.10.36-2)
[2013-12-16 09:42] [PACMAN] upgraded gstreamer0.10-bad (0.10.23-5 -> 0.10.23-6)
[2013-12-16 09:42] [PACMAN] upgraded gstreamer0.10-bad-plugins (0.10.23-5 -> 0.10.23-6)
[2013-12-16 09:42] [PACMAN] upgraded gstreamer0.10-good (0.10.31-3 -> 0.10.31-4)
[2013-12-16 09:42] [PACMAN] upgraded gstreamer0.10-ffmpeg (0.10.13-1 -> 0.10.13-2)
[2013-12-16 09:42] [PACMAN] upgraded farstream-0.1 (0.1.2-2 -> 0.1.2-3)
[2013-12-16 09:42] [PACMAN] upgraded x264 (20131030-1 -> 20131030-2)
[2013-12-16 09:42] [PACMAN] upgraded ffmpeg (1:2.1.1-1 -> 1:2.1.1-2)
[2013-12-16 09:42] [PACMAN] upgraded file (5.15-1 -> 5.16-1)
[2013-12-16 09:42] [PACMAN] upgraded nss (3.15.3-1 -> 3.15.3.1-1)
[2013-12-16 09:42] [PACMAN] upgraded firefox (25.0.1-1 -> 26.0-2)
[2013-12-16 09:42] [PACMAN] upgraded flashplugin (11.2.202.327-1 -> 11.2.202.332-1)
[2013-12-16 09:42] [PACMAN] upgraded gcc-libs (4.8.2-5 -> 4.8.2-6)
[2013-12-16 09:42] [PACMAN] upgraded gcc (4.8.2-5 -> 4.8.2-6)
[2013-12-16 09:42] [PACMAN] upgraded gcc-go (4.8.2-5 -> 4.8.2-6)
[2013-12-16 09:42] [PACMAN] upgraded gcc-objc (4.8.2-5 -> 4.8.2-6)
[2013-12-16 09:42] [PACMAN] upgraded gdb (7.6.1-1 -> 7.6.2-1)
[2013-12-16 09:42] [PACMAN] upgraded gstreamer0.10-base-plugins (0.10.36-1 -> 0.10.36-2)
[2013-12-16 09:42] [PACMAN] upgraded inetutils (1.9.1.341-1 -> 1.9.1.341-2)
[2013-12-16 09:42] [PACMAN] upgraded lib32-glibc (2.18-10 -> 2.18-11)
[2013-12-16 09:42] [PACMAN] upgraded lib32-gcc-libs (4.8.2-5 -> 4.8.2-6)
[2013-12-16 09:42] [PACMAN] upgraded libburn (1.3.2-1 -> 1.3.4-1)
[2013-12-16 09:42] [PACMAN] upgraded libisofs (1.3.2-1 -> 1.3.4-1)
[2013-12-16 09:42] [PACMAN] upgraded libjpeg-turbo (1.3.0-3 -> 1.3.0-4)
[2013-12-16 09:42] [PACMAN] upgraded linux (3.12.3-1 -> 3.12.5-1)
[2013-12-16 09:42] [PACMAN] upgraded linux-headers (3.12.3-1 -> 3.12.5-1)
[2013-12-16 09:42] [PACMAN] upgraded make (4.0-1 -> 4.0-2)
[2013-12-16 09:42] [PACMAN] upgraded man-pages (3.54-1 -> 3.55-1)
[2013-12-16 09:42] [PACMAN] upgraded mesa (9.2.4-1 -> 9.2.5-1)
[2013-12-16 09:42] [PACMAN] upgraded mpfr (3.1.2.p4-1 -> 3.1.2.p5-1)
[2013-12-16 09:42] [PACMAN] upgraded php (5.5.6-1 -> 5.5.7-1)
[2013-12-16 09:42] [PACMAN] upgraded qt4 (4.8.5-6 -> 4.8.5-7)
[2013-12-16 09:42] [PACMAN] upgraded qt5-base (5.1.1-5 -> 5.2.0-1)
[2013-12-16 09:42] [PACMAN] upgraded rsyslog (7.4.6-1 -> 7.4.7-1)
[2013-12-16 09:42] [PACMAN] upgraded svga-dri (9.2.4-1 -> 9.2.5-1)
[2013-12-16 09:42] [PACMAN] upgraded thunderbird (24.1.1-1 -> 24.2.0-1)
[2013-12-16 09:42] [PACMAN] upgraded util-linux (2.24-1 -> 2.24-2)
[2013-12-16 09:42] [PACMAN] upgraded virtualbox-guest-modules (4.3.4-1 -> 4.3.4-3)
[2013-12-16 09:42] [PACMAN] upgraded virtualbox-host-modules (4.3.4-1 -> 4.3.4-3)
[2013-12-16 09:42] [PACMAN] upgraded vlc (2.1.1-2 -> 2.1.2-1)
[2013-12-16 09:42] [PACMAN] upgraded xf86-input-synaptics (1.7.1-1 -> 1.7.2-1)
[2013-12-16 09:42] [PACMAN] upgraded xorg-server-common (1.14.4-1 -> 1.14.5-1)
[2013-12-16 09:42] [PACMAN] upgraded xorg-server (1.14.4-1 -> 1.14.5-1)
[2013-12-16 09:42] [PACMAN] upgraded xscreensaver (5.23-1 -> 5.26-1)
[2013-12-16 09:42] [PACMAN] upgraded zenity (3.10.0-1 -> 3.10.2-1)

And the downgrade:

[2013-12-16 15:11] [PACMAN] Running 'pacman -U gdb-7.6.1-1-x86_64.pkg.tar.xz'
[2013-12-16 15:11] [PACMAN] downgraded gdb (7.6.2-1 -> 7.6.1-1)
Comment by Allan McRae (Allan) - Monday, 16 December 2013, 14:39 GMT
If you think it is caused by an update, find the package responsible. Two of us can not replicate, so you will need to do some investigation.
Comment by Tommi Hirvola (deffi) - Monday, 16 December 2013, 14:44 GMT
Ok, I got it fixed after booting my system a couple of times. Initially the problem persisted through reboots, but after `echo 1 > /proc/sys/kernel/yama/ptrace_scope` and rebooting the problem seems to be gone. I'm no longer able to reproduce the bug. My (far fetched) guess is that this might have something to do with having ptrace_scope=0 and doing a system upgrade.

Loading...