gcore produces the broken core bt in GDB displays backtrace abnormally.

Bug #609666 reported by HATAYAMA Daisuke
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
gdb (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: gdb

gcore, a subcommand in GDB providing the feature of producing a core dump for currently running processes, produces a broken core dump when the target program sleeps.

Step to reproduce:

$ cd /tmp
$ gcc -x c - -o loop
#include <unistd.h>
main(){for(;;)sleep(1);}
$ ./loop &
[1] 3598
$ gcore 3598
0x00007f78bb59e370 in nanosleep () from /lib/libc.so.6
Saved corefile core.3598
$ gdb loop core.3598
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 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-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/loop...(no debugging symbols found)...done.
[New Thread 3598]
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Core was generated by `/tmp/loop'.
#0 0x00007f78bb59e370 in ?? ()
(gdb) bt
#0 0x00007f78bb59e370 in ?? ()
#1 0x00007f78bb59e200 in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb)

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: gdb 7.1-1ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-24.38-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic x86_64
Architecture: amd64
Date: Sun Jul 25 14:50:14 2010
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
ProcEnviron:
 PATH=(custom, user)
 LANG=ja_JP.utf8
 SHELL=/bin/bash
SourcePackage: gdb

Revision history for this message
HATAYAMA Daisuke (d-hatayama) wrote :
Revision history for this message
Bruce Edge (bruce-edge) wrote :

I can confirm this. gdb cores work with redhat & debian sarge, not not on ubuntu lucid or meerkat.

Revision history for this message
Bruce Edge (bruce-edge) wrote :
Download full text (3.8 KiB)

Here's a simple test case:

demo.c:

#include <stdio.h>
#include <stdlib.h>
int x = 0;
int main(void) {
   while(1) {
      x++;
      printf("X is now %d.\n", x);
   }
   return(1);
}

%> g++ -g3 demo.c -o demo
.....
Ctrl-Z

0 %> gdb -p `pgrep demo` demo

GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /users/bedge/tmp/demo/demo...done.
Attaching to program: /users/bedge/tmp/demo/demo, process 12506
Reading symbols from /usr/lib/libstdc++.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/libm.so.6...Reading symbols from /usr/lib/debug/lib/libm-2.12.1.so...done.
done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...Reading symbols from /usr/lib/debug/lib/libc-2.12.1.so...done.
done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...Reading symbols from /usr/lib/debug/lib/ld-2.12.1.so...done.
done.
Loaded symbols for /lib/ld-linux.so.2
0x003c8416 in __kernel_vsyscall ()
(gdb) where
#0 0x003c8416 in __kernel_vsyscall ()
#1 0x002baf53 in __write_nocancel () at ../sysdeps/unix/syscall-template.S:82
#2 0x002630d4 in _IO_new_file_write (f=0x3554e0, data=0xb771e000, n=16) at fileops.c:1276
#3 0x00262d5f in new_do_write (fp=0x3554e0, data=0xb771e000 "X is now 78856.\n", to_do=16) at fileops.c:530
#4 0x00263076 in _IO_new_do_write (fp=0x3554e0, data=0xb771e000 "X is now 78856.\n", to_do=16) at fileops.c:503
#5 0x00263b7d in _IO_new_file_overflow (f=0x3554e0, ch=-1) at fileops.c:881
#6 0x00262ea8 in _IO_new_file_xsputn (f=0x3554e0, data=0x804859b, n=2) at fileops.c:1358
#7 0x0023882a in _IO_vfprintf_internal (s=0x3554e0, format=0x8048590 "X is now %d.\n", ap=0xbfbc65b4 "\b4\001") at vfprintf.c:1644
#8 0x00242ad0 in __printf (format=0x8048590 "X is now %d.\n") at printf.c:35
#9 0x080484bf in main () at demo.c:7
(gdb)

(gdb) gcore
Saved corefile core.12506

-rw-r--r-- 1 bedge wlvusers 232352 2010-11-18 16:07 core.12506

0 %> gdb demo core.12506

GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /users/bedge/tmp/demo/demo...done.
[New Thread 12506]
Reading symbols from /lib/ld-linux.so.2...Reading symbols from /usr/lib/debug/lib/ld-2.12.1.so...done.
done.
Loaded sym...

Read more...

Revision history for this message
Bruce Edge (bruce-edge) wrote :

Forgot system details:

0 %> uname -a

Linux ice 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:36:48 UTC 2010 i686 GNU/Linux

0 %> cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"

Revision history for this message
Matthias Klose (doko) wrote :

closing this rather old issue. sorry for not addressing this earlier. Please could you recheck with the recent 14.04 LTS or 14.10 releases and reopen the issue if the problem persists?

Changed in gdb (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.