[2/4] windows-nat: Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__

Message ID 1433352592-9728-4-git-send-email-jon.turney@dronecode.org.uk
State New, archived
Headers

Commit Message

Jon Turney June 3, 2015, 5:29 p.m. UTC
  Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__

__COPY_CONTEXT_SIZE was added to Cygwin's headers in 2006.

Versions of Cygwin which don't define __COPY_CONTEXT_SIZE are long obsolete.

Also see the thread starting at
https://sourceware.org/ml/gdb-patches/2015-03/msg00989.html for some discussion

Note that __COPY_CONTEXT_SIZE should just be sizeof(CONTEXT) (which is a
platform constant), but isn't due to historical mistakes in Cygwin headers.

gdb/ChangeLog:

2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>

	* windows-nat.c (do_windows_fetch_inferior_registers)
	(handle_output_debug_string): Replace __COPY_CONTEXT_SIZE
	conditional with __CYGWIN__.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 gdb/ChangeLog     | 6 ++++++
 gdb/windows-nat.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)
  

Comments

Joel Brobecker June 9, 2015, 6:55 p.m. UTC | #1
> Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__
> 
> __COPY_CONTEXT_SIZE was added to Cygwin's headers in 2006.
> 
> Versions of Cygwin which don't define __COPY_CONTEXT_SIZE are long obsolete.
> 
> Also see the thread starting at
> https://sourceware.org/ml/gdb-patches/2015-03/msg00989.html for some discussion
> 
> Note that __COPY_CONTEXT_SIZE should just be sizeof(CONTEXT) (which is a
> platform constant), but isn't due to historical mistakes in Cygwin headers.
> 
> gdb/ChangeLog:
> 
> 2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>
> 
> 	* windows-nat.c (do_windows_fetch_inferior_registers)
> 	(handle_output_debug_string): Replace __COPY_CONTEXT_SIZE
> 	conditional with __CYGWIN__.

FWIW, I don't mind this patch, but I don't necessarily see what
we are gaining from it. Can you explain?

Thanks,
  
Jon Turney June 10, 2015, 1:14 p.m. UTC | #2
On 09/06/2015 19:55, Joel Brobecker wrote:
>> Replace __COPY_CONTEXT_SIZE conditional with __CYGWIN__
>>
>> __COPY_CONTEXT_SIZE was added to Cygwin's headers in 2006.
>>
>> Versions of Cygwin which don't define __COPY_CONTEXT_SIZE are long obsolete.
>>
>> Also see the thread starting at
>> https://sourceware.org/ml/gdb-patches/2015-03/msg00989.html for some discussion
>>
>> Note that __COPY_CONTEXT_SIZE should just be sizeof(CONTEXT) (which is a
>> platform constant), but isn't due to historical mistakes in Cygwin headers.
>>
>> gdb/ChangeLog:
>>
>> 2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>
>>
>> 	* windows-nat.c (do_windows_fetch_inferior_registers)
>> 	(handle_output_debug_string): Replace __COPY_CONTEXT_SIZE
>> 	conditional with __CYGWIN__.
>
> FWIW, I don't mind this patch, but I don't necessarily see what
> we are gaining from it. Can you explain?

There are still some problems with Cygwin signal handling [1], which I 
hope to fix, and this is a bit of clean-up preparatory to that.

This also makes it clear that the code which uses __COPY_CONTEXT_SIZE is 
Cygwin specific.

[1] https://sourceware.org/ml/gdb-patches/2015-06/msg00180.html
  
Joel Brobecker June 12, 2015, 12:56 p.m. UTC | #3
> >>2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>
> >>
> >>	* windows-nat.c (do_windows_fetch_inferior_registers)
> >>	(handle_output_debug_string): Replace __COPY_CONTEXT_SIZE
> >>	conditional with __CYGWIN__.
> >
> >FWIW, I don't mind this patch, but I don't necessarily see what
> >we are gaining from it. Can you explain?
> 
> There are still some problems with Cygwin signal handling [1], which I hope
> to fix, and this is a bit of clean-up preparatory to that.
> 
> This also makes it clear that the code which uses __COPY_CONTEXT_SIZE is
> Cygwin specific.
> 
> [1] https://sourceware.org/ml/gdb-patches/2015-06/msg00180.html

OK, patch is approved.

Thank you,
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ee9f1df..d170f7c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@ 
 2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>
 
+	* windows-nat.c (do_windows_fetch_inferior_registers)
+	(handle_output_debug_string): Replace __COPY_CONTEXT_SIZE
+	conditional with __CYGWIN__.
+
+2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>
+
 	* windows-nat.c (handle_output_debug_string): Trim trailing '\n'
 	from OutputDebugString.
 
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index b56b916..9d2e3c2 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -432,7 +432,7 @@  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
@@ -825,7 +825,7 @@  handle_output_debug_string (struct target_waitstatus *ourstatus)
 	  warning (("%s"), s);
 	}
     }
-#ifdef __COPY_CONTEXT_SIZE
+#ifdef __CYGWIN__
   else
     {
       /* Got a cygwin signal marker.  A cygwin signal is followed by