From: Pedro Alves <palves@redhat.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: 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: Wed, 26 Aug 2015 18:23:00 -0000 [thread overview]
Message-ID: <55DE0417.4090309@redhat.com> (raw)
In-Reply-To: <20150826173903.3ADD439FA@oc7340732750.ibm.com>
On 08/26/2015 06:39 PM, Ulrich Weigand wrote:
> In fact, it is so broken that the test suite assumes we're not even
> on a Cell/B.E. (since it can't debug the trivial test program), and
> silently skips all Cell tests, so I didn't notice in the daily build
> reports ...
(Sounds like the testsuite could be improved to better detect this.)
>
> The reason why we're running into the abort is that the multi-arch
> debugging logic attempts to resolve a thread-local variable from
> inside the frame unwinders (which is probably not done elsewhere).
> This uncovers a code path where the above assertion is wrong:
Curious. Could you point me at this code path? I can't seem
to find it. I wonder whether can trigger this assertion
by stopping the inferior before thread_db is initialized (e.g.,
entry point), and then trying to print a tls variable? (In order
to construct a test case).
>
> In thread_db_get_thread_local_address, we have:
>
> /* If we have not discovered any threads yet, check now. */
> if (!have_threads (ptid))
> thread_db_find_new_threads_1 (ptid);
>
> Now, note that thread_db_get_thread_local_address is one of the few
> remaining routines that always uses the thread DB, even if we do
> not use thread events. However, thread_db_find_new_threads_1 now
> assumes it gets only ever called when using thread events, which
> ultimately leads to the assert.
>
> As a quick fix, the patch appended below makes it work again;
> but this may be a bit overkill since thread_db_update_thread_list
> no longer realized that we're only interested in process ptid,
> and updates all inferiors. (Maybe the to_update_thread_list
> target callback should get a ptid argument?)
>
> Any suggestions on how best to fix this?
Try doing it like gdbserver's thread_db_get_tls_address.
...
lwp = get_thread_lwp (thread);
if (!lwp->thread_known)
find_one_thread (thread->entry.id);
...
That is, here what we're really after is the td_thrhandle_t
of the current thread, in order to be able to call
td_thr_tls_get_addr. There's no need to walk thread_db's
thread list to find that for a single thread.
find_one_thread makes use of td_ta_map_lwp2thr for the
mapping we're after.
On the GDB side, the equivalent is linux-thread-db.c:thread_from_lwp.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2015-08-26 18:23 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 [this message]
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
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=55DE0417.4090309@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--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