From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20637 invoked by alias); 27 Feb 2013 18:39:24 -0000 Received: (qmail 18464 invoked by uid 22791); 27 Feb 2013 18:38:23 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Wed, 27 Feb 2013 18:38:08 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 0E54E520244; Wed, 27 Feb 2013 19:38:05 +0100 (CET) Date: Wed, 27 Feb 2013 18:47:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: Re: [patch]: Replace stryoul call to fetch address Message-ID: <20130227183805.GA30418@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org References: <20130227164419.GA16975@calimero.vinschen.de> <512E404E.6070504@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <512E404E.6070504@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00699.txt.bz2 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