This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Only try to load libthread_db when we load libpthread.


Hi.

System libraries are typically last in the list of libraries to load,
and in a program with lots of shared libraries this results
in lots of pointless attempts to load libthread_db.

No regressions in amd64-linux,
but I can imagine it misses some cases.

2011-10-05  Doug Evans  <dje@google.com>

	* linux-thread-db.c (thread_db_new_objfile): Only try to load
	libthread_db when we load libpthread.

Index: linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.91
diff -u -p -r1.91 linux-thread-db.c
--- linux-thread-db.c	13 Sep 2011 19:27:01 -0000	1.91
+++ linux-thread-db.c	5 Oct 2011 18:16:17 -0000
@@ -1083,7 +1083,12 @@ thread_db_new_objfile (struct objfile *o
   /* This observer must always be called with inferior_ptid set
      correctly.  */
 
-  if (objfile != NULL)
+  if (objfile != NULL
+      /* Only check for thread_db if we loaded libpthread.
+	 Libpthread can be near the end of the list of shared libraries to
+	 load, and in an app of several thousand shared libraries, this can
+	 otherwise be painful.  */
+      && libpthread_name_p (objfile->name))
     check_for_thread_db ();
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]