From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12143 invoked by alias); 2 Oct 2008 06:45:07 -0000 Received: (qmail 12093 invoked by uid 22791); 2 Oct 2008 06:45:07 -0000 X-Spam-Check-By: sourceware.org Received: from cust198-202.dsl.versadsl.be (HELO mail.freepascal.org) (62.166.198.202) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 02 Oct 2008 06:44:30 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.freepascal.org (Postfix) with ESMTP id B3FAFB7184; Thu, 2 Oct 2008 08:43:10 +0200 (CEST) Received: from mail.freepascal.org ([127.0.0.1]) by localhost (idefix.wisa.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XbGtDRLVJi9N; Thu, 2 Oct 2008 08:43:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.freepascal.org (Postfix) with ESMTPS id 1A529B7165; Thu, 2 Oct 2008 08:43:07 +0200 (CEST) Date: Thu, 02 Oct 2008 06:45:00 -0000 From: =?ISO-8859-15?Q?Dani=EBl_Mantione?= To: FPC Core Developer List cc: Pierre Muller , gpc@gnu.de, gdb-patches@sourceware.org Subject: Re: [Core] [RFA/DWARF2] Handle nested subprograms in CU pc bound calculation In-Reply-To: <20081001163945.GI3665@adacore.com> Message-ID: 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> <20081001163945.GI3665@adacore.com> User-Agent: Alpine 1.00 (DEB 882 2007-12-20) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="663809-920484312-1222929546=:13206" Content-ID: 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/msg00043.txt.bz2 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --663809-920484312-1222929546=:13206 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8BIT Content-ID: Content-length: 1190 Op Wed, 1 Oct 2008, schreef Joel Brobecker: > 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...) Pascal has a stack based symbol resolving (we call it the symtablestack in the compiler). For example take for example the following program: program my_program; uses unit_a,unit_b,unit_c; var a:integer; procedure main_procedure; var a:integer; procedure sub_procedure; var a:integer; begin a:=1; main_procedure.a:=1; my_program.a:=1; unit_a.a:=1; unit_b.a:=1; unit_c.a:=1; end; begin end; So each procedure context can redefine identifiers. Inside sub_procedure, the symtablestack will look like: unit_a unit_b unit_c my_program main_procedure sub_procedure When searching for a symbol, the compiler will search the symbol tables bottom to top, starting at sub_procedure, ending at unit_a, the first symbol found is used. GDB would need to implement the same behaviour in it's Pascal mode. Daniƫl --663809-920484312-1222929546=:13206--