From patchwork Mon Mar 30 10:04:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corinna Vinschen X-Patchwork-Id: 5907 Received: (qmail 51575 invoked by alias); 30 Mar 2015 10:04:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 51562 invoked by uid 89); 30 Mar 2015 10:04:59 -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; Mon, 30 Mar 2015 10:04:57 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id DBCC5A80982; Mon, 30 Mar 2015 12:04:54 +0200 (CEST) Date: Mon, 30 Mar 2015 12:04:54 +0200 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: [patch/cygwin] Remove dependency on __COPY_CONTEXT_SIZE Message-ID: <20150330100454.GA8372@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, I'd like to apply the below patch. It depends on the definition of a macro in a Cygwin header which was originally introduced to allow building on Cygwin versions prior to introducing this feature. However, this macro was introduced in 2006, so the time having to rebuild on such old Cygwin versions is long gone. Above that, the definition of the macro depends on a datastructure wrongly named and residing in the wrong header. Also, __COPY_CONTEXT_SIZE is simply equivalent to sizeof(CONTEXT) anyway. Therefore I'd like to remove the dependency of GDB on this macro. Patch below. Thanks, Corinna * windows-nat.c (do_windows_fetch_inferior_registers): Drop testing and using __COPY_CONTEXT_SIZE. Just use sizeof (CONTEXT) directly instead. (handle_output_debug_string): Ditto. diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index fd31083..bc4957a 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -432,15 +432,14 @@ do_windows_fetch_inferior_registers (struct regcache *regcache, int r) if (current_thread->reload_context) { -#ifdef __COPY_CONTEXT_SIZE +#ifdef __CYGWIN__ if (have_saved_context) { /* Lie about where the program actually is stopped since cygwin has informed us that we should consider the signal to have occurred at another location which is stored in "saved_context. */ - memcpy (¤t_thread->context, &saved_context, - __COPY_CONTEXT_SIZE); + memcpy (¤t_thread->context, &saved_context, sizeof (CONTEXT)); have_saved_context = 0; } else @@ -820,7 +819,7 @@ handle_output_debug_string (struct target_waitstatus *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_waitstatus *ourstatus) else if ((x = (LPCVOID) (uintptr_t) strtoull (p, NULL, 0)) && ReadProcessMemory (current_process_handle, x, &saved_context, - __COPY_CONTEXT_SIZE, &n) - && n == __COPY_CONTEXT_SIZE) + sizeof (CONTEXT), &n) + && n == sizeof (CONTEXT)) have_saved_context = 1; current_event.dwThreadId = retval; }