This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Handle GPC specific name for main function
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Waldek Hebisch <hebisch at math dot uni dot wroc dot pl>
- Cc: Pierre Muller <muller at ics dot u-strasbg dot fr>, gdb-patches at sourceware dot org, gpc at gnu dot de
- Date: Wed, 26 Sep 2007 22:52:28 -0700
- Subject: Re: [RFC] Handle GPC specific name for main function
- References: <003901c8004b$2f9a55d0$8ecf0170$@u-strasbg.fr> <E1Iaie4-0004Wd-00@hera.math.uni.wroc.pl>
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