Bug 1099405 - Couldn't get registers: No such process.
Summary: Couldn't get registers: No such process.
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: 20
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Jan Kratochvil
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2014-05-20 08:49 UTC by Paweł Sikora
Modified: 2014-06-09 20:32 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-06-09 20:32:48 UTC
Type: Bug

Attachments (Terms of Use)
testcase (603 bytes, text/x-csrc)
2014-05-20 08:49 UTC, Paweł Sikora
no flags Details

Description Paweł Sikora 2014-05-20 08:49:40 UTC
Created attachment 897508 [details]

Description of problem:

gdb fails to generate a core.

Version-Release number of selected component (if applicable):


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:
Find the GDB manual and other documentation resources online at:
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]

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.

Comment 1 Jan Kratochvil 2014-05-20 09:05:00 UTC
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

gcore tries to access the exited thread:
[Thread 0x7ffff7fce700 (LWP 6895) exited]
ptrace(PTRACE_GETREGS, 6895, 0, 0x7fff18167dd0) = -1 ESRCH (No such process)

Comment 2 Jan Kratochvil 2014-06-09 20:32:48 UTC
[patch] Fix 'gcore' with exited threads

It will be in Fedora 21+ sometimes in the future.  If there is need for an F-20 backport reopen this Bug, please.

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