From 40b1aa400824382ba15a2545f8124deb3516b8a8 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 30 Mar 2015 16:53:52 +0200 Subject: [PATCH] Prepare to rename/reuse struct ucontext. * cygtls.h (struct _cygtls): Convert thread_context to type CONTEXT. * exceptions.cc (_cygtls::signal_debugger): Use sizeof (CONTEXT) for size of CONTEXT copied for GDB's digestion. * include/cygwin/signal.h: Add a preliminary comment. Signed-off-by: Corinna Vinschen --- winsup/cygwin/ChangeLog | 7 ++ winsup/cygwin/cygtls.h | 4 +- winsup/cygwin/exceptions.cc | 7 +- winsup/cygwin/include/cygwin/signal.h | 6 +- winsup/cygwin/tlsoffsets.h | 104 +++++++++++++------------- winsup/cygwin/tlsoffsets64.h | 104 +++++++++++++------------- 6 files changed, 120 insertions(+), 112 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 869beeed2..505f4ce62 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2015-03-30 Corinna Vinschen + + * cygtls.h (struct _cygtls): Convert thread_context to type CONTEXT. + * exceptions.cc (_cygtls::signal_debugger): Use sizeof (CONTEXT) for + size of CONTEXT copied for GDB's digestion. + * include/cygwin/signal.h: Add a preliminary comment. + 2015-03-25 Corinna Vinschen * include/sys/termios.h: Add CMIN and CTIME. diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 91533f2a0..97e403dea 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -1,7 +1,7 @@ /* cygtls.h Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, - 2014 Red Hat, Inc. + 2014, 2015 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -191,7 +191,7 @@ public: siginfo_t *sigwait_info; HANDLE signal_arrived; bool will_wait_for_signal; - struct ucontext thread_context; + CONTEXT thread_context; DWORD thread_id; siginfo_t infodata; struct pthread *tid; diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 3af9a54da..af534574b 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1,7 +1,7 @@ /* exceptions.cc - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Red Hat, Inc. This file is part of Cygwin. @@ -1526,8 +1526,7 @@ _cygtls::signal_debugger (siginfo_t& si) #else c.Eip = retaddr (); #endif - memcpy (&thread_context, &c, (&thread_context._internal - - (unsigned char *) &thread_context)); + memcpy (&thread_context, &c, sizeof (CONTEXT)); /* Enough space for 32/64 bit addresses */ char sigmsg[2 * sizeof (_CYGWIN_SIGNAL_STRING " ffffffff ffffffffffffffff")]; __small_sprintf (sigmsg, _CYGWIN_SIGNAL_STRING " %d %y %p", si.si_signo, diff --git a/winsup/cygwin/include/cygwin/signal.h b/winsup/cygwin/include/cygwin/signal.h index 3d74c9c8d..58bbff059 100644 --- a/winsup/cygwin/include/cygwin/signal.h +++ b/winsup/cygwin/include/cygwin/signal.h @@ -1,7 +1,7 @@ /* signal.h - Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012, 2013 - Red Hat, Inc. + Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012, 2013, + 2015 Red Hat, Inc. This file is part of Cygwin. @@ -149,6 +149,8 @@ struct ucontext #endif /* !x86_64 */ +/* Needed for GDB. It only compiles in the context copy code if this + macro s defined. */ #define __COPY_CONTEXT_SIZE ((size_t) (uintptr_t) &((struct ucontext *) 0)->_internal) typedef union sigval diff --git a/winsup/cygwin/tlsoffsets.h b/winsup/cygwin/tlsoffsets.h index 572dfb7b7..a74e22f69 100644 --- a/winsup/cygwin/tlsoffsets.h +++ b/winsup/cygwin/tlsoffsets.h @@ -31,32 +31,32 @@ //; $tls::pwill_wait_for_signal = 2848; //; $tls::thread_context = -9848; //; $tls::pthread_context = 2852; -//; $tls::thread_id = -9636; -//; $tls::pthread_id = 3064; -//; $tls::infodata = -9632; -//; $tls::pinfodata = 3068; -//; $tls::tid = -9484; -//; $tls::ptid = 3216; -//; $tls::_ctinfo = -9480; -//; $tls::p_ctinfo = 3220; -//; $tls::andreas = -9476; -//; $tls::pandreas = 3224; -//; $tls::wq = -9472; -//; $tls::pwq = 3228; -//; $tls::sig = -9444; -//; $tls::psig = 3256; -//; $tls::incyg = -9440; -//; $tls::pincyg = 3260; -//; $tls::spinning = -9436; -//; $tls::pspinning = 3264; -//; $tls::stacklock = -9432; -//; $tls::pstacklock = 3268; -//; $tls::stackptr = -9428; -//; $tls::pstackptr = 3272; -//; $tls::stack = -9424; -//; $tls::pstack = 3276; -//; $tls::initialized = -8400; -//; $tls::pinitialized = 4300; +//; $tls::thread_id = -9132; +//; $tls::pthread_id = 3568; +//; $tls::infodata = -9128; +//; $tls::pinfodata = 3572; +//; $tls::tid = -8980; +//; $tls::ptid = 3720; +//; $tls::_ctinfo = -8976; +//; $tls::p_ctinfo = 3724; +//; $tls::andreas = -8972; +//; $tls::pandreas = 3728; +//; $tls::wq = -8968; +//; $tls::pwq = 3732; +//; $tls::sig = -8940; +//; $tls::psig = 3760; +//; $tls::incyg = -8936; +//; $tls::pincyg = 3764; +//; $tls::spinning = -8932; +//; $tls::pspinning = 3768; +//; $tls::stacklock = -8928; +//; $tls::pstacklock = 3772; +//; $tls::stackptr = -8924; +//; $tls::pstackptr = 3776; +//; $tls::stack = -8920; +//; $tls::pstack = 3780; +//; $tls::initialized = -7896; +//; $tls::pinitialized = 4804; //; __DATA__ #define tls_locals (-12700) @@ -89,29 +89,29 @@ #define tls_pwill_wait_for_signal (2848) #define tls_thread_context (-9848) #define tls_pthread_context (2852) -#define tls_thread_id (-9636) -#define tls_pthread_id (3064) -#define tls_infodata (-9632) -#define tls_pinfodata (3068) -#define tls_tid (-9484) -#define tls_ptid (3216) -#define tls__ctinfo (-9480) -#define tls_p_ctinfo (3220) -#define tls_andreas (-9476) -#define tls_pandreas (3224) -#define tls_wq (-9472) -#define tls_pwq (3228) -#define tls_sig (-9444) -#define tls_psig (3256) -#define tls_incyg (-9440) -#define tls_pincyg (3260) -#define tls_spinning (-9436) -#define tls_pspinning (3264) -#define tls_stacklock (-9432) -#define tls_pstacklock (3268) -#define tls_stackptr (-9428) -#define tls_pstackptr (3272) -#define tls_stack (-9424) -#define tls_pstack (3276) -#define tls_initialized (-8400) -#define tls_pinitialized (4300) +#define tls_thread_id (-9132) +#define tls_pthread_id (3568) +#define tls_infodata (-9128) +#define tls_pinfodata (3572) +#define tls_tid (-8980) +#define tls_ptid (3720) +#define tls__ctinfo (-8976) +#define tls_p_ctinfo (3724) +#define tls_andreas (-8972) +#define tls_pandreas (3728) +#define tls_wq (-8968) +#define tls_pwq (3732) +#define tls_sig (-8940) +#define tls_psig (3760) +#define tls_incyg (-8936) +#define tls_pincyg (3764) +#define tls_spinning (-8932) +#define tls_pspinning (3768) +#define tls_stacklock (-8928) +#define tls_pstacklock (3772) +#define tls_stackptr (-8924) +#define tls_pstackptr (3776) +#define tls_stack (-8920) +#define tls_pstack (3780) +#define tls_initialized (-7896) +#define tls_pinitialized (4804) diff --git a/winsup/cygwin/tlsoffsets64.h b/winsup/cygwin/tlsoffsets64.h index 991280663..e43dea7e2 100644 --- a/winsup/cygwin/tlsoffsets64.h +++ b/winsup/cygwin/tlsoffsets64.h @@ -31,32 +31,32 @@ //; $tls::pwill_wait_for_signal = 4136; //; $tls::thread_context = -8656; //; $tls::pthread_context = 4144; -//; $tls::thread_id = -7824; -//; $tls::pthread_id = 4976; -//; $tls::infodata = -7820; -//; $tls::pinfodata = 4980; -//; $tls::tid = -7672; -//; $tls::ptid = 5128; -//; $tls::_ctinfo = -7664; -//; $tls::p_ctinfo = 5136; -//; $tls::andreas = -7656; -//; $tls::pandreas = 5144; -//; $tls::wq = -7648; -//; $tls::pwq = 5152; -//; $tls::sig = -7600; -//; $tls::psig = 5200; -//; $tls::incyg = -7596; -//; $tls::pincyg = 5204; -//; $tls::spinning = -7592; -//; $tls::pspinning = 5208; -//; $tls::stacklock = -7588; -//; $tls::pstacklock = 5212; -//; $tls::stackptr = -7584; -//; $tls::pstackptr = 5216; -//; $tls::stack = -7576; -//; $tls::pstack = 5224; -//; $tls::initialized = -5528; -//; $tls::pinitialized = 7272; +//; $tls::thread_id = -7424; +//; $tls::pthread_id = 5376; +//; $tls::infodata = -7420; +//; $tls::pinfodata = 5380; +//; $tls::tid = -7272; +//; $tls::ptid = 5528; +//; $tls::_ctinfo = -7264; +//; $tls::p_ctinfo = 5536; +//; $tls::andreas = -7256; +//; $tls::pandreas = 5544; +//; $tls::wq = -7248; +//; $tls::pwq = 5552; +//; $tls::sig = -7200; +//; $tls::psig = 5600; +//; $tls::incyg = -7196; +//; $tls::pincyg = 5604; +//; $tls::spinning = -7192; +//; $tls::pspinning = 5608; +//; $tls::stacklock = -7188; +//; $tls::pstacklock = 5612; +//; $tls::stackptr = -7184; +//; $tls::pstackptr = 5616; +//; $tls::stack = -7176; +//; $tls::pstack = 5624; +//; $tls::initialized = -5128; +//; $tls::pinitialized = 7672; //; __DATA__ #define tls_locals (-12800) @@ -89,29 +89,29 @@ #define tls_pwill_wait_for_signal (4136) #define tls_thread_context (-8656) #define tls_pthread_context (4144) -#define tls_thread_id (-7824) -#define tls_pthread_id (4976) -#define tls_infodata (-7820) -#define tls_pinfodata (4980) -#define tls_tid (-7672) -#define tls_ptid (5128) -#define tls__ctinfo (-7664) -#define tls_p_ctinfo (5136) -#define tls_andreas (-7656) -#define tls_pandreas (5144) -#define tls_wq (-7648) -#define tls_pwq (5152) -#define tls_sig (-7600) -#define tls_psig (5200) -#define tls_incyg (-7596) -#define tls_pincyg (5204) -#define tls_spinning (-7592) -#define tls_pspinning (5208) -#define tls_stacklock (-7588) -#define tls_pstacklock (5212) -#define tls_stackptr (-7584) -#define tls_pstackptr (5216) -#define tls_stack (-7576) -#define tls_pstack (5224) -#define tls_initialized (-5528) -#define tls_pinitialized (7272) +#define tls_thread_id (-7424) +#define tls_pthread_id (5376) +#define tls_infodata (-7420) +#define tls_pinfodata (5380) +#define tls_tid (-7272) +#define tls_ptid (5528) +#define tls__ctinfo (-7264) +#define tls_p_ctinfo (5536) +#define tls_andreas (-7256) +#define tls_pandreas (5544) +#define tls_wq (-7248) +#define tls_pwq (5552) +#define tls_sig (-7200) +#define tls_psig (5600) +#define tls_incyg (-7196) +#define tls_pincyg (5604) +#define tls_spinning (-7192) +#define tls_pspinning (5608) +#define tls_stacklock (-7188) +#define tls_pstacklock (5612) +#define tls_stackptr (-7184) +#define tls_pstackptr (5616) +#define tls_stack (-7176) +#define tls_pstack (5624) +#define tls_initialized (-5128) +#define tls_pinitialized (7672)