On 08/22/2018 11:11 AM, Xavier Roirand wrote:
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 96f70cf..9ad4a87 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -344,8 +344,22 @@ darwin_check_new_threads (struct inferior *inf)
pti->gdb_port = new_id;
pti->msg_state = DARWIN_RUNNING;
- /* Add the new thread. */
- add_thread_with_info (ptid_t (inf->pid, 0, new_id), pti);
+ if (old_nbr == 0 && new_ix == 0)
+ {
+ /* A ptid is created when the inferior is started (see
+ fork-child.c) with lwp=tid=0.
It looks like this patch was written against an older gdb,
because fork-child.c doesn't add a thread nowadays. For GNU/Linux,
it's
inf-ptrace.c that adds the initial thread, but only after
fork_inferior returns (inf_ptrace_target::create_inferior).
But were is that equivalent code in darwin-nat.c?
/me looks.
Answer: it's nowhere. It does not exist.
So, when then shared fork-child.c was created a while ago,
the add_thread call was moved to darwin-nat.c's target_create_inferior
implementation. But, later on, Simon removed that add_thread call
with:
commit db665f427ca781d631d9e29b1bb744fb11ffcbba
Author: Simon Marchi <simon.marchi@ericsson.com>
AuthorDate: Tue Jun 27 10:55:36 2017 +0200
Commit: Simon Marchi <simon.marchi@ericsson.com>
CommitDate: Tue Jun 27 10:56:53 2017 +0200
darwin: Do not add a dummy thread
(Weird, I can't find that patch on the list's archives, even
though I received a local copy.)
It sounds to me like you need to reevaluate the patch from
scratch, because its premise is invalid.