This is the mail archive of the gdb-patches@sources.redhat.com 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] New file fpc-abi.c


On Tue, Feb 18, 2003 at 09:13:28AM +0100, Pierre Muller wrote:
> At 18:31 17/02/2003, Daniel Jacobowitz wrote:
> >On Mon, Feb 17, 2003 at 06:12:17PM +0100, Pierre Muller wrote:
> >>   This patch adds a new file fpc-abi.c
> >> to the gdb directory.
> >> 
> >>   The purpose of this file is rather clear:
> >> it allows to recognize Free Pascal compiled 
> >> objects and to handle ABI stuff in a more 
> >> adequate way.
> >> 
> >> Should I submit this in several RFA?
> >> 
> >> 
> >> ChangeLog entry:
> >> 
> >> 2003-02-17  Pierre Muller  <muller@ics.u-strasbg.fr>
> >> 
> >>         * fpc-abi.c: New file.
> >>         Implements Free Pascal specific ABI.
> >>         * minsyms.c (install_minimal_symbols): Recognize
> >>         Free Pascal compiled objects by the presence of
> >>         'fpc_compiled' minimal symbol.
> >>         * Makefile.in: Add fpc-abi.c compilation rules.
> >
> >A lot of this file looks like it was just copied from one of the GNU
> >C++ ABI files.  Certainly the comments are now wrong.  Is a lot of the
> >code really appropriate?  i.e. does Free Pascal have the concept of an
> >RTTI type, or virtual functions, or operator names?
> >
> >These are listed as C++ ABIs.  Adding one for Pascal feels dodgy.
> 
> 
> Free Pascal does have most of these.
> 
>  - The pascal objects are a little bit different from 
> the C++ classes, in the sense that they are basically 
> struct that can (but do not always) have a
> hidden field, that contains the address of a Virtual Method Table
> i.e. a structure that contains information about
> the virtual methods of the give object type.
> - Free Pascal also knows Delphi like classes
> which are more similar to C++ classes, in the sense
> that they are just pointers to strucutures allocated on heap
> in constructor calls.
> 
> - Run Time Type Information is also supported for 
> Free Pascal classes, but I did not yet check this part of the code,
> because I did never really use it until now.
> My idea was that these parts can still be corrected after 
> this file is in CVS.
> 
>  - operators are also supported in Free Pascal,
> but the fpc_is_operator_name is not yet correctly implemented.
> 
> I should probably add explicit comments about the
> state of the different funtions implemented in this file.
> 
> 
> The fact that several functions are the same as in gnu-v2-abi.c
> are due to the fact that, we I tried to add correct object/class 
> debugging stabs generation, I tried to generate 
> gnu-v2 compatible output.
> This explains for instance that the is_(cons/des)tructor_name 
> functions are the same.
> 
> fpc_is_vtable_name is completely Fre Pascal specific.
> The other important point is that the recognition of 
> Free Pascal compiled objects avoid to treat them as gnu-v3 
> files, which can be the case with current head CVS GDB if they are linked together with
> C files that use this ABI.
> Indeed, the gnu-v3 code leads to crashes inside the GDB
> code itself when trying to get class informations.

Great, I recall you mentioning that v3 and FPC code can be linked
together.  Someday GDB will be ready for that....

> I do not claim that the fpc-abi.c is a completely correct code,
> but:
>   1) it avoids some internal GDB crashes when trying to debug executables
> that contain both FPC and GNU C v3 generated code.
>   2) It enhances the class recognition with respect to the gnu-v2
> ABI.
>   3) It is only used if the object has a fpc_compiled minimal symbol,
> which should be enough to avoid any interference with other compiler, no?

Could you remove or stub out the implementations which are incorrect
for FPC and repost it, please?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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