This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Handle GPC specific name for main function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]