This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/3] spu: Use ptid from regcache instead of inferior_ptid
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>, gdb-patches at sourceware dot org
- Date: Mon, 20 Mar 2017 15:54:49 +0000
- Subject: Re: [PATCH 2/3] spu: Use ptid from regcache instead of inferior_ptid
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 41551C04B944
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 41551C04B944
- References: <20170318170801.22988-1-simon.marchi@polymtl.ca> <20170318170801.22988-2-simon.marchi@polymtl.ca>
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