From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26606 invoked by alias); 29 Jan 2008 17:16:51 -0000 Received: (qmail 26593 invoked by uid 22791); 29 Jan 2008 17:16:51 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Jan 2008 17:16:13 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id DC45598234; Tue, 29 Jan 2008 17:16:11 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id BC0829811F; Tue, 29 Jan 2008 17:16:11 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1JJu4A-0000yX-Sw; Tue, 29 Jan 2008 12:16:10 -0500 Date: Tue, 29 Jan 2008 17:28:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFA/dwarf] save nested Ada subprograms as global symbol Message-ID: <20080129171610.GE2815@caradoc.them.org> Mail-Followup-To: Joel Brobecker , gdb-patches@sourceware.org References: <20071227073938.GC10767@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071227073938.GC10767@adacore.com> User-Agent: Mutt/1.5.17 (2007-12-11) 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: 2008-01/txt/msg00695.txt.bz2 On Wed, Dec 26, 2007 at 11:39:38PM -0800, Joel Brobecker wrote: > The problem is trying to break on First: > > % gdb hello > (gdb) break first > Function "first" not defined. > Make breakpoint pending on future shared library load? (y or [n]) n > > What we'd like to be able to do is: > > (gdb) b first > Breakpoint 1 at 0x804954a: file hello.adb, line 6. > (gdb) run > Starting program: /home/no-backup/brobecke/ada-fsf/nested/hello > > Breakpoint 1, hello.first () at hello.adb:6 > 6 end First; > > To achieve this, we modified dwarf2read to store all Ada subprograms > in the global scope, even the ones that are not "external". Another > approach that was considered was to modify the Ada lookup routines > to extend the search to non-global/static scopes, but I'm concerned > about performance. > > In practice, even though these routines are indeed local to our > procedure in the Ada program, we want to be flexible with the user > in the debugger, and treat these procedures as global, so that the > user can break inside them without specifying the scope or having > to be in the scope where the function is defined. Sorry, I really don't like this idea. What if you have a hello.first and a goodbye.first? They're not related, so a breakpoint on "first" landing in both spots would be strange. A related example in C++ would be: namespace A { void first () { } void second () { first (); } } int main() { A::second (); } GDB will not honor "break first" when stopped in main. But in second, when the listed source line says "first ();", "break first" will work. David Carlton did a lot of work to make this happen; the hook it uses is cp_lookup_symbol_nonlocal. In practice, it seems to be the behavior users expect. -- Daniel Jacobowitz CodeSourcery