On 2022-07-26 6:24 p.m., Keith Seitz wrote: > I've taken your patch and updated mine (now trivial): > > diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c > index 0a93ab5..95732a6 100644 > --- a/gdb/linux-nat.c > +++ b/gdb/linux-nat.c > @@ -3710,8 +3712,10 @@ enum target_xfer_status >        if (addr_bit < (sizeof (ULONGEST) * HOST_CHAR_BIT)) >         offset &= ((ULONGEST) 1 << addr_bit) - 1; >   > -      return linux_proc_xfer_memory_partial (readbuf, writebuf, > -                                            offset, len, xfered_len); > +      if (proc_mem_file_is_writable ()) > +       return linux_proc_xfer_memory_partial (readbuf, writebuf, > +                                              offset, len, xfered_len); > +      /* Fallthrough to ptrace  */ >      } >   >    return inf_ptrace_target::xfer_partial (object, annex, readbuf, writebuf, > > I've re-run this through all my testing, and all looks good. Great, thanks. > > However, I suspect you already knew that. :-) I was actually curious whether that would work (or rather fail quietly) on the older kernels! > > If/when you push your patch, and there are no further concerns, I will push mine, > with your approval. > As discussed off list, I merged both patches to master at once, to avoid "unused" warnings. I've attached both patches, as merged. In my patch, I fixed a bad usage of gdb::optional (need to emplace once before doing "*opt" ...), and removed the "static" from the written-to variable (I don't know why I added it in the first place). In your patch, I added a comment explaining why not to fallback to ptrace, in case someone changes this code in the future. > Thank you for your follow-up! np. Pedro Alves.