From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16426 invoked by alias); 10 Oct 2011 18:23:15 -0000 Received: (qmail 16416 invoked by uid 22791); 10 Oct 2011 18:23:14 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_BJ 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; Mon, 10 Oct 2011 18:23:00 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RDKV9-0006XZ-HK from pedro_alves@mentor.com ; Mon, 10 Oct 2011 11:22:59 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 10 Oct 2011 19:22:55 +0100 From: Pedro Alves To: Doug Evans Subject: Re: [RFA] Only try to load libthread_db when we load libpthread. Date: Mon, 10 Oct 2011 18:23: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> <201110071209.18376.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201110101922.54265.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/msg00280.txt.bz2 On Monday 10 October 2011 06:01:00, Doug Evans wrote: > On Fri, Oct 7, 2011 at 4:09 AM, Pedro Alves wrote: > > Well, at least things should work the same as before, which IMO > > is good thing as it makes this change an optimization only. > > That's the intent. > > > Still breaks activating thread_db when debugging cores of > > static executables. > It turns out things work today accidentally. > At least I doubt it's by design. :-) Yeah. :-) > My previous patch didn't work because it skipped calling > check_for_thread_db when the new_objfile observer was called for > vsyscall (which incidentally is called by the inferior_created > observer for vsyscall, heh). > [Which explains why it didn't surprise me when my before-test failed, > that's a pretty unexpected way to load libthread_db.] > > How about this. This version goes back to breaking the "file right_executable" core or attach cases (with static binaries) that the previous patch fixed. :-) You need _both_ the observer, and the OBJF_MAINLINE thing. The observer handles the case of loading the static executable into gdb before loading the core or attaching to a process (gdb exec -c core), and the OBJF_MAINLINE thing handles the opposite scenario (gdb -c core; file exec). > +/* This function is called via the inferior_created observer. > + This handles the case of debugging statically linked executables. */ As mentioned before, !cores are handled by: static void linux_child_post_attach (int pid) { linux_enable_event_reporting (pid_to_ptid (pid)); check_for_thread_db (); linux_enable_tracesysgood (pid_to_ptid (pid)); } static void linux_child_post_startup_inferior (ptid_t ptid) { linux_enable_event_reporting (ptid); check_for_thread_db (); linux_enable_tracesysgood (ptid); } So this handles the case of debugging _cores_ of statically linked executables, as those don't use linux-nat.c. With this new observer, we could even remove those two check_for_thread_db calls above. > + > +static void > +thread_db_inferior_created (struct target_ops *target, int from_tty) This is okay with me with the OBJF_MAINLINE changes merged back in, and the comment mentioned above adjusted. Thanks. -- Pedro Alves