Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
To: Pedro Alves <pedro@palves.net>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH] gdbserver: handle running threads in qXfer:threads:read
Date: Wed, 22 Jul 2020 07:32:06 +0000	[thread overview]
Message-ID: <SN6PR11MB2893861027D15B70890260A3C4790@SN6PR11MB2893.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200722014324.23166-1-pedro@palves.net>

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?

> +{
> +  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.

> +
>  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 (&current_thread);
> +  scoped_restore save_current_generalte_thread

"generalte" seems like a typo.

Thanks.
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  parent reply	other threads:[~2020-07-22  7:32 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 [this message]
2020-07-22 11:36   ` 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=SN6PR11MB2893861027D15B70890260A3C4790@SN6PR11MB2893.namprd11.prod.outlook.com \
    --to=tankut.baris.aktemur@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /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