This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v5 2/5] Share parts of gdb/gdbthread.h with gdbserver
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Thu, 06 Apr 2017 22:53:26 -0400
- Subject: Re: [PATCH v5 2/5] Share parts of gdb/gdbthread.h with gdbserver
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=sergiodj at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3790380484
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3790380484
- References: <1482464361-4068-1-git-send-email-sergiodj@redhat.com> <20170330014915.4894-1-sergiodj@redhat.com> <20170330014915.4894-3-sergiodj@redhat.com> <aa25e55e-8414-e7a1-9c95-36c84b6c900d@redhat.com>
On Friday, March 31 2017, Pedro Alves wrote:
> On 03/30/2017 02:49 AM, Sergio Durigan Junior wrote:
>> +struct thread_info *
>> +add_thread_silent (ptid_t ptid)
>> +{
>> + pid_t pid = ptid_get_pid (ptid);
>> +
>> + /* Check if there is a process already. */
>> + if (find_process_pid (pid) == NULL)
>> + add_process (pid, 0);
>> +
>> + return add_thread (ptid_build (pid, pid, 0), NULL);
>
> This ptid_build here is always using the "pid" as
> lwpid. This suggests to me that "add_thread_silent" was not the
> right function entry point to share, since we're adding a hack
> to one of the implementations. Either we need a new function,
> like "add_initial_thread (pid_t pid)", or maybe we could move the
> add_thread_silent call in fork_inferior to the gdb-side, only?
OOC, could you expand on why using pid as the lwpid means that this is a
hack?
On a side note, it seems from your comment that the best alternative
would be to move the add_thread_silent call to the GDB-specific
postfork_hook, and undo the changes on gdbserver/{linux,lynx}-low.c that
add the "*_update_process" functions. This would mean that, on GDB, the
prefork_hook would always call add_thread_silent, but on gdbserver each
target would be responsible for adding the process/thread after calling
fork_inferior.
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/