From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10999 invoked by alias); 27 Sep 2007 13:01:14 -0000 Received: (qmail 10988 invoked by uid 22791); 27 Sep 2007 13:01:12 -0000 X-Spam-Check-By: sourceware.org Received: from hera.math.uni.wroc.pl (HELO hera.math.uni.wroc.pl) (156.17.86.1) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 27 Sep 2007 13:01:08 +0000 Received: from hebisch by hera.math.uni.wroc.pl with local (Exim 3.36 #1 (Debian)) id 1Iasyr-0005T1-00; Thu, 27 Sep 2007 15:00:37 +0200 Subject: Re: [RFC-3] Handle GPC specific name for main function In-Reply-To: <000101c800dc$ab0648a0$0112d9e0$@u-strasbg.fr> To: Pierre Muller Date: Thu, 27 Sep 2007 13:01:00 -0000 CC: "'Adriaan van Os'" , gpc@gnu.de, gdb-patches@sourceware.org X-Mailer: ELM [version 2.4ME+ PL100 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: From: Waldek Hebisch 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/msg00408.txt.bz2 Pierre Muller wrote: > As stated in my other email, > the whole purpose of this patch is not to > determine if the source was compiled by GPC, > but to get the command 'start' to end up at the right > location. > This right location is either '_p_M0_main_program' or > 'pascal_main_program' > (or 'program_Foo' for very old version, that my patch will not support.) > Assuming that the main program is compiled by GPC looking for '_p_M0_main_program' or 'pascal_main_program' should work fine. However, if the main program was compiled by some other compiler the program in principle may still contain such magic symbol -- using it as start location would be wrong. In the 'demos' subdirectory of gpc tarball one can find files 'gpc_c_pas.pas', 'gpc_c_unit.pas' and 'gpc_c_c.c' -- this is a demo program showing how to make main program in C but use from it Pascal routines. In this example '_p_M0_main_program' is never called and the right location for 'start' command is C main. It is easy to create mixed mode program without fake '_p_M0_main_program', but unfortunately the demo creates fake '_p_M0_main_program'. Another possibility is program in other language (or compiled by some other Pascal compiler) which happens to contain 'pascal_main_program'. I hope that '_p_M0_main_program' is very unlikely to appear in non-GPC program, but 'pascal_main_program' is a reasonable name so it makes sense to look for confirmation that the program is GPC compiled. '_p_initialize' indicates presence of GPC runtime (so it really does not help in case of mixed mode programs). I should also mention that there was a report that 'libplot' library also contains '_p_initialize' function... I also mentioned shared libraries. Now I think that they pose no extra problem -- presumably 'start' command will go to a symbol in main executable and just ignore shared libraries. -- Waldek Hebisch hebisch@math.uni.wroc.pl