This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/3] spu: Use ptid from regcache instead of inferior_ptid


On 03/18/2017 05:08 PM, Simon Marchi wrote:
> The implementations of to_fetch_regiters/to_store_registers in the spu
> code use some functions that rely on inferior_ptid.  It's simpler for
> now to set/restore inferior_ptid.
> 
> 	* spu-linux-nat.c (spu_fetch_inferior_registers,
> 	spu_store_inferior_registers): Use ptid from regcache, set and
> 	restore inferior_ptid.
> 	* spu-multiarch.c (spu_fetch_registers, spu_store_registers):
> 	Likewise.
> ---
>  gdb/spu-linux-nat.c | 24 ++++++++++++++++++++++--
>  gdb/spu-multiarch.c | 26 ++++++++++++++++++++++++--
>  2 files changed, 46 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
> index c5b91222c1..5ec7b65ad9 100644
> --- a/gdb/spu-linux-nat.c
> +++ b/gdb/spu-linux-nat.c
> @@ -492,9 +492,17 @@ spu_fetch_inferior_registers (struct target_ops *ops,
>    int fd;
>    ULONGEST addr;
>  
> +  /* Since we use functions that rely on inferior_ptid, we need to set and
> +     restore it.  */
> +  struct cleanup *cleanup = save_inferior_ptid ();
> +  inferior_ptid = regcache_get_ptid (regcache);
> +

Use a scoped_restore for all these?  Like:

  scoped_restore save_ptid = make_scoped_restore (&inferior_ptid,
						  regcache_get_ptid (regcache));

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]