]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/remote.c
Merge remote thread listing methods
authorPedro Alves <palves@redhat.com>
Wed, 15 Oct 2014 21:43:59 +0000 (22:43 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 15 Oct 2014 21:43:59 +0000 (22:43 +0100)
commit6dc54d9124e8ef9ef3611e0ef3eefef5dcd87ee4
treec434041c016bda8498d983a64b1eea7080540121
parent36728e82bd9bb5b472eb569dc11b8f2296d5e3df
Merge remote thread listing methods

We have three methods to list the current remote thread list:

1. The qXfer:threads:read method (the preferred one nowadays), builds a
remote thread list while parsing the XML, and then after the XML
parsing is done, goes over the built list and adds threads GDB doesn't
know about yet to GDB's list.

2. If the qXfer method isn't available, we fallback to using the
qfThreadInfo/qsThreadInfo packets.  When we do this, we adds threads
to GDB's list immediately as we parse the qfThreadInfo/qsThreadInfo
packet replies.

3. And then if the previous method isn't available either, we try the
old deprecated qL packet.  This path is already looking somewhat
broken for not using remote_notice_new_inferior to add threads to
GDB's list.

This patch makes all variants work in two passes, like the qXfer
method, and then makes all variants share the code path that adds
threads to GDB's list.

Tested on x86_64 Fedora 20 with native gdbserver.

gdb/
2014-10-15  Pedro Alves  <palves@redhat.com>

* remote.c (remote_get_threadlist, remote_threadlist_iterator):
Add describing comment.  Return -1 if the qL packet is not
supported.
(struct thread_item, thread_item_t): Move higher up in
the file.  Add comments.
(struct threads_parsing_context): Move higher up in
the file, add comments, and remote to ...
(struct threads_listing_context): ... this.
(remote_newthread_step): Don't add the thread to GDB's thread
database here.  Instead push it to the thread_listing_context
list.
(remote_find_new_threads): Rename to ...
(remote_get_threads_with_ql): ... this.  Add target_ops and
targets_listing_context parameters.  Pass down context.
(start_thread): Adjust.
(clear_threads_parsing_context): Rename to ...
(clear_threads_listing_context): ... this.
(remote_get_threads_with_qxfer): New, with parts salvaged from old
remote_threads_info.
(remote_get_threads_with_qthreadinfo): Ditto.
(remote_threads_info): Reimplement.
gdb/ChangeLog
gdb/remote.c