From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25138 invoked by alias); 1 Oct 2008 16:40:29 -0000 Received: (qmail 25089 invoked by uid 22791); 1 Oct 2008 16:40:28 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Oct 2008 16:39:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 338C92A96C8; Wed, 1 Oct 2008 12:39:49 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id zmqmTF39Sbup; Wed, 1 Oct 2008 12:39:49 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id CE9C72A961F; Wed, 1 Oct 2008 12:39:48 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id EE59AE7ACD; Wed, 1 Oct 2008 09:39:45 -0700 (PDT) Date: Wed, 01 Oct 2008 16:40:00 -0000 From: Joel Brobecker To: Pierre Muller Cc: gdb-patches@sourceware.org, gpc@gnu.de, core@freepascal.org Subject: Re: [RFA/DWARF2] Handle nested subprograms in CU pc bound calculation Message-ID: <20081001163945.GI3665@adacore.com> References: <20080930152757.GC23135@adacore.com> <002601c92313$27d06790$777136b0$@u-strasbg.fr> <20080930170648.GI3811@adacore.com> <20080930173837.GA959@caradoc.them.org> <20081001011534.GA3665@adacore.com> <003201c92399$3207f300$9617d900$@u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003201c92399$3207f300$9617d900$@u-strasbg.fr> User-Agent: Mutt/1.4.2.2i 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-10/txt/msg00019.txt.bz2 > > 2008-09-30 Joel Brobecker > > > > * dwarf2read.c (dwarf2_handle_nested_subprograms_p): New > > function. > > (add_partial_subprogram): Replace check of Ada language by call > > to dwarf2_handle_nested_subprograms_p. > > (dwarf2_get_subprogram_pc_bounds, load_partial_dies): Likewise. > > This looks fine for me! OK, I can commit this patch in a week or so to give people some time to object. We can deal with the other issues with a separate patch. > I know even less about GNU pascal compiler, but as this compiler is > base on the GNU multi-language compiler, I would except it to behave > closer to GNU C++ or GNU Ada. Seems reasonable. > I must confess that I don't even know if the full specification > would work for pascal in case the same name is used globally and as > a nested procedure (I do know that you are allowed > to reuse a name defined globally as a local procedure, function or variable > inside a function, but I don't know if the > (gdb) break GlobalFuntion.LocalFunction would work) I think we need to answer that question first before we go and start spending the CPU time to scan for nested subprograms. Homonyms can happen in the case you suggested, or in the case when two nested subprograms have the same name. Right now, when there is an ambiguity, I understand that the debugger chooses one at random. Until we fix that, adding nested subprograms whose name might overshadow library-level subprograms is a bad idea in my opinion. The answer to the question above lies in the Pascal parser. But when there are homonyms, how do you specify in your program exactly which one you mean? And does GDB provide the same method for distinguishing these homonyms? (need to relearn Pascal one of these days...) -- Joel