about summary refs log tree commit diff
path: root/nptl_db
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-05-17 09:59:14 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-05-17 10:04:06 +0200
commita78e5979a92c7985eadad7246740f3874271303f (patch)
tree7f81163f014fa77b5270950f1679e4a188cdf92a /nptl_db
parentc1760eaf3b575ad174fd88b252fd16bd525fa818 (diff)
downloadglibc-a78e5979a92c7985eadad7246740f3874271303f.tar.gz
glibc-a78e5979a92c7985eadad7246740f3874271303f.tar.xz
glibc-a78e5979a92c7985eadad7246740f3874271303f.zip
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  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl_db')
-rw-r--r--nptl_db/db_info.c3
-rw-r--r--nptl_db/structs.def2
-rw-r--r--nptl_db/td_thr_get_info.c11
3 files changed, 10 insertions, 6 deletions
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
     {