Created attachment 897508 [details] testcase Description of problem: gdb fails to generate a core. Version-Release number of selected component (if applicable): gdb-7.7.1-13.fc20.x86_64 How reproducible: Steps to Reproduce: 1. gcc cant-save-core.c -o cant-save-core -pthread -g2 -Wall 2. gdb ./cant-save-core 3. run and wait for abort() 4. generate-core-file Actual results: % gdb ./cant-save-core GNU gdb (GDB) Fedora 7.7.1-13.fc20 Copyright (C) 2014 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". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./cant-save-core...done. (gdb) r Starting program: /home/pawels/Downloads/cant-save-core [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". [New Thread 0x7ffff7fda700 (LWP 10538)] [New Thread 0x7ffff77d9700 (LWP 10539)] [Thread 0x7ffff7fda700 (LWP 10538) exited] bug Program received signal SIGABRT, Aborted. [Switching to Thread 0x7ffff77d9700 (LWP 10539)] 0x0000003a83635c39 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig); (gdb) generate-core-file Couldn't get registers: No such process.
Thanks for the bugreport. BTW an easy workaround is 'info threads': Program received signal SIGABRT, Aborted. [...] (gdb) gcore foobar Couldn't get registers: No such process. (gdb) info threads [...] (gdb) gcore foobar Saved corefile foobar (gdb) gcore tries to access the exited thread: [Thread 0x7ffff7fce700 (LWP 6895) exited] ptrace(PTRACE_GETREGS, 6895, 0, 0x7fff18167dd0) = -1 ESRCH (No such process)
[patch] Fix 'gcore' with exited threads https://sourceware.org/ml/gdb-patches/2014-06/msg00406.html It will be in Fedora 21+ sometimes in the future. If there is need for an F-20 backport reopen this Bug, please.