From: Simon Marchi <simark@simark.ca>
To: Kamil Rytarowski <n54@gmx.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v3] Add support for NetBSD threads in sparc-nat.c
Date: Tue, 17 Mar 2020 12:03:56 -0400 [thread overview]
Message-ID: <f779383b-7223-b1b5-fdc6-98d25bbeb28e@simark.ca> (raw)
In-Reply-To: <20200317151048.8728-1-n54@gmx.com>
On 2020-03-17 11:10 a.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 | 30 +++++++++++++++++++++++-------
> 1 file changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
> index dff0f521565..be99ebb6789 100644
> --- a/gdb/sparc-nat.c
> +++ b/gdb/sparc-nat.c
> @@ -78,6 +78,17 @@ typedef struct fp_status fpregset_t;
> #define PTRACE_SETFPREGS PT_SETFPREGS
> #endif
>
> +static inline int
Remove the `inline`.
> +gdb_ptrace(int request, pid_t pid, void *addr, struct regcache *regcache)
Space before parenthesis.
> +{
> +#ifdef __NetBSD__
> + /* Support for NetBSD threads. */
Could you add a bit more to this comment, for example:
/* Support for NetBSD threads: unlike most other ptrace implementations, NetBSD
requires that we pass both the pid and lwp. */
> + return ptrace (request, pid, addr, regcache->ptid ().lwp ());
> +#else
> + return ptrace (request, pid, addr, 0);
> +#endif
> +}
I think it would make more sense to just pass the whole ptid, rather than passing the regcache:
static int
gdb_ptrace (int request, ptid_t ptid, void *addr)
{
#ifdef __NetBSD__
/* Support for NetBSD threads: unlike most other ptrace implementations, NetBSD
requires that we pass both the pid and lwp. */
return ptrace (request, ptid.pid (), addr, ptid.lwp ());
#else
int pid = get_ptrace_pid (ptid);
return ptrace (request, pid, addr, 0);
#endif
}
Simon
next prev parent reply other threads:[~2020-03-17 16:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-17 9:40 [PATCH] " Kamil Rytarowski
2020-03-17 15:10 ` [PATCH v3] " Kamil Rytarowski
2020-03-17 16:03 ` Simon Marchi [this message]
2020-03-17 16:46 ` [PATCH v4] " Kamil Rytarowski
2020-03-17 16:51 ` Simon Marchi
2020-03-17 16:59 ` Simon Marchi
2020-03-17 17:07 ` Kamil Rytarowski
2020-03-17 17:10 ` Simon Marchi
2020-03-17 18:14 ` Kamil Rytarowski
2020-03-17 18:18 ` [PATCH v5] " Kamil Rytarowski
2020-03-17 19:07 ` Simon Marchi
2020-03-17 19:09 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f779383b-7223-b1b5-fdc6-98d25bbeb28e@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=n54@gmx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox