Re: Calling __stdcall functions in the inferior

Mark Kettenis
2012-10-12T09:54:09Z

> 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.

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? In that case there
are two things that will need to happen:

* You'll need to implement Windows-specific push_dummy_call and/or
push_dummy_code gdbarch methods for calling __stdcall functions.

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

If you decide to have a go at this, please create a new
i386-windows-tdep.c file to put all the Windows-specific i386 code.