From: Pedro Alves <palves@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch] Fix 'gcore' with exited threads
Date: Mon, 23 Jun 2014 15:06:00 -0000 [thread overview]
Message-ID: <53A8427D.6070902@redhat.com> (raw)
In-Reply-To: <20140609203020.GA22447@host2.jankratochvil.net>
On 06/09/2014 09:30 PM, Jan Kratochvil wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1099405
>
> 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)
Note this will still happen if you have the exited thread selected,
as in that case the thread can't be deleted:
$ ./gdb ~/gdb/tests/threads -ex "set non-stop on"
...
(gdb) t 2
[Switching to thread 2 (Thread 0x7ffff7fc6700 (LWP 23009))]
#0 thread_function0 (arg=0x0) at threads.c:64
64 usleep (1); /* Loop increment. */
(gdb) p *myp=0
$1 = 0
(gdb) c&
Continuing.
(gdb) [Thread 0x7ffff7fc6700 (LWP 23009) exited]
(gdb) thread
[Current thread is 2 (Thread 0x7ffff7fc6700 (LWP 22973)) (exited)]
(gdb) info threads
Id Target Id Frame
3 Thread 0x7ffff77c5700 (LWP 22974) "threads" (running)
1 Thread 0x7ffff7fc7740 (LWP 22972) "threads" (running)
The current thread <Thread ID 2> has terminated. See `help thread'.
(gdb) gcore
Couldn't get registers: No such process.
(gdb)
It seems to me linux_corefile_thread_callback should skip exited
threads too.
> Without the TRY_CATCH protection testsuite FAILs for:
> FAIL: gdb.threads/gcore-thread.exp: save a zeroed-threads corefile
> FAIL: gdb.threads/gcore-thread.exp: core0file: re-load generated corefile (bad file format)
What does the log show ?
> Maybe the TRY_CATCH could be more inside update_thread_list().
I'll assume "info threads" is failing at that point too
then. Maybe we should downgrade whatever error is triggering
to a warning?
> Similar update_thread_list() call is IMO missing in procfs_make_note_section()
> but I do not have where to verify that change.
I wonder whether we should update the thread list in generic
code (write_gcore_file).
> +gdb_test_multiple "help gcore" "help gcore" {
> + -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
Is this coming from copy/paste of existing tests? I believe
this is is stale -- gcore.o has been in COMMON_OBS for a while
now. I think the actual error will be whatever the default for
the target method throws.
> + # gcore command not supported -- nothing to test here.
> + unsupported "gdb does not support gcore on this target"
> + return -1
> + }
> + -re "Save a core file .*\r\n$gdb_prompt $" {
> + pass "help gcore"
> + }
> +}
--
Pedro Alves
next prev parent reply other threads:[~2014-06-23 15:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-09 20:30 Jan Kratochvil
2014-06-23 15:06 ` Pedro Alves [this message]
2014-08-17 21:16 ` [patch+7.8?] " Jan Kratochvil
2014-08-21 10:41 ` [PUSHED] Remove useless gcore command detection (was: Re: [patch+7.8?] Fix 'gcore' with exited threads) Pedro Alves
2014-08-21 18:29 ` Jan Kratochvil
2014-08-21 11:33 ` [patch+7.8?] Fix 'gcore' with exited threads Pedro Alves
2014-08-21 18:45 ` [commit+7.8] " Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53A8427D.6070902@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox