From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6669 invoked by alias); 1 Jun 2012 18:05:50 -0000 Received: (qmail 6559 invoked by uid 22791); 1 Jun 2012 18:05:48 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jun 2012 18:05:36 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q51I5WNl023123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 1 Jun 2012 14:05:35 -0400 Received: from host2.jankratochvil.net (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q51HMFuK014867 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 1 Jun 2012 13:22:17 -0400 Date: Fri, 01 Jun 2012 18:05:00 -0000 From: Jan Kratochvil To: Pedro Alves Cc: Joakim Tjernlund , gdb-patches@sourceware.org Subject: Re: [PATCH] solib-svr4: Avoid unwanted shlib internal BPs When debugging Linux kernel or u-boot Message-ID: <20120601172214.GA21236@host2.jankratochvil.net> References: <1338562868-22411-1-git-send-email-Joakim.Tjernlund@transmode.se> <4FC8EC08.1060609@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FC8EC08.1060609@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2012-06/txt/msg00026.txt.bz2 On Fri, 01 Jun 2012 18:21:28 +0200, Pedro Alves wrote: > --- a/gdb/solib-svr4.c > +++ b/gdb/solib-svr4.c > @@ -1707,7 +1707,7 @@ enable_break (struct svr4_info *info, int from_tty) > } > } > > - if (!current_inferior ()->attach_flag) > + if (interp_name != NULL && !current_inferior ()->attach_flag) > { > for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++) > { It has a regression in the case below. OTOH one has to strip _start to make it a regression as with _start GDB did not catch startup libraries even before. This is why I suggested to omit only "__start" and "_start" but not "main" if INTERP_NAME == NULL. But maybe so broken systems are not so common nowadays to still care about them. Regards, Jan ==> 53.C <== #include #include #include static void *lib; class C { public: C(); } c; C::C() { lib = dlopen ("./53l.so", RTLD_NOW); assert(lib); puts("opened"); } int main () { void (*fp)(void)=(void (*)(void))dlsym(lib,"l"); assert(fp); fp(); } ==> 53l.C <== #include class D { public: D(); } d; D::D() { puts ("in-library before-main"); } extern "C" void l(void) { puts ("in-library after-main"); } $ ./gdb-unpatched ./53 -ex 'set breakpoint pending on' -ex 'b l' -ex run Breakpoint 1, 0x00007ffff7dfd71e in l () from ./53l.so (gdb) _ $ ./gdb-patched ./53 -ex 'set breakpoint pending on' -ex 'b l' -ex run [Inferior 1 (process 2188) exited normally] (gdb) _