[PATCH v4] Add support for NetBSD threads in sparc-nat.c

Simon Marchi simark@simark.ca
Tue Mar 17 16:51:53 GMT 2020


On 2020-03-17 12:46 p.m., Kamil Rytarowski wrote:
> NetBSD ptrace(2) accepts thread id (LWP) as the 4th argument for threads.
> 
> This file is still shared with other targets that use different 4th argument
> type, that is always unused.
> ---
>  gdb/sparc-nat.c | 50 ++++++++++++++++++++++---------------------------
>  1 file changed, 22 insertions(+), 28 deletions(-)
> 
> diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
> index dff0f521565..10cc01375ed 100644
> --- a/gdb/sparc-nat.c
> +++ b/gdb/sparc-nat.c
> @@ -78,6 +78,19 @@ typedef struct fp_status fpregset_t;
>  #define PTRACE_SETFPREGS PT_SETFPREGS
>  #endif
> 
> +static int
> +gdb_ptrace (int request, ptid_t pid, void *addr)
> +{
> +#ifdef __NetBSD__
> +  /* Support for NetBSD threads: unlike other ptrace implementations in this
> +     file, NetBSD requires that we pass both the pid and lwp.  */
> +  return ptrace (request, ptid (). pid (), addr, ptid ().lwp ());

Does that even build?  ptid isn't the name of a parameter, and the parenthesis after
"ptid" should not be there.  Rename the pid parameter to ptid, and replace the above
with "ptid.pid ()" and "ptid.lwp ()".

Simon


More information about the Gdb-patches mailing list