Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch/cygwin] Remove dependency on __COPY_CONTEXT_SIZE
@ 2015-03-30 10:04 Corinna Vinschen
  2015-03-31 12:34 ` Pedro Alves
  0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2015-03-30 10:04 UTC (permalink / raw)
  To: gdb-patches

[-- 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 --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-04-01 11:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-30 10:04 [patch/cygwin] Remove dependency on __COPY_CONTEXT_SIZE Corinna Vinschen
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox