gdb/linux-nat: add pid parameter to linux_proc_xfer_memory_partial
authorSimon Marchi <simon.marchi@polymtl.ca>
Fri, 25 Nov 2022 21:27:15 +0000 (16:27 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 2 Dec 2022 19:46:38 +0000 (14:46 -0500)
Add a pid parameter to linux_proc_xfer_memory_partial, making the
inferior_ptid reference bubble up close to the target_ops::xfer_partial
boundary.  No behavior change expected.

Change-Id: I58171b00ee1bba1ea22efdbb5dcab8b1ab3aac4c

gdb/linux-nat.c

index 0b3c143382ba0e911bd30e9b70267655bd793dbf..17e5dce08c3de25ea53eb1ab3d2ee3e8a80a6785 100644 (file)
@@ -3667,8 +3667,9 @@ linux_nat_xfer_osdata (enum target_object object,
                       ULONGEST *xfered_len);
 
 static enum target_xfer_status
-linux_proc_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
-                               ULONGEST offset, LONGEST len, ULONGEST *xfered_len);
+linux_proc_xfer_memory_partial (int pid, gdb_byte *readbuf,
+                               const gdb_byte *writebuf, ULONGEST offset,
+                               LONGEST len, ULONGEST *xfered_len);
 
 enum target_xfer_status
 linux_nat_target::xfer_partial (enum target_object object,
@@ -3713,8 +3714,9 @@ linux_nat_target::xfer_partial (enum target_object object,
         space, while the core was trying to write to the pre-exec
         address space.  */
       if (proc_mem_file_is_writable ())
-       return linux_proc_xfer_memory_partial (readbuf, writebuf,
-                                              offset, len, xfered_len);
+       return linux_proc_xfer_memory_partial (inferior_ptid.pid (), readbuf,
+                                              writebuf, offset, len,
+                                              xfered_len);
     }
 
   return inf_ptrace_target::xfer_partial (object, annex, readbuf, writebuf,
@@ -3941,12 +3943,10 @@ linux_proc_xfer_memory_partial_fd (int fd, int pid,
    threads.  */
 
 static enum target_xfer_status
-linux_proc_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
-                               ULONGEST offset, LONGEST len,
-                               ULONGEST *xfered_len)
+linux_proc_xfer_memory_partial (int pid, gdb_byte *readbuf,
+                               const gdb_byte *writebuf, ULONGEST offset,
+                               LONGEST len, ULONGEST *xfered_len)
 {
-  int pid = inferior_ptid.pid ();
-
   auto iter = proc_mem_file_map.find (pid);
   if (iter == proc_mem_file_map.end ())
     return TARGET_XFER_EOF;