[PATCH v2 4/6] Use LWP IDs with ptrace register requests on FreeBSD.

John Baldwin jhb@freebsd.org
Sat Jan 16 19:17:00 GMT 2016


On Saturday, January 16, 2016 02:39:34 PM Pedro Alves wrote:
> On 01/15/2016 11:22 PM, John Baldwin wrote:
> 
> > Ok.  I made a pass and fixed the ones that I thought were relevant (i.e.
> > generating a pid to pass to ptrace()).   However, the vast majority of the
> > files changed were various foo-linux-nat.c files which I am not setup to
> > test.  
> 
> Hmm, actually, sorry about that, but I remembered that the ptid_get_lwp()==0
> paths in Linux code are dead code (90ad5e1d4f).  I see now that d89fa914ad6f
> cleaned most of the linux code, but left out the cases that were open coded.
> 
> So I think it's best to just leave those be.  Someone can always clean
> those up to use ptid_get_lwp directly afterwards.
> 
> I now think that to move forward with your patch, it's simpler/better to
> export get_ptrace_pid, and just use it in the cases you cared about,
> and leave other targets as is.

Ok.

> If you're changing the FreeBSD to always store an lwp, do you still
> need get_ptrace_pid, or would something like this instead work?
> 
> -      if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
> +      if (ptrace (PT_GETREGS, get_ptrace_lwp (inferior_ptid),
> 
> etc.  Or would you still need it because the foo-nat.c files you're
> touching are used by other BSDs as well?

Most of them are pan-BSD so they would need the helper, but ppcfbsd-nat.c
is FreeBSD-only, so it can use ptid_get_lwp() directly.

-- 
John Baldwin



More information about the Gdb-patches mailing list