This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/cygwin] Remove dependency on __COPY_CONTEXT_SIZE


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: pgpcyr3m4aYBH.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]