From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20429 invoked by alias); 5 Oct 2011 18:27:41 -0000 Received: (qmail 20351 invoked by uid 22791); 5 Oct 2011 18:27:32 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 05 Oct 2011 18:27:08 +0000 Received: from wpaz13.hot.corp.google.com (wpaz13.hot.corp.google.com [172.24.198.77]) by smtp-out.google.com with ESMTP id p95IR6kg024828 for ; Wed, 5 Oct 2011 11:27:06 -0700 Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.110.50]) by wpaz13.hot.corp.google.com with ESMTP id p95IR6QV004691 for ; Wed, 5 Oct 2011 11:27:06 -0700 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id D744E2461D1; Wed, 5 Oct 2011 11:27:05 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [RFA] Only try to load libthread_db when we load libpthread. Message-Id: <20111005182705.D744E2461D1@ruffy.mtv.corp.google.com> Date: Wed, 05 Oct 2011 18:27:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00144.txt.bz2 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 * 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 (); }