From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65551 invoked by alias); 31 Mar 2015 14:36:47 -0000 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 Received: (qmail 65475 invoked by uid 89); 31 Mar 2015 14:36:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Mar 2015 14:36:45 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 23380A80A3F; Tue, 31 Mar 2015 16:36:43 +0200 (CEST) Date: Tue, 31 Mar 2015 14:36:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: Re: [patch/cygwin] Remove dependency on __COPY_CONTEXT_SIZE Message-ID: <20150331143643.GA10846@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org References: <20150330100454.GA8372@calimero.vinschen.de> <551A9443.5010907@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ReaqsoxgOBHFXBhH" Content-Disposition: inline In-Reply-To: <551A9443.5010907@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg01045.txt.bz2 --ReaqsoxgOBHFXBhH Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2118 On Mar 31 13:34, Pedro Alves wrote: > On 03/30/2015 11:04 AM, Corinna Vinschen wrote: >=20 > > @@ -820,7 +819,7 @@ handle_output_debug_string (struct target_waitstatu= s *ourstatus) > > #endif > > warning (("%s"), s); > > } > > -#ifdef __COPY_CONTEXT_SIZE > > +#ifdef __CYGWIN__ > > else > > { > > /* Got a cygwin signal marker. A cygwin signal is followed by > > @@ -847,8 +846,8 @@ handle_output_debug_string (struct target_waitstatu= s *ourstatus) > > else if ((x =3D (LPCVOID) (uintptr_t) strtoull (p, NULL, 0)) > > && ReadProcessMemory (current_process_handle, x, > > &saved_context, > > - __COPY_CONTEXT_SIZE, &n) > > - && n =3D=3D __COPY_CONTEXT_SIZE) > > + sizeof (CONTEXT), &n) >=20 > Is that really wise? AFAIK, the size of the CONTEXT structure can > grow as MSFT adds more registers to support newer machines. No, that's not possible. The CONTEXT structure matches the platform. It doesn't even contain a version number. Consider that the structure is available in user space. If Microsoft changes the size on a given platform, applications built for this platform might crash due to overwritten memory. They wouldn't do that. > It seems to me that the gdb and cygwin.dll builds can disagree > on the size of that structure. No. The size is constant for the platform. If Cygwin and GDB disagree, they hgaven't been built for the same platform, or one of them is using a broken CONTEXT definition. However, if Cygwin and GDB disagree, wouldn't GDB and the Microsoft DLLs have the same problem? That's really not a problem. > Seems to me that this mechanism should > have a way to let GDB know the size of the context structure. Or maybe > read just saved_context.ContextFlags first, and infer the size from > that, reading in the most we understand? Again, the context structure is a user-space exported per-platform structure. The only party here which could change it is Microsoft, and Microsoft would never do this because it would break the ABI for existing application. Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --ReaqsoxgOBHFXBhH Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVGrD7AAoJEPU2Bp2uRE+gh3sP/0bQF31N7uuy5ecXwBfcsSeg xTH0MVeFgfP5BBOWLWNkF8y9iP8aUZC7pBFB0R7+qBxDz4wm8PdwFMZMxrbic/iK Q+Zx4TImt2WoAU4SnsLLzebKp1JzvWNT9vXrvRFudQ5hIGPZTtY6NY2Bsf4v4J18 er9cQhVk99qCfHC6iZvkEDWqg+meLrSeNVL8E3zkE1KinNFfvASpCZfdlOvcBOKX 8zNtwphzZ/ImbgZBKzVlLF+2c5FnP3ZgBYnvwHMVkm3vDaHYTrp2DFFC75aemNcn X5/o9QNZkgFnKOwa3EgBkeTjF7zvVSiFGIUYwozL5T5foepvgzFSbHUlF2lawqPo j4BWWiEsY2nwV9cZao03BVIwgmBLwfKD7cMid1kts7Agkyi/xewVNC24HiasehK7 6rLS7zjnkBdnG8KAXSyjwZEF3fimJnwt8cWCwikZTmGGUijPyZ9VQUNygr4p7/tC JCkpjL5pUxgnSf6xyd726uLoMyRkjqwpaDi+FCj7xB5mVUr3HbVgWNKz+m9EhKbI 13VCThNnX1VYMAmnHZMFqVi2tpKENc/gCgNLRVSuOqZliUOZc/v9wWwj0p+PreWN i/hTlI10ixwedttM32xgZ3hn1+XPuE82N9AiEbqQJlwhBakxnOjp+RFYtVbx12tN z9mFipHUSDSCgyJCfqaH =i+h8 -----END PGP SIGNATURE----- --ReaqsoxgOBHFXBhH--