From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23085 invoked by alias); 6 Apr 2009 19:51:21 -0000 Received: (qmail 23069 invoked by uid 22791); 6 Apr 2009 19:51:21 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from ugmailsa.ugent.be (HELO ugmailsa.ugent.be) (157.193.49.116) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Apr 2009 19:51:14 +0000 Received: from localhost (localhost [127.0.0.1]) by ugmailsa.ugent.be (Postfix) with ESMTP id B7AE2306826 for ; Mon, 6 Apr 2009 21:51:10 +0200 (CEST) Received: from ugmailsa.ugent.be ([127.0.0.1]) by localhost (ugmailsa.ugent.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CqESJQ4y8V1O for ; Mon, 6 Apr 2009 21:51:10 +0200 (CEST) Received: from cedar.ugent.be (cedar.ugent.be [157.193.49.14]) by ugmailsa.ugent.be (Postfix) with ESMTP id AD0743069E3 for ; Mon, 6 Apr 2009 21:51:08 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAND52Umdwc4w/2dsb2JhbADMAYQPBg Received: from mail.elis.ugent.be ([157.193.206.48]) by relays9.ugent.be with ESMTP; 06 Apr 2009 21:51:07 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.elis.UGent.be (Postfix) with ESMTP id D940B2BAD1C for ; Mon, 6 Apr 2009 21:51:00 +0200 (CEST) Received: from [127.0.0.1] (ssh2.elis.UGent.be [157.193.206.127]) by mail.elis.UGent.be (Postfix) with ESMTP id C24572BAC1D for ; Mon, 6 Apr 2009 21:51:00 +0200 (CEST) Message-Id: From: Jonas Maebe To: gdb-patches@sourceware.org Content-Type: multipart/mixed; boundary=Apple-Mail-29-894739274 Mime-Version: 1.0 (Apple Message framework v926) Subject: [patch] Set calling convention of methods Date: Mon, 06 Apr 2009 19:51:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00110.txt.bz2 --Apple-Mail-29-894739274 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Content-length: 1360 Hello, In attachment is my patch to set the calling convention for methods. Since the calling convention cannot be defined using stabs, I've hardcoded "0" there (which means that nothing changes compared to the past). Maybe that should rather be some constant? If so, where should it be defined? The patch is against the "archer" branch of Archer (not the master branch as I wrote earlier), but it applies cleanly against CVS head with only a bit of fuzz (and compiles). I have tested it in Archer in combination with an improved version of my Borland fastcall patch (which Mark Kettenis kindly offered to review) and some small changes in p-exp.y, and can successfully call both regular and virtual Free Pascal methods with it that use the Borland fastcall calling convention. Thanks, Jonas 2009-04-06 Jonas Maebe Set the type.type_specific.calling_convention field for methods. * gdbtypes.h (smash_to_method_type): Add calling_convention parameter. * gdbtypes.c (smash_to_method_type): Set method calling convention based on calling_convention parameter. * dwarf2read.c (dwarf2_add_member_fn): Pass calling convention to smash_to_method_type(). (quirk_gcc_member_function_pointer): Likewise. * stabsread.c (read_type): Pass 0 (== default) as calling convention to smash_to_method_type(). --Apple-Mail-29-894739274 Content-Disposition: attachment; filename=gdb_method_calling_conventions.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="gdb_method_calling_conventions.patch" Content-Transfer-Encoding: 7bit Content-length: 2662 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 625c416..59a6f0e 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4426,7 +4426,8 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, TYPE_TARGET_TYPE (this_type), TYPE_FIELDS (this_type), TYPE_NFIELDS (this_type), - TYPE_VARARGS (this_type)); + TYPE_VARARGS (this_type), + TYPE_CALLING_CONVENTION (this_type)); /* Handle static member functions. Dwarf2 has no clean way to discern C++ static and non-static @@ -4601,7 +4602,8 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu) type = alloc_type (objfile, NULL); smash_to_method_type (type, domain_type, TYPE_TARGET_TYPE (pfn_type), TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type), - TYPE_VARARGS (pfn_type)); + TYPE_VARARGS (pfn_type), + TYPE_CALLING_CONVENTION (pfn_type)); type = lookup_methodptr_type (type); return set_die_type (die, type, cu); } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 012485c..858d7ca 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1074,7 +1074,7 @@ smash_to_memberptr_type (struct type *type, struct type *domain, void smash_to_method_type (struct type *type, struct type *domain, struct type *to_type, struct field *args, - int nargs, int varargs) + int nargs, int varargs, unsigned calling_convention) { struct objfile *objfile; @@ -1088,6 +1088,7 @@ smash_to_method_type (struct type *type, struct type *domain, TYPE_NFIELDS (type) = nargs; if (varargs) TYPE_VARARGS (type) = 1; + TYPE_CALLING_CONVENTION (type) = calling_convention; TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */ TYPE_CODE (type) = TYPE_CODE_METHOD; } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 9ce920b..ddf4e7b 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1235,7 +1235,8 @@ extern struct type *lookup_methodptr_type (struct type *); extern void smash_to_method_type (struct type *type, struct type *domain, struct type *to_type, struct field *args, - int nargs, int varargs); + int nargs, int varargs, + unsigned calling_convention); extern void smash_to_memberptr_type (struct type *, struct type *, struct type *); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 3b8eb29..02fac7e 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1868,7 +1868,7 @@ again: return error_type (pp, objfile); type = dbx_alloc_type (typenums, objfile); smash_to_method_type (type, domain, return_type, args, - nargs, varargs); + nargs, varargs, 0); } break; --Apple-Mail-29-894739274 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1 --Apple-Mail-29-894739274--