From: Doug Evans <dje@google.com>
To: Pedro Alves <palves@redhat.com>
Cc: Sandra Loosemore <sandra@codesourcery.com>,
gdb-patches@sourceware.org
Subject: Re: Cannot execute this command without a live selected thread.
Date: Fri, 24 Oct 2014 19:19:00 -0000 [thread overview]
Message-ID: <21578.42546.658345.633154@ruffy.mtv.corp.google.com> (raw)
In-Reply-To: <544A8F15.9000906@redhat.com>
Pedro Alves writes:
> On 10/24/2014 06:23 PM, Pedro Alves wrote:
> > On 10/24/2014 06:07 PM, Sandra Loosemore wrote:
> >> Sending packet: $?#3f...Packet received: S00
> >> Sending packet: $qfThreadInfo#bb...Packet received: l
> >
> > Huh, I think this is the problem.
> >
> > So this target supports qfThreadInfo, but then it's returning
> > an empty thread list... remote_update_thread_list will delete
> > threads from GDB's list that are not found in the thread list that
> > the target reported. Why is the target reporting that empty list?
> >
> > See ab970af19746364a4f236bebc238ebb036adc898.
> >
> > We may be able add a workaround for this. :-/ Just in case,
> > can you confirm that the current thread's ptid (inferior_ptid)
> > is magic_null_ptid?
>
> Please give this a try.
>
> >From 2062235a91a3c69e73c39b0f8a4f78f4ec396931 Mon Sep 17 00:00:00 2001
> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 24 Oct 2014 18:27:14 +0100
> Subject: [PATCH] gdb/ 2014-10-24 Pedro Alves <palves@redhat.com>
>
> * remote.c (remote_thread_alive): New, factored out from ...
> (remote_thread_alive): ... this.
> (remote_update_thread_list): Bail out before deleting threads if
> the target returned an empty list, and, the current thread has a
> magic/fake ptid.
> ---
> gdb/remote.c | 35 ++++++++++++++++++++++++++++++++---
> 1 file changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/gdb/remote.c b/gdb/remote.c
> index 20f2988..affc7c2 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -1842,11 +1842,11 @@ set_general_process (void)
> }
>
> \f
> -/* Return nonzero if the thread PTID is still alive on the remote
> - system. */
> +/* Return nonzero if this is the main thread that we made up ourselves
> + to model non-threaded targets as single-threaded. */
>
> static int
> -remote_thread_alive (struct target_ops *ops, ptid_t ptid)
> +remote_thread_always_alive (struct target_ops *ops, ptid_t ptid)
> {
> struct remote_state *rs = get_remote_state ();
> char *p, *endp;
> @@ -1861,6 +1861,23 @@ remote_thread_alive (struct target_ops *ops, ptid_t ptid)
> multi-threading. */
> return 1;
>
> + return 0;
> +}
> +
> +/* Return nonzero if the thread PTID is still alive on the remote
> + system. */
> +
> +static int
> +remote_thread_alive (struct target_ops *ops, ptid_t ptid)
> +{
> + struct remote_state *rs = get_remote_state ();
> + char *p, *endp;
> +
> + /* Check if this is a thread that we made up ourselves to model
> + non-threaded targets as single-threaded. */
> + if (remote_thread_always_alive (ops, ptid))
> + return 1;
> +
> p = rs->buf;
> endp = rs->buf + get_remote_packet_size ();
>
> @@ -2780,6 +2797,18 @@ remote_update_thread_list (struct target_ops *ops)
>
> got_list = 1;
>
> + if (VEC_empty (thread_item_t, context.items)
> + && remote_thread_always_alive (ops, inferior_ptid))
> + {
> + /* Some targets don't really support threads, but still
> + reply an (empty) thread list in response to the thread
> + listing packets, instead of replying "packet not
> + supported". Exit early so we don't delete the main
> + thread. */
> + do_cleanups (old_chain);
> + return;
> + }
> +
> /* CONTEXT now holds the current thread list on the remote
> target end. Delete GDB-side threads no longer found on the
> target. */
I looked at the current remote_thread_alive.
It has this:
if (ptid_get_pid (ptid) != 0 && ptid_get_lwp (ptid) == 0)
/* The main thread is always alive. This can happen after a
vAttach, if the remote side doesn't support
multi-threading. */
return 1;
pid != 0 && lwp == 0 -> main thread?
That sounds odd.
Do you know why the test is the way it is?
next prev parent reply other threads:[~2014-10-24 19:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-24 15:55 Sandra Loosemore
2014-10-24 16:07 ` Pedro Alves
2014-10-24 17:08 ` Sandra Loosemore
2014-10-24 17:23 ` Pedro Alves
2014-10-24 17:40 ` Pedro Alves
2014-10-24 19:02 ` Sandra Loosemore
2014-10-24 19:19 ` Doug Evans [this message]
2014-10-24 19:40 ` Pedro Alves
2014-10-24 20:02 ` Doug Evans
2014-10-24 20:20 ` Pedro Alves
2014-10-24 20:38 ` Doug Evans
2014-10-24 20:52 ` Remove libthread_db -> remove thread_stratum? [was Re: Cannot execute this command without a live selected thread.] Doug Evans
2014-10-24 22:07 ` Cannot execute this command without a live selected thread Pedro Alves
2014-10-27 19:53 ` Sandra Loosemore
2014-10-28 12:10 ` [pushed] Workaround remote targets that report an empty list to qfThreadInfo (Re: Cannot execute this command without a live selected thread.) Pedro Alves
2014-10-29 19:16 ` Doug Evans
2014-10-24 17:57 ` Cannot execute this command without a live selected thread Sandra Loosemore
2014-10-24 18:15 ` Pedro Alves
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=21578.42546.658345.633154@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=sandra@codesourcery.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