From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2125 invoked by alias); 7 Oct 2011 11:09:39 -0000 Received: (qmail 2109 invoked by uid 22791); 7 Oct 2011 11:09:38 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Oct 2011 11:09:23 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RC8Is-00006Y-CN from pedro_alves@mentor.com ; Fri, 07 Oct 2011 04:09:22 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 7 Oct 2011 12:09:20 +0100 From: Pedro Alves To: Doug Evans Subject: Re: [RFA] Only try to load libthread_db when we load libpthread. Date: Fri, 07 Oct 2011 11:09:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.1; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <20111005182705.D744E2461D1@ruffy.mtv.corp.google.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201110071209.18376.pedro@codesourcery.com> 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/msg00192.txt.bz2 On Thursday 06 October 2011 23:05:45, Doug Evans wrote: > > What would the user expect to be able to do next? > > I ask because I played with it, and things don't necessarily work, > > e.g. if wrong_executable didn't have libpthread. > > Perhaps more smarts could be added to file to make this work, or maybe > > a new command could be added to (effectively) reattach so that the > > initialization that attach does was redone (in case one is > > uncomfortable with having file do that. Though I think commands > > shouldn't try to do too much. Otherwise one could say "Why doesn't > > attach automagically redo the "file" command since if the first "file" > > wasn't done it would anyway?" Maybe attach should at least warn the > > user though). Well, at least things should work the same as before, which IMO is good thing as it makes this change an optimization only. > Blech, I forgot one bit of cleanup. > Revised patch attached. Still breaks activating thread_db when debugging cores of static executables. $ ./gdb -nx -q ./testsuite/gdb.threads/staticthreads Reading symbols from /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.threads/staticthreads...done. (gdb) start Temporary breakpoint 1 at 0x400548: file ../../../src/gdb/testsuite/gdb.threads/staticthreads.c, line 48. Starting program: /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.threads/staticthreads [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Temporary breakpoint 1, main (argc=1, argv=0x7fffffffe038) at ../../../src/gdb/testsuite/gdb.threads/staticthreads.c:48 48 { (gdb) gcore core.test Saved corefile core.test Before: $ ./gdb -nx -q ./testsuite/gdb.threads/staticthreads -c ./core.test Reading symbols from /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.threads/staticthreads...done. [New LWP 32418] [Thread debugging using libthread_db enabled] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Core was generated by `/home/pedro/gdb/baseline/build/gdb/testsuite/gdb.threads/staticthreads'. Program terminated with signal 5, Trace/breakpoint trap. #0 main (argc=1, argv=0x7fffffffe038) at ../../../src/gdb/testsuite/gdb.threads/staticthreads.c:48 48 { (gdb) After: $ ./gdb -nx -q ./testsuite/gdb.threads/staticthreads -c ./core.test Reading symbols from /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.threads/staticthreads...done. [New LWP 32418] Core was generated by `/home/pedro/gdb/baseline/build/gdb/testsuite/gdb.threads/staticthreads'. Program terminated with signal 5, Trace/breakpoint trap. #0 main (argc=1, argv=0x7fffffffe038) at ../../../src/gdb/testsuite/gdb.threads/staticthreads.c:48 48 { (gdb) Did you try this suggestion?: > I think we'll no longer activate thread_db when debugging core > files of static executables (e.g., a core of gdb.threads/staticthreads). > It works with live debugging since we call check_for_thread_db > from linux_child_post_attach/linux_child_post_startup_inferior. > Maybe moving that to an inferior_created observer in > linux-thread-db.c would work. -- Pedro Alves