[RFC] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)

Eli Zaretskii eliz@gnu.org
Mon Oct 15 17:23:00 GMT 2012


> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Date: Mon, 15 Oct 2012 15:35:55 +0200
> 
>   After some investigation, I noticed that
> the minimal symbol GetLastError was offset by 0xf0000
> respective to the  '_imp__GetLastError@0'.
> 
>   The patch attached allowed me to call
> (gdb) call GetLastError ()
> And get a simple 
> $2 = 126
> (for instance, depending on when you do the call).

Thanks.

>   Could someone please test the patch and 
> confirm that it does fix the problem?

I will try that in a few days.

> +      if (!section_found)
> +	{
> +	  char * forward_name = (char *) (erva + func_rva);
> +	  char * funcname = (char *) (erva + name_rva);
> +          if ((func_rva >= export_rva) 
> +              && (func_rva < export_rva + export_size)) 
> +	  printf ("%s is a forward to %s\n", funcname, forward_name);

Is this printf really necessary?



More information about the Gdb-patches mailing list