This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] remote doesn't add the main thread if we didn't do so already
- From: Hui Zhu <teawater at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Hui Zhu <hui_zhu at mentor dot com>, gdb-patches at sourceware dot org, "Gustavo, Luis" <luis_gustavo at mentor dot com>
- Date: Tue, 26 Feb 2013 22:39:37 +0800
- Subject: Re: [PATCH] remote doesn't add the main thread if we didn't do so already
- References: <512B447F.8040309@mentor.com> <512CA5B8.2000706@redhat.com>
Hi Pedro,
On Tue, Feb 26, 2013 at 8:08 PM, Pedro Alves <palves@redhat.com> wrote:
> Hi Hui, Luis,
>
> Thanks for the patch.
>
> On 02/25/2013 11:01 AM, Hui Zhu wrote:
>> Hi,
>>
>> This is the patch to change function add_current_inferior_and_thread that doesn't add the main thread if we didn't do so already.
>>
>
> I have the mild impression I've seen this change before, but heck
> if I recall any details, and I may be wrong. Can you or Luis
> expand on the background/rationale for this change?
This patch is part of OSE support that includes some small changes and
some bigger one. So my thought is post the small one first.
Thanks,
Hui
>
> Thanks.
>
>> Thanks,
>> Hui
>>
>> 2013-02-25 Luis Machado <lgustavo@codesourcery.com>
>>
>> * remote.c (add_current_inferior_and_thread): Only add the main
>> thread if we didn't do so already.
>>
>> --- a/gdb/remote.c
>> +++ b/gdb/remote.c
>> @@ -3316,10 +3316,16 @@ add_current_inferior_and_thread (char *w
>> fake_pid_p = 1;
>> }
>>
>> - remote_add_inferior (fake_pid_p, ptid_get_pid (inferior_ptid), -1);
>> + /* Only add the main thread if we didn't do so already. Some
>> + targets don't support listing threads, so we need to handle
>> + inclusion of the main thread here. */
>> + if (!in_thread_list (inferior_ptid))
>> + {
>> + remote_add_inferior (fake_pid_p, ptid_get_pid (inferior_ptid), -1);
>>
>> - /* Add the main thread. */
>> - add_thread_silent (inferior_ptid);
>> + /* Add the main thread. */
>> + add_thread_silent (inferior_ptid);
>> + }
>> }
>>
>> static void
>