From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31076 invoked by alias); 12 Oct 2011 07:46:47 -0000 Received: (qmail 31066 invoked by uid 22791); 12 Oct 2011 07:46:45 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp-vbr14.xs4all.nl (HELO smtp-vbr14.xs4all.nl) (194.109.24.34) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Oct 2011 07:46:31 +0000 Received: from cnoc.nl.alt001.com (oostvogels.xs4all.nl [83.163.197.192]) by smtp-vbr14.xs4all.nl (8.13.8/8.13.8) with ESMTP id p9C7kPfo021316; Wed, 12 Oct 2011 09:46:26 +0200 (CEST) (envelope-from joost@cnoc.nl) Received: from localhost (localhost.localdomain [127.0.0.1]) by cnoc.nl.alt001.com (Postfix) with ESMTP id 6EACBBF5E; Wed, 12 Oct 2011 09:46:25 +0200 (CEST) Received: from cnoc.nl.alt001.com ([127.0.0.1]) by localhost (cnoc.nl.alt001.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g8n4YrpiTw8f; Wed, 12 Oct 2011 09:46:23 +0200 (CEST) Received: from [192.168.3.116] (host116.cnoc.intern [192.168.3.116]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by cnoc.nl.alt001.com (Postfix) with ESMTPS id 39468BF0B; Wed, 12 Oct 2011 09:46:23 +0200 (CEST) Subject: Re: Patch for allowing calling pascal-methods (fpc) From: Joost van der Sluis To: Tom Tromey Cc: gdb@sourceware.org, Pierre Free Pascal Date: Wed, 12 Oct 2011 07:46:00 -0000 In-Reply-To: References: <1316548459.13994.7.camel@feddie.cnoc.lan> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Message-ID: <1318405583.25241.17.camel@feddie.cnoc.lan> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00070.txt.bz2 On Wed, 2011-10-05 at 12:14 -0600, Tom Tromey wrote: > >>>>> "Joost" == Joost van der Sluis writes: > > Joost> More digging convinced me that the actual problem is in > Joost> lookup_struct_elt_type. > > Could you explain why? Well, the comment says it should: "Given a type TYPE, lookup the type of the component of type named NAME". Now it does do that for fields, but not for the FN fields. With the result that the Pascal-parser can not handle those FN fields. (They are called FN fields, but they are in fact (virtual)-classes related fields, so they also apply to Pascal) > I am not sure that applying this patch is ok. It is generic code, so > this change may negatively affect other languages -- it is hard to be > sure without replicating your analysis. Thing is that this function is only used by the Pascal parser, and within the ada-lang.c file. So it could be useful if someone with more ada-knowledge could have a look at it. (I did have gnat installed when doing the test-runs) > Perhaps some other Pascal-specific fix would be more obviously safe. I could copy lookup_struct_elt_type under a different name to p-lang.c, and change it there. I could also create a wrapper-function in p-lang.c, that calls lookup_struct_elt_type and then does the additional search within the FN-fields. But that's very difficult (impossible?), because of the inheritance: A field has to be searched first within it's own class, and only if it's not found in it's base-classes. > Do you have copyright papers in place? If not, contact me off-list to > get started. Yes, those are in place. > Joost> Attached is a patch which makes it possible for gdb to call methods and > Joost> print the result. A testsuite-run did not show any regressions. The > Joost> patch also contains a test with an example. > > Patches should go to gdb-patches and have a ChangeLog entry. > See gdb/CONTRIBUTE. > > Joost> + if (t_method_name && (strcmp_iw (t_method_name, name) == 0)) > Joost> + { > Joost> + if (TYPE_FN_FIELDLIST_LENGTH(type, i) == 1) > Joost> + { > Joost> + return TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (type, i), 0); > Joost> + } > Joost> + else if (!(noerr)) > Joost> + error (_("Could not determine which %s has to be used."), name); > > This seems iffy for C++. I agree, but there is more in lookup_struct_elt_type that's iffy for C ++. But it's ada and Pascal only. Joost