public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: Re: [PATCH] gdb: set only inferior_ptid in sparc_{fetch, store}_inferior_registers
Date: Sun, 6 Jun 2021 07:52:25 -0700	[thread overview]
Message-ID: <20210606145225.GA576970@adacore.com> (raw)
In-Reply-To: <20210531011648.3727731-1-simon.marchi@polymtl.ca>

Hi Simon,

> gdb/ChangeLog:
> 
> 	PR gdb/27899
> 	* sparc-nat.c (sparc_fetch_inferior_registers): Set
> 	inferior_ptid instead of using switch_to_thread.
> 	(sparc_store_inferior_registers): Likewise.

Thanks for the patch. This looks good to me. Were you able to run
the testsuite on the patch? If not, I could probably run it against
AdaCore's testsuite on a LEON3 baremetal target -- not as good as
the full official testsuite on a SPARC/Linux machine, but better
than nothing...

Thanks!

> 
> Change-Id: I0b6ddb3af9b11f67b10ee46a734fb82ecc6462d5
> ---
>  gdb/sparc-nat.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
> index fa3b32cee184..7f09a60420db 100644
> --- a/gdb/sparc-nat.c
> +++ b/gdb/sparc-nat.c
> @@ -170,9 +170,8 @@ sparc_fetch_inferior_registers (process_stratum_target *proc_target,
>  
>        /* Deep down, sparc_supply_rwindow reads memory, so needs the global
>  	 thread context to be set.  */
> -      thread_info *thread = find_thread_ptid (proc_target, ptid);
> -      scoped_restore_current_thread restore_thread;
> -      switch_to_thread (thread);
> +      scoped_restore restore_inferior_ptid
> +	= make_scoped_restore (&inferior_ptid, ptid);
>  
>        sparc_supply_gregset (sparc_gregmap, regcache, -1, &regs);
>        if (regnum != -1)
> @@ -219,9 +218,8 @@ sparc_store_inferior_registers (process_stratum_target *proc_target,
>  
>  	  /* Deep down, sparc_collect_rwindow writes memory, so needs the global
>  	     thread context to be set.  */
> -	  thread_info *thread = find_thread_ptid (proc_target, ptid);
> -	  scoped_restore_current_thread restore_thread;
> -	  switch_to_thread (thread);
> +	  scoped_restore restore_inferior_ptid
> +	    = make_scoped_restore (&inferior_ptid, ptid);
>  
>  	  sparc_collect_rwindow (regcache, sp, regnum);
>  	}
> -- 
> 2.31.1
> 

-- 
Joel

  reply	other threads:[~2021-06-06 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31  1:16 Simon Marchi
2021-06-06 14:52 ` Joel Brobecker [this message]
2021-06-06 15:02   ` Simon Marchi
2021-06-07 15:02     ` Simon Marchi

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=20210606145225.GA576970@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).