From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12231 invoked by alias); 1 Dec 2010 01:06:29 -0000 Received: (qmail 12221 invoked by uid 22791); 1 Dec 2010 01:06:28 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,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; Wed, 01 Dec 2010 01:06:21 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB116K4X024612 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 30 Nov 2010 20:06:20 -0500 Received: from mesquite.lan ([10.3.113.8]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB116Jow007940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 30 Nov 2010 20:06:19 -0500 Date: Wed, 01 Dec 2010 01:06:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: Jan Kratochvil Subject: Re: [RFC] Limit attempts to place breakpoints on _start, __start, and main in solib-svr4.c Message-ID: <20101130180618.66003c99@mesquite.lan> In-Reply-To: <20101130000707.GA26969@host0.dyn.jankratochvil.net> References: <20101129160233.1265d555@mesquite.lan> <20101130000707.GA26969@host0.dyn.jankratochvil.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: 2010-12/txt/msg00000.txt.bz2 On Tue, 30 Nov 2010 01:07:07 +0100 Jan Kratochvil wrote: > > -enable_break (struct svr4_info *info, int from_tty) > > +enable_break (struct svr4_info *info, int from_tty, int from_run_command) > > I haven't tried it myself but is there a reason why not to use > `struct inferior->attach_flag' instead? Hi Jan, This appeared to be a very promising suggestion. One of the things that I find unfortunate about my patch is that it touches more code than I'd like. Therefore, I was excited when you suggested the use of `attach_flag' because it'd reduce that multi-page patch that I posted to just a few lines. My testing shows that use of `! current_inferior ()->attach_flag' as the test in enable_break() works when attaching to a process started natively. I also see the correct behavior (in which a breakpoint is placed on _start, et al) when the process is started via GDB's "run" command. The case that doesn't work - and, unfortunately, it's the case that really matters to me - is connecting to a remote target via "target remote". A cursory glance at remote.c shows that `attach_flag' is set appropriately in several places, but a somewhat deeper analysis reveals that post_create_inferior() (which, for svr4 shared libs, eventually calls enable_break()) is called well in advance of the code which sets `attach_flag'. Bummer. The patch that I've posted does correctly handle the "target remote" case. (It correctly handles the native cases too.) Kevin