From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7884 invoked by alias); 25 Oct 2007 19:06:38 -0000 Received: (qmail 7874 invoked by uid 22791); 25 Oct 2007 19:06:37 -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; Thu, 25 Oct 2007 19:06:32 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 527F52AB635; Thu, 25 Oct 2007 15:06:30 -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 9TCe8+weEi9z; Thu, 25 Oct 2007 15:06:30 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1A0282AB638; Thu, 25 Oct 2007 15:06:30 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id AE304E7AC8; Thu, 25 Oct 2007 12:06:27 -0700 (PDT) Date: Thu, 25 Oct 2007 19:10:00 -0000 From: Joel Brobecker To: Jim Blandy Cc: Carlos Eduardo Seo , gdb-patches@sourceware.org Subject: Re: Problems while debugging fortran Message-ID: <20071025190627.GA4157@adacore.com> References: <46FAD136.5030406@linux.vnet.ibm.com> <20070926214619.GC9403@adacore.com> <471F70C0.3000206@linux.vnet.ibm.com> <20071024193336.GI11797@adacore.com> <20071024195719.GA16009@caradoc.them.org> <471FA810.6080506@linux.vnet.ibm.com> <471FBF9E.5000607@linux.vnet.ibm.com> <20071024220648.GL11797@adacore.com> <472098B2.5010605@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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: 2007-10/txt/msg00668.txt.bz2 > > + case DW_AT_calling_convention: > > + /* DWARF standard suggests to use value DW_CC_program of attribute > > + DW_AT_calling_convention to indicate the Fortran main program. > > + The following code is to check this. */ > > This comment isn't right. The Fortran main program expects to have > its arguments passed to it differently than other subroutines or > functions; that's what DW_AT_calling_convention is meant to express. > The comment should say something like: > > /* DWARF doesn't provide a way to identify a program's entry point. > However, the Fortran main program receives its arguments via a > special calling convention; we look for that to recognize the > program's entry point. */ I agree with Jim's comment, but on the other hand, I propose a slightly different way of saying this: /* In Fortran programs compiled with XLF, the only way we have found so far to identify the main procedure is by using the fact that the calling convention is different from the other procedures: The DW_AT_calling_convention attribute is set to DW_CC_program. This is not the intent of this attribute as documented in the DWARF standard, but we haven't found any other distinctive characteristic of the main procedure, so we check the calling convention for Fortran compilation units. */ I want to steer away from the concept of "entry point", because the main is not necessarily the entry point. For instance, in Ada, the entry point is distinct from the main procedure. Is Carlos Eduado's patch OK with the comment I suggest? -- Joel