From a78e5979a92c7985eadad7246740f3874271303f Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 17 May 2021 09:59:14 +0200 Subject: nptl: Move __nptl_initial_report_events into ld.so/startup code The initialization of the report_events TCB field is now performed in __tls_init_tp instead of __pthread_initialize_minimal_internal (in libpthread). The events interface is difficult to test because GDB stopped using it in 2015. The td_thr_get_info change to ignore lookup issues is enough to support GDB with this change. Reviewed-by: Adhemerval Zanella --- nptl_db/db_info.c | 3 --- nptl_db/structs.def | 2 +- nptl_db/td_thr_get_info.c | 11 +++++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'nptl_db') diff --git a/nptl_db/db_info.c b/nptl_db/db_info.c index bed6ed486e..b39aebb78c 100644 --- a/nptl_db/db_info.c +++ b/nptl_db/db_info.c @@ -42,9 +42,6 @@ typedef struct rtld_global rtld_global; typedef struct dtv_slotinfo_list dtv_slotinfo_list; typedef struct dtv_slotinfo dtv_slotinfo; -/* Actually static in nptl/init.c, but we only need it for typeof. */ -extern bool __nptl_initial_report_events; - #define schedparam_sched_priority schedparam.sched_priority #define eventbuf_eventmask eventbuf.eventmask diff --git a/nptl_db/structs.def b/nptl_db/structs.def index 9173e1ab8f..275c12bc7a 100644 --- a/nptl_db/structs.def +++ b/nptl_db/structs.def @@ -80,7 +80,7 @@ DB_FUNCTION (__nptl_death_event) DB_SYMBOL (__nptl_threads_events) DB_MAIN_VARIABLE (__nptl_nthreads) DB_VARIABLE (__nptl_last_event) -DB_VARIABLE (__nptl_initial_report_events) +DB_RTLD_VARIABLE (__nptl_initial_report_events) DB_MAIN_ARRAY_VARIABLE (__pthread_keys) DB_STRUCT (pthread_key_struct) diff --git a/nptl_db/td_thr_get_info.c b/nptl_db/td_thr_get_info.c index 002a22a5be..01af021d2a 100644 --- a/nptl_db/td_thr_get_info.c +++ b/nptl_db/td_thr_get_info.c @@ -41,8 +41,15 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop) schedpolicy = SCHED_OTHER; schedprio = 0; tid = 0; - err = DB_GET_VALUE (report_events, th->th_ta_p, - __nptl_initial_report_events, 0); + + /* Ignore errors to obtain the __nptl_initial_report_events + value because GDB no longer uses the events interface, and + other libthread_db consumers hopefully can handle different + libpthread/lds.o load orders. */ + report_events = 0; + (void) DB_GET_VALUE (report_events, th->th_ta_p, + __nptl_initial_report_events, 0); + err = TD_OK; } else { -- cgit 1.4.1