This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch]: Replace stryoul call to fetch address
On Feb 27 17:20, Pedro Alves wrote:
> 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.
I don't know exactly. Probably cgf would be able to answer this
better than me. In fact I have a SEGV right now which I still have
to investigate, but I'm working on GDB only as a side job.
> > 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.
Why not? The only difference between the x86_64 Cygwin and Mingw ABI
is the sizeof long. And that's noted in the dwarf debug info. Apart
from a strange crash when trying to load stripped executables, I'm
using a x86_64 Mingw GDB to debug x86_64 Cygwin DLL and binaries.
I'm not sure this single difference justifies distinct OSABIs.
> We'll need a way to distinguish Cygwin vs native Windows
> binaries. Probably by checking for cygwin.dll in the dll import list?
A check for cygwin1.dll is already done in windows_make_so.
> 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).
Cygwin 64 bit uses the same jmpbuf layout as native Windows. Only
two members are used differently, but those should not be used by
GDB anyway.
> > 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).
Sorry, I missed the int cast. I planned to replace that with unsigned
as well, yes.
> Otherwise looks fine to me.
Ok, I apply it then with only the int changed to unsigned.
Thanks
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat