Re: Calling __stdcall functions in the inferior

Eli Zaretskii
2012-10-12T10:42:50Z

> Date: Fri, 12 Oct 2012 11:53:52 +0200 (CEST)
> From: Mark Kettenis <mark.kettenis@xs4all.nl>
> CC: gdb@sourceware.org
>
> > Date: Fri, 12 Oct 2012 08:50:02 +0200
> > From: Eli Zaretskii <eliz@gnu.org>
> >
> > Is there a way to call __stdcall functions in the inferior from GDB,
> > while debugging a C program? The case in point is GetLastError, but
> > any other function from the Windows API has this problem.
>
> Probably not. We only implement the System V and Darwin calling
> conventions for i386.

But we also support Pascal, AFAIK, which uses this convention: the
callee pops the stack. The only difference is that the arguments are
pushed right to left, unlike with Pascal. So I thought we already had
this somewhere...

> I'm not familliar with the Windows world (and don't really have a
> desire to become familliar). But I assume "normal" (non-__stdcall)
> functions use the System V calling conventions?

Yes, it's the normal cdecl calling convention.

> * You'll need to figure out a way to distinguish __stdcall functions
> from "normal" functions.

Does someone know where GCC stashes this info? "ptype" doesn't reveal
this detail, AFAICS.

Thanks.