From: Jonas Maebe <jonas.maebe@elis.ugent.be>
To: gdb-patches@sourceware.org
Subject: [patch] Set calling convention of methods
Date: Mon, 06 Apr 2009 19:51:00 -0000 [thread overview]
Message-ID: <B8DEF338-C0F0-40A5-B4B8-D24DC56BFA0E@elis.ugent.be> (raw)
[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]
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 <jonas.maebe@elis.ugent.be>
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().
[-- Attachment #2: gdb_method_calling_conventions.patch --]
[-- Type: application/octet-stream, Size: 2662 bytes --]
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;
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
next reply other threads:[~2009-04-06 19:51 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-06 19:51 Jonas Maebe [this message]
2009-04-10 17:34 ` Tom Tromey
2009-04-20 8:40 ` Jonas Maebe
2009-04-20 18:27 ` Tom Tromey
2009-04-22 17:45 ` Jonas Maebe
2009-04-22 19:22 ` Tom Tromey
2009-04-22 22:16 ` Mark Kettenis
2009-06-04 8:23 ` Jonas Maebe
2009-06-04 18:19 ` Tom Tromey
2009-06-10 20:44 ` Jonas Maebe
2009-06-18 21:45 ` Fwd: " Jonas Maebe
2009-09-30 0:02 ` Joel Brobecker
2009-09-30 11:18 ` Jonas Maebe
2009-09-30 14:54 ` Jonas Maebe
2009-09-30 15:22 ` Mark Kettenis
2009-09-30 16:25 ` Joel Brobecker
2009-10-01 9:18 ` Jonas Maebe
2009-10-01 22:04 ` Joel Brobecker
2009-10-02 9:21 ` Mark Kettenis
2009-09-30 16:10 ` Joel Brobecker
2009-09-30 17:36 ` Joel Brobecker
2009-09-30 16:47 ` Tom Tromey
2009-09-30 17:32 ` Joel Brobecker
2009-09-30 17:35 ` Tom Tromey
2009-10-01 9:21 ` Jonas Maebe
2009-11-03 9:43 ` Jonas Maebe
2009-11-03 14:19 ` Joel Brobecker
2009-07-06 20:50 ` Jonas Maebe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B8DEF338-C0F0-40A5-B4B8-D24DC56BFA0E@elis.ugent.be \
--to=jonas.maebe@elis.ugent.be \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox