From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15384 invoked by alias); 18 Feb 2003 08:17:29 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15311 invoked from network); 18 Feb 2003 08:17:28 -0000 Received: from unknown (HELO cerbere.u-strasbg.fr) (130.79.112.250) by 172.16.49.205 with SMTP; 18 Feb 2003 08:17:28 -0000 Received: from laocoon.ics.u-strasbg.fr (laocoon.u-strasbg.fr [130.79.112.72]) by cerbere.u-strasbg.fr (Postfix) with ESMTP id E07742C26CF; Tue, 18 Feb 2003 09:19:33 +0100 (CET) Message-Id: <5.0.2.1.2.20030218085343.03243438@ics.u-strasbg.fr> X-Sender: muller@ics.u-strasbg.fr Date: Tue, 18 Feb 2003 08:17:00 -0000 To: Daniel Jacobowitz From: Pierre Muller Subject: Re: [RFC] New file fpc-abi.c Cc: gdb-patches@sources.redhat.com In-Reply-To: <20030217173108.GA19560@nevyn.them.org> References: <5.0.2.1.2.20030217180426.02227540@ics.u-strasbg.fr> <5.0.2.1.2.20030217180426.02227540@ics.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2003-02/txt/msg00369.txt.bz2 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 >> >> * 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. 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?