1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

nptl_db: Support different libpthread/ld.so load orders (bug 27744)

libthread_db is loaded once GDB encounters libpthread, and at this
point, ld.so may not have been processed by GDB yet. As a result,
_rtld_global cannot be accessed by regular means from libthread_db.
To make this work until GDB can be fixed, acess _rtld_global through
a pointer stored in libpthread.

The new test does not reproduce bug 27744 with
--disable-hardcoded-path-in-tests, but is still a valid smoke test.
With --enable-hardcoded-path-in-tests, it is necessary to avoid
add-symbol-file because this can tickle a GDB bug.

Fixes commit 1daccf403b ("nptl: Move
stack list variables into _rtld_global").

Tested-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Florian Weimer
2021-04-21 11:50:43 +02:00
parent aaa23c3507
commit a64afc2252
7 changed files with 180 additions and 11 deletions

View File

@ -33,13 +33,14 @@ td_init (void)
bool
__td_ta_rtld_global (td_thragent_t *ta)
{
if (ta->ta_addr__rtld_global == 0
&& td_mod_lookup (ta->ph, LD_SO, SYM__rtld_global,
&ta->ta_addr__rtld_global) != PS_OK)
if (ta->ta_addr__rtld_global == 0)
{
ta->ta_addr__rtld_global = (void*)-1;
return false;
psaddr_t rtldglobalp;
if (DB_GET_VALUE (rtldglobalp, ta, __nptl_rtld_global, 0) == TD_OK)
ta->ta_addr__rtld_global = rtldglobalp;
else
ta->ta_addr__rtld_global = (void *) -1;
}
else
return ta->ta_addr__rtld_global != (void*)-1;
return ta->ta_addr__rtld_global != (void *)-1;
}