From: John Baldwin <jhb@FreeBSD.org>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2 3/5] obsd-nat: Various fixes to obsd_nat_target::wait.
Date: Thu, 29 Jul 2021 13:11:41 -0700 [thread overview]
Message-ID: <13d25a9d-2169-5a31-952c-f5006430047a@FreeBSD.org> (raw)
In-Reply-To: <8fae24b5-9fb1-d49b-f33b-b3934a9954be@polymtl.ca>
On 7/29/21 12:11 PM, Simon Marchi wrote:
>> I don't know if it matters here, but is the pid reported by waitpid the
>> thread id, a bit like on Linux? In other words, when a thread in a
>> multi-threaded program calls fork, what id does waitpid report for the
>> parent? And depending on the answert, should we return a ptid with an
>> lwp component, instead of a pid-only ptid?
>
> I think that's done in the following patch actually, so forget about
> that.
Yes, sorry, I was just trying to fix the use of inferior_ptid in this
patch and focused more on fixing fork following in the next one.
To be clear though, the BSD's report a pid from waitpid(). Threads
on Free/Net/OpenBSD use an orthogonal namespace for thread IDs that
is separate from process IDs and there are 1 or more thread IDs
associated with each process. On FreeBSD, thread IDs start at PID_MAX + 1,
and there are a few places in FreeBSD where one can use either a thread
ID or process ID (ptrace() is one syscall for which this is true). The
kernel compares the value against PID_MAX in those cases to determine if
it is a thread (LWP) ID or process ID.
--
John Baldwin
next prev parent reply other threads:[~2021-07-29 20:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 17:41 [PATCH v2 0/5] A few fixes to OpenBSD's native target John Baldwin
2021-07-27 17:41 ` [PATCH v2 1/5] Don't compile x86 debug register support on OpenBSD John Baldwin
2021-07-27 17:41 ` [PATCH v2 2/5] x86-bsd-nat: Only define gdb_ptrace when using debug registers John Baldwin
2021-07-27 17:41 ` [PATCH v2 3/5] obsd-nat: Various fixes to obsd_nat_target::wait John Baldwin
2021-07-29 19:05 ` Simon Marchi
2021-07-29 19:11 ` Simon Marchi
2021-07-29 20:11 ` John Baldwin [this message]
2021-07-30 1:27 ` Simon Marchi
2021-07-27 17:41 ` [PATCH v2 4/5] obsd-nat: Various fixes for fork following John Baldwin
2021-07-29 19:14 ` Simon Marchi
2021-07-27 17:41 ` [PATCH v2 5/5] obsd-nat: Report both thread and PID in ::pid_to_str John Baldwin
2021-07-29 19:15 ` [PATCH v2 0/5] A few fixes to OpenBSD's native target 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=13d25a9d-2169-5a31-952c-f5006430047a@FreeBSD.org \
--to=jhb@freebsd.org \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).