From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92390 invoked by alias); 20 Mar 2017 21:50:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 92377 invoked by uid 89); 20 Mar 2017 21:50:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Mar 2017 21:50:30 +0000 Received: by simark.ca (Postfix, from userid 33) id 841201E81B; Mon, 20 Mar 2017 17:50:29 -0400 (EDT) To: Pedro Alves Subject: Re: [PATCH 2/3] spu: Use ptid from regcache instead of inferior_ptid X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 20 Mar 2017 21:50:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: References: <20170318170801.22988-1-simon.marchi@polymtl.ca> <20170318170801.22988-2-simon.marchi@polymtl.ca> Message-ID: <201a15d1397a6dff276676786356d929@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.4 X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00351.txt.bz2 On 2017-03-20 11:54, Pedro Alves wrote: > On 03/18/2017 05:08 PM, Simon Marchi wrote: >> --- 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)); Good point. I almost made an RAII equivalent of save_inferior_ptid, but then decided against it, based on the fact that we don't want to encourage people to use it :). But a scoped_restore is a better choice in any case. I'll send an updated patch. Thanks, Simon