This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch]: Replace stryoul call to fetch address


On 02/27/2013 04:44 PM, Corinna Vinschen wrote:
> Hi,

Hi,

> 
> here's a small patch which will help along building GDB on the (not
> yet finished) x86_64 Cygwin.
> 
> Mostly these are just a few casts, and tweaks to the printf format
> strings, so that the argument and the format matches all three cases:
> 
> - i686
> - x86_64 LLP (Mingw, native Windows)
> - x86_64 LP  (Cygwin)
> 
> The most important part of the patch is in handle_output_debug_string,
> though.  The address for the context information is read from the string
> using the strtoul function.  This works fine for a 32 bit GDB, and it
> also works fine for a 64 bit Cygwin GDB.  It does not work for a 64 bit
> Mingw GDB debugging a 64 bit Cygwin application, though.  Therefore I
> replaced the strtoul with a call to string_to_core_addr.

IIRC, the matching Cygwin code that that special
Cygwin signals handling was never implemented, or it was disabled
on Cygwin, or some such, and that gdb bits is actually causing
trouble -- see http://sourceware.org/ml/gdb-patches/2013-02/msg00122.html.
We should just zap it all.

> Apart from that there's more required to get GDB working on Cygwin,
> apparently, but I thought the below patch is simple enough to go in
> already.

One thing that comes to mind is I think we'll need to have separate
mingw64/cygwin64 osabis.  Currently, mingw 32/64 use
GDB_OSABI_CYGWIN, and that limps along, but with LP vs LLP, that
won't work.  We'll need a way to distinguish Cygwin vs native Windows
binaries.  Probably by checking for cygwin.dll in the dll import list?

Another point where that'd be good is in step-over-longjmp support
(gdbarch_get_longjmp_target).  IIRC, the offset of PC within
the jmpbuf of msvcrt.dll is not the same as Cygwin's (32-bit;
dunno about 64-bit).

> 
> Ok to apply?

>  		    DWORD err = GetLastError ();
> -		    warning (_("SuspendThread failed. (winerr %d)"),
> +		    warning (_("SuspendThread failed. (winerr %u)"),
>  			     (int) err);

This one doesn't look right.  %d matches the cast to signed int.
I think you wanted the converse.  %u and (unsigned).

Otherwise looks fine to me.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]