Calling __stdcall functions in the inferior

Pedro Alves palves@redhat.com
Fri Oct 12 11:28:00 GMT 2012


On 10/12/2012 11:41 AM, Eli Zaretskii wrote:

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

Not sure about debug info, but the (linker) symbol has a "@number" suffix
appended.  A.k.a., "decoration".  Like "symbol@4".

In gcc/config/i386/winnt.c:

  /* Return string which is the function name, identified by ID, modified
     with a suffix consisting of an atsign (@) followed by the number of
     bytes of arguments.  If ID is NULL use the DECL_NAME as base. If
     FASTCALL is true, also add the FASTCALL_PREFIX.
     Return NULL if no change required.  */

  static tree
  gen_stdcall_or_fastcall_suffix (tree decl, tree id, bool fastcall)
  {

As you see above, fastcall also has identifiable decoration.

I don't recall the rules or conditions of when the decoration is
stripped or not anymore.

See e.g., http://stackoverflow.com/questions/8063842/mingw32-g-and-stdcall-suffix?rq=1

-- 
Pedro Alves



More information about the Gdb mailing list