From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3317 invoked by alias); 27 Sep 2007 05:52:36 -0000 Received: (qmail 3309 invoked by uid 22791); 27 Sep 2007 05:52:35 -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, 27 Sep 2007 05:52:32 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 754882AAB50; Thu, 27 Sep 2007 01:52: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 TnsaVFWygM0N; Thu, 27 Sep 2007 01:52:30 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3B5262AAB3F; Thu, 27 Sep 2007 01:52:30 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 15406E7B58; Wed, 26 Sep 2007 22:52:28 -0700 (PDT) Date: Thu, 27 Sep 2007 05:52:00 -0000 From: Joel Brobecker To: Waldek Hebisch Cc: Pierre Muller , gdb-patches@sourceware.org, gpc@gnu.de Subject: Re: [RFC] Handle GPC specific name for main function Message-ID: <20070927055228.GA3787@adacore.com> References: <003901c8004b$2f9a55d0$8ecf0170$@u-strasbg.fr> 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-09/txt/msg00396.txt.bz2 Thanks a lot for the detailed explainations. > I doubt that any simple method will work for "all versions of GPC". It doesn't have to. We can add support for as many or as few versions of GPC. > I would say that the most reliable indication that the program > is GPC compiled is if debug info indicate that language is Pascal > and there are signs that the file is gcc compiled (otherwise the file > is compiled by some other Pascal compiler). If debug info indicate > other language file is not GPC compiled. Unfortunately, we have to consider multi-language applications too. Verifying that one file is compiled with GPC is not enough to determine that the main is in Pascal. > GPC emits '_p__M0_main_program' (or 'pascal_main_program') > in the same file as 'main', and '_p__M0_main_program' is called > from 'main' -- I am not sure if gdb can check this. This is a possibility, but will only work if we have debugging info. > Let me remark that it is possible to have '_p__M0_main_program' > without having 'main'. Namely, GPC allows to compile Pascal source > like normal program, but replacing main by a differently named function. > One use of such possibility is when making shared libraries. Another > is when the main program is not a Pascal program. That's a big throwback, because it means that Pierre's patch is not correct, in particular in the context of multi-language applications. It was assuming that this symbol was only defined when the main program is in pascal. It looks like we're reaching the same conclusion as before, which is that, unless GPC gets changed to emit a specific symbol to specify that the main is in pascal, the strongest approach is to rely on DWARF data. http://www.cygwin.com/ml/gdb-patches/2005-11/msg00380.html -- Joel