unable to get backtrace

Asked by tom anderson on 2010-11-18

I am unable to get a meaningful backtrace after loading a core file. I do the following

1. compile singlethread2.c
2. ./singlethread2
3. gdb singlethread2
4. attach <pid>
5. gcore
6. gdb singlethread2 <core>

details below:

========================= compile singlethread2.c
g++ -Wall -g -D REEENTRANT -o singlethread2.g singlethread2.c

========================= singlethread2.c
sh-3.00$ cat singlethread2.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);
}

========================= attaching to single thread processes
0 %> gdb singlethread2.g

GNU gdb 6.8-debian
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-linux-gnu"...
(gdb) attach 11575
Attaching to program: /import/singlethread2.g, process 11575
Reading symbols from /usr/lib/libstdc++.so.6...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00007fc8881e1fc0 in write () from /lib/libc.so.6
(gdb) bt
#0 0x00007fc8881e1fc0 in write () from /lib/libc.so.6
#1 0x00007fc88817d87a in _IO_file_write () from /lib/libc.so.6
#2 0x00007fc88817e759 in _IO_do_write () from /lib/libc.so.6
#3 0x00007fc88817d4e9 in _IO_file_xsputn () from /lib/libc.so.6
#4 0x00007fc88814ffb3 in vfprintf () from /lib/libc.so.6
#5 0x00007fc888159eca in printf () from /lib/libc.so.6
#6 0x0000000000400614 in main () at singlethread2.c:7
(gdb) gcore core.singlethead2.g.11575
Saved corefile core.singlethead2.g.11575

========================= loading core file
0 %> gdb singlethread2.g core.singlethead2.g.11575

GNU gdb 6.8-debian
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-linux-gnu"...
Core was generated by `/import/core_files/singlethread2.g'.
[New process 11575]
#0 0x00007fc8881e1fc0 in ?? ()
(gdb) bt
#0 0x00007fc8881e1fc0 in ?? ()
#1 0x00007fc88817d87a in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb)

-Thomas

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gdb Edit question
Assignee:
No assignee Edit question
Last query:
2010-11-23
Last reply:
2014-11-20
tom anderson (xentoma) said : #1

I have tried this on fedora 14 and it works properly. Why doesnt this work on ubunut? I tried on ubuntu 8.1, 9.04 and 10.10. It doesn't work on any of those ubuntu desktop releases.

Here is the output from fedora 14

[root@fedora14 ~]# gdb singlethread2.g core.10244
GNU gdb (GDB) Fedora (7.2-23.fc14)
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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/singlethread2.g...done.
[New Thread 10244]
Missing separate debuginfo for
Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/25/7d0d6467b9f4374470e0384a3e602be99b058e
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Core was generated by `./singlethread2.g'.
#0 0x005b1416 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12.90-19.i686
(gdb) info share
From To Syms Read Shared Object Library
0x00e5bbf0 0x00f7e1d4 Yes (*) /lib/libc.so.6
0x00a18850 0x00a30e2f Yes (*) /lib/ld-linux.so.2
(*): Shared library is missing debugging information.
(gdb) bt
#0 0x005b1416 in __kernel_vsyscall ()
#1 0x00f111e3 in __write_nocancel () from /lib/libc.so.6
#2 0x00eb03ac in _IO_new_file_write () from /lib/libc.so.6
#3 0x00eaffff in new_do_write () from /lib/libc.so.6
#4 0x00eb193e in _IO_new_do_write () from /lib/libc.so.6
#5 0x00eb1c7a in _IO_new_file_overflow () from /lib/libc.so.6
#6 0x00eb0145 in _IO_new_file_xsputn () from /lib/libc.so.6
#7 0x00e85d7a in vfprintf () from /lib/libc.so.6
#8 0x00e900a0 in printf () from /lib/libc.so.6
#9 0x080483f1 in main () at singlethread2.c:7
(gdb)

tom anderson (xentoma) said : #2

I have also tried this on the latest debian and it works. Here is the output from debian

debian:/home/install# gdb ./singlethread2.g core.3008
GNU gdb 6.8-debian
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 "i486-linux-gnu"...

warning: Can't read pathname for load map: Input/output error.
Reading symbols from /usr/lib/libstdc++.so.6...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/i686/cmov/libm.so.6...done.
Loaded symbols for /lib/i686/cmov/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/i686/cmov/libc.so.6...done.
Loaded symbols for /lib/i686/cmov/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done. Loaded symbols for /lib/ld-linux.so.2 Core was generated by `/home/install/singlethread2.g'.
[New process 3008]
#0 0xb7710416 in __kernel_vsyscall ()
(gdb) bt
#0 0xb7710416 in __kernel_vsyscall ()
#1 0xb75553a3 in write () from /lib/i686/cmov/libc.so.6
#2 0xb74eeeac in _IO_file_write () from /lib/i686/cmov/libc.so.6
#3 0xb74f0027 in _IO_do_write () from /lib/i686/cmov/libc.so.6
#4 0xb74efa00 in _IO_file_overflow () from /lib/i686/cmov/libc.so.6
#5 0xb74eeb15 in _IO_file_xsputn () from /lib/i686/cmov/libc.so.6
#6 0xb74c4c97 in vfprintf () from /lib/i686/cmov/libc.so.6
#7 0xb74ce4e0 in printf () from /lib/i686/cmov/libc.so.6
#8 0x080484b7 in main () at singlethread2.c:8
(gdb)

install@debian:~$ cat /proc/version
Linux version 2.6.26-2-686 (Debian 2.6.26-25lenny1) (<email address hidden>) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Thu Sep 16 19:35:51 UTC 2010
install@debian:~$ cat /etc/issue
Debian GNU/Linux 5.0 \n \l

install@debian:~$

Matthias Klose (doko) said : #3

closing this question. please recheck with 14.04 LTS or 14.10.

Can you help with this problem?

Provide an answer of your own, or ask tom anderson for more information if necessary.

To post a message you must log in.