Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch/cygwin] Remove dependency on __COPY_CONTEXT_SIZE
Date: Mon, 30 Mar 2015 10:04:00 -0000	[thread overview]
Message-ID: <20150330100454.GA8372@calimero.vinschen.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 2371 bytes --]

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 (&current_thread->context, &saved_context,
-		  __COPY_CONTEXT_SIZE);
+	  memcpy (&current_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;
 	}

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

             reply	other threads:[~2015-03-30 10:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 10:04 Corinna Vinschen [this message]
2015-03-31 12:34 ` Pedro Alves
2015-03-31 14:36   ` Corinna Vinschen
2015-03-31 14:59     ` Pedro Alves
2015-03-31 15:42       ` Corinna Vinschen
2015-03-31 16:30         ` Pedro Alves
2015-03-31 18:32           ` Corinna Vinschen
2015-04-01 10:44             ` Pedro Alves
2015-04-01 11:53               ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150330100454.GA8372@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox