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 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


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