From: Pedro Alves <pedro@palves.net>
To: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] gdbserver: handle running threads in qXfer:threads:read
Date: Wed, 22 Jul 2020 12:36:04 +0100 [thread overview]
Message-ID: <eab63912-0d64-98c9-2aed-afa2185f856c@palves.net> (raw)
In-Reply-To: <SN6PR11MB2893861027D15B70890260A3C4790@SN6PR11MB2893.namprd11.prod.outlook.com>
On 7/22/20 8:32 AM, Aktemur, Tankut Baris wrote:
> On Wednesday, July 22, 2020 3:43 AM, Pedro Alves wrote:
>> diff --git a/gdbserver/inferiors.cc b/gdbserver/inferiors.cc
>> index 88adb16eac2..0bdf4b761e8 100644
>> --- a/gdbserver/inferiors.cc
>> +++ b/gdbserver/inferiors.cc
>> @@ -223,6 +223,16 @@ switch_to_thread (process_stratum_target *ops, ptid_t ptid)
>> current_thread = find_thread_ptid (ptid);
>> }
>>
>> +/* See inferiors.h. */
>> +
>> +void
>> +switch_to_process (struct process_info *proc)
>
> Can we get rid of 'struct' here?
Done.
>
>> +{
>> + int pid = pid_of (proc);
>> +
>> + current_thread = find_any_thread_of_pid (pid);
>> +}
>> +
>> /* See gdbsupport/common-inferior.h. */
>>
>> const char *
>> diff --git a/gdbserver/inferiors.h b/gdbserver/inferiors.h
>> index 4e24b2c7bb2..2af0169a4e1 100644
>> --- a/gdbserver/inferiors.h
>> +++ b/gdbserver/inferiors.h
>> @@ -138,6 +138,9 @@ struct process_info *find_process_pid (int pid);
>> int have_started_inferiors_p (void);
>> int have_attached_inferiors_p (void);
>>
>> +/* Switch to a thread of PROC. */
>> +void switch_to_process (struct process_info *proc);
>
> And here.
Done.
>
>> +
>> void clear_inferiors (void);
>>
>> void *thread_target_data (struct thread_info *);
>> diff --git a/gdbserver/server.cc b/gdbserver/server.cc
>> index ab5363eb032..b1015229ad0 100644
>> --- a/gdbserver/server.cc
>> +++ b/gdbserver/server.cc
>> @@ -48,6 +48,7 @@
>> #include "gdbsupport/selftest.h"
>> #include "gdbsupport/scope-exit.h"
>> #include "gdbsupport/gdb_select.h"
>> +#include "gdbsupport/scoped_restore.h"
>>
>> #define require_running_or_return(BUF) \
>> if (!target_running ()) \
>> @@ -1678,19 +1679,54 @@ handle_qxfer_threads_worker (thread_info *thread, struct buffer
>> *buffer)
>> buffer_xml_printf (buffer, "/>\n");
>> }
>>
>> -/* Helper for handle_qxfer_threads. */
>> +/* Helper for handle_qxfer_threads. Return true on success, false
>> + otherwise. */
>>
>> -static void
>> +static bool
>> handle_qxfer_threads_proper (struct buffer *buffer)
>> {
>> + client_state &cs = get_client_state ();
>> +
>> + scoped_restore save_current_thread
>> + = make_scoped_restore (¤t_thread);
>> + scoped_restore save_current_generalte_thread
>
> "generalte" seems like a typo.
Indeed it is.
Thanks for taking a look. I've merged the patch with those
fixes now.
Pedro Alves
prev parent reply other threads:[~2020-07-22 11:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 1:43 Pedro Alves
2020-07-22 4:15 ` Kevin Buettner
2020-07-22 11:46 ` Pedro Alves
2020-07-22 7:32 ` Aktemur, Tankut Baris
2020-07-22 11:36 ` Pedro Alves [this message]
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=eab63912-0d64-98c9-2aed-afa2185f856c@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=tankut.baris.aktemur@intel.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