Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: "Ulrich Weigand" <uweigand@de.ibm.com>
Cc: palves@redhat.com (Pedro Alves),  gdb-patches@sourceware.org
Subject: Re: Cell multi-arch broken (Re: [PATCH 2/2] GNU/Linux: Stop using libthread_db/td_ta_thr_iter)
Date: Sat, 19 Sep 2015 06:21:00 -0000	[thread overview]
Message-ID: <m3fv2bq6aq.fsf@sspiff.org> (raw)
In-Reply-To: <m34mjkexxd.fsf@sspiff.org> (Doug Evans's message of "Thu, 27 Aug	2015 23:20:46 -0700")

Doug Evans <xdje42@gmail.com> writes:
> "Ulrich Weigand" <uweigand@de.ibm.com> writes:
>> Ah, indeed that works for me.  The attached patch also fixes the
>> problem for me.
>>
>> Bye,
>> Ulrich
>>
>> Index: binutils-gdb/gdb/linux-thread-db.c
>> ===================================================================
>> --- binutils-gdb.orig/gdb/linux-thread-db.c
>> +++ binutils-gdb/gdb/linux-thread-db.c
>> @@ -1851,13 +1851,16 @@ thread_db_get_thread_local_address (stru
>>    struct thread_info *thread_info;
>>    struct target_ops *beneath;
>>  
>> -  /* If we have not discovered any threads yet, check now.  */
>> -  if (!have_threads (ptid))
>> -    thread_db_find_new_threads_1 (ptid);
>> -
>>    /* Find the matching thread.  */
>>    thread_info = find_thread_ptid (ptid);
>>  
>> +  /* We may not have discovered the thread yet.  */
>> +  if (thread_info != NULL && thread_info->priv == NULL)
>> +    {
>> +      thread_from_lwp (ptid);
>> +      thread_info = find_thread_ptid (ptid);
>> +    }
>> +
>>    if (thread_info != NULL && thread_info->priv != NULL)
>>      {
>>        td_err_e err;
>
> Hi.
>
> Just a thought.
>
> It's kinda clumsy that thread_from_lwp ends with this:
>
>   /* Fill the cache.  */
>   tp = find_thread_ptid (ptid);
>   record_thread (info, tp, ptid, &th, &ti);
>
> and then we just call find_thread_ptid again after it returns:
>
>> +      thread_from_lwp (ptid);
>> +      thread_info = find_thread_ptid (ptid);
>
> One might ask "Why doesn't thread_from_lwp just return thread_info?"
>
> From record_thread things seem to be a be more subtle.
> Even if we pass in a non-NULL TP we may still create a new one.
>
>   /* Add the thread to GDB's thread list.  If we already know about a
>      thread with this PTID, but it's marked exited, then the kernel
>      reused the tid of an old thread.  */
>   if (tp == NULL || tp->state == THREAD_EXITED)
>     tp = add_thread_with_info (ptid, priv);
>   else
>     tp->priv = priv;
>
> So it'd be helpful if record_thread also returned tp.
> Sound about right?
>
> 2015-08-27  Doug Evans  <xdje42@gmail.com>
>
> 	* linux-thread-db.c (record_thread): Return the created thread.
> 	(thread_from_lwp): Likewise.
> 	(thread_db_get_thread_local_address): Update.

Committed.


  parent reply	other threads:[~2015-09-19  6:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-08 19:11 [PATCH 0/2] GNU/Linux: Stop using libthread_db/td_ta_thr_iter Pedro Alves
2015-02-08 19:11 ` [PATCH 2/2] " Pedro Alves
2015-08-26 17:39   ` Cell multi-arch broken (Re: [PATCH 2/2] GNU/Linux: Stop using libthread_db/td_ta_thr_iter) Ulrich Weigand
2015-08-26 18:23     ` Pedro Alves
2015-08-26 19:02       ` Ulrich Weigand
2015-08-26 19:42         ` Pedro Alves
2015-08-27 17:40           ` Ulrich Weigand
2015-08-28  6:21         ` Doug Evans
2015-08-28 13:11           ` Ulrich Weigand
2015-09-08 10:31           ` Pedro Alves
2015-09-19  6:21           ` Doug Evans [this message]
2015-02-08 19:11 ` [PATCH 1/2] linux-nat.c: fix a few lin_lwp_attach_lwp issues Pedro Alves
2015-02-20 21:46 ` [PATCH 0/2] GNU/Linux: Stop using libthread_db/td_ta_thr_iter Pedro Alves

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=m3fv2bq6aq.fsf@sspiff.org \
    --to=xdje42@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=uweigand@de.ibm.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