diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 5b6586122..1bbcc8095 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,21 @@ +2005-12-02 Christopher Faylor + + * include/exceptions.h (exception_list): Revert previous change. + Windows doesn't care. + (exception_handler): Use real exception_list parameter type rather than + void * + * tlsoffsets.h: Regenerate. + * cygtls.h (_cygtls::handle_exceptions): Use real exception_list + parameter type rather than void *. + (handle_threadlist_exception): Ditto. + (init_exception_handler): Ditto. + * cygtls.cc (_cygtls::handle_threadlist_exception ): Ditto. + (_cygtls::init_exception_handler): Add kludge to terminate linked list + with a loop, which seems to solve problem of RtlUnwind causing problems + * exceptions.cc (rtl_unwind): Use real exception_list parameter type + rather than void *. + (_cygtls::handle_exceptions): Ditto. + 2005-12-02 Christopher Faylor * cygtls.h (_cygtls::el): New field. diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index 1e6ff4dd0..fa755168c 100644 --- a/winsup/cygwin/cygtls.cc +++ b/winsup/cygwin/cygtls.cc @@ -240,7 +240,7 @@ _cygtls::set_siginfo (sigpacket *pack) extern "C" DWORD __stdcall RtlUnwind (void *, void *, void *, DWORD); int -_cygtls::handle_threadlist_exception (EXCEPTION_RECORD *e, void *frame, CONTEXT *c, void *) +_cygtls::handle_threadlist_exception (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *c, void *) { if (e->ExceptionCode != STATUS_ACCESS_VIOLATION) { @@ -281,6 +281,8 @@ _cygtls::init_exception_handler (exception_handler *eh) { el.handler = eh; el.prev = _except_list; + if (!el.prev->prev && !el.prev->handler) + el.prev = ⪙ _except_list = ⪙ } diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 901d58a9b..9d863df18 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -216,9 +216,9 @@ struct _cygtls __attribute__((regparm(3))); /* exception handling */ - static int handle_exceptions (EXCEPTION_RECORD *, void *, CONTEXT *, void *); - static int handle_threadlist_exception (EXCEPTION_RECORD *e, void *frame, CONTEXT *c, void *); - void init_exception_handler (int (*) (EXCEPTION_RECORD *, void *, CONTEXT *, void*)); + static int handle_exceptions (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void *); + static int handle_threadlist_exception (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *c, void *); + void init_exception_handler (int (*) (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void*)); void init_threadlist_exceptions (); #ifdef _THREAD_H diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 9851183fc..66f111ef8 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -381,9 +381,9 @@ try_to_debug (bool waitloop) } extern "C" DWORD __stdcall RtlUnwind (void *, void *, void *, DWORD); -static void __stdcall rtl_unwind (void *, PEXCEPTION_RECORD) __attribute__ ((noinline, regparm (3))); +static void __stdcall rtl_unwind (exception_list *, PEXCEPTION_RECORD) __attribute__ ((noinline, regparm (3))); void __stdcall -rtl_unwind (void *frame, PEXCEPTION_RECORD e) +rtl_unwind (exception_list *frame, PEXCEPTION_RECORD e) { __asm__ ("\n\ pushl %%ebx \n\ @@ -404,7 +404,7 @@ rtl_unwind (void *frame, PEXCEPTION_RECORD e) /* Main exception handler. */ int -_cygtls::handle_exceptions (EXCEPTION_RECORD *e, void *frame, CONTEXT *in, void *) +_cygtls::handle_exceptions (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, void *) { static bool NO_COPY debugging; static int NO_COPY recursed; @@ -509,6 +509,7 @@ _cygtls::handle_exceptions (EXCEPTION_RECORD *e, void *frame, CONTEXT *in, void } rtl_unwind (frame, e); + debug_printf ("In cygwin_except_handler exc %p at %p sp %p", e->ExceptionCode, in->Eip, in->Esp); debug_printf ("In cygwin_except_handler sig %d at %p", si.si_signo, in->Eip); diff --git a/winsup/cygwin/include/exceptions.h b/winsup/cygwin/include/exceptions.h index 5311e1f9e..39d3d8f17 100644 --- a/winsup/cygwin/include/exceptions.h +++ b/winsup/cygwin/include/exceptions.h @@ -99,14 +99,13 @@ to install your own exception filter. This one is documented. a teensy bit of detail of the innards of exception handling (i.e. what we have to do). */ -typedef int (exception_handler) - (EXCEPTION_RECORD *, void *, CONTEXT *, void *); +typedef int (exception_handler) (EXCEPTION_RECORD *, struct _exception_list *, + CONTEXT *, void *); typedef struct _exception_list { struct _exception_list *prev; exception_handler *handler; - unsigned long stuff[8]; } exception_list; #ifdef __cplusplus diff --git a/winsup/cygwin/tlsoffsets.h b/winsup/cygwin/tlsoffsets.h index 0b1d4cd94..4a00b2802 100644 --- a/winsup/cygwin/tlsoffsets.h +++ b/winsup/cygwin/tlsoffsets.h @@ -1,125 +1,125 @@ //;# autogenerated: Do not edit. -//; $tls::sizeof__cygtls = 4028; -//; $tls::func = -4028; +//; $tls::sizeof__cygtls = 3996; +//; $tls::func = -3996; //; $tls::pfunc = 0; -//; $tls::saved_errno = -4024; +//; $tls::saved_errno = -3992; //; $tls::psaved_errno = 4; -//; $tls::sa_flags = -4020; +//; $tls::sa_flags = -3988; //; $tls::psa_flags = 8; -//; $tls::oldmask = -4016; +//; $tls::oldmask = -3984; //; $tls::poldmask = 12; -//; $tls::deltamask = -4012; +//; $tls::deltamask = -3980; //; $tls::pdeltamask = 16; -//; $tls::event = -4008; +//; $tls::event = -3976; //; $tls::pevent = 20; -//; $tls::errno_addr = -4004; +//; $tls::errno_addr = -3972; //; $tls::perrno_addr = 24; -//; $tls::initialized = -4000; +//; $tls::initialized = -3968; //; $tls::pinitialized = 28; -//; $tls::sigmask = -3996; +//; $tls::sigmask = -3964; //; $tls::psigmask = 32; -//; $tls::sigwait_mask = -3992; +//; $tls::sigwait_mask = -3960; //; $tls::psigwait_mask = 36; -//; $tls::sigwait_info = -3988; +//; $tls::sigwait_info = -3956; //; $tls::psigwait_info = 40; -//; $tls::threadkill = -3984; +//; $tls::threadkill = -3952; //; $tls::pthreadkill = 44; -//; $tls::infodata = -3980; +//; $tls::infodata = -3948; //; $tls::pinfodata = 48; -//; $tls::tid = -3832; +//; $tls::tid = -3800; //; $tls::ptid = 196; -//; $tls::local_clib = -3828; +//; $tls::local_clib = -3796; //; $tls::plocal_clib = 200; -//; $tls::__dontuse = -3828; +//; $tls::__dontuse = -3796; //; $tls::p__dontuse = 200; -//; $tls::locals = -2764; +//; $tls::locals = -2732; //; $tls::plocals = 1264; -//; $tls::_ctinfo = -1132; +//; $tls::_ctinfo = -1100; //; $tls::p_ctinfo = 2896; -//; $tls::el = -1128; +//; $tls::el = -1096; //; $tls::pel = 2900; //; $tls::andreas = -1088; -//; $tls::pandreas = 2940; +//; $tls::pandreas = 2908; //; $tls::wq = -1080; -//; $tls::pwq = 2948; +//; $tls::pwq = 2916; //; $tls::prev = -1052; -//; $tls::pprev = 2976; +//; $tls::pprev = 2944; //; $tls::next = -1048; -//; $tls::pnext = 2980; +//; $tls::pnext = 2948; //; $tls::stackptr = -1044; -//; $tls::pstackptr = 2984; +//; $tls::pstackptr = 2952; //; $tls::sig = -1040; -//; $tls::psig = 2988; +//; $tls::psig = 2956; //; $tls::incyg = -1036; -//; $tls::pincyg = 2992; +//; $tls::pincyg = 2960; //; $tls::spinning = -1032; -//; $tls::pspinning = 2996; +//; $tls::pspinning = 2964; //; $tls::stacklock = -1028; -//; $tls::pstacklock = 3000; +//; $tls::pstacklock = 2968; //; $tls::stack = -1024; -//; $tls::pstack = 3004; +//; $tls::pstack = 2972; //; $tls::padding = 0; -//; $tls::ppadding = 4028; +//; $tls::ppadding = 3996; //; __DATA__ -#define tls_func (-4028) +#define tls_func (-3996) #define tls_pfunc (0) -#define tls_saved_errno (-4024) +#define tls_saved_errno (-3992) #define tls_psaved_errno (4) -#define tls_sa_flags (-4020) +#define tls_sa_flags (-3988) #define tls_psa_flags (8) -#define tls_oldmask (-4016) +#define tls_oldmask (-3984) #define tls_poldmask (12) -#define tls_deltamask (-4012) +#define tls_deltamask (-3980) #define tls_pdeltamask (16) -#define tls_event (-4008) +#define tls_event (-3976) #define tls_pevent (20) -#define tls_errno_addr (-4004) +#define tls_errno_addr (-3972) #define tls_perrno_addr (24) -#define tls_initialized (-4000) +#define tls_initialized (-3968) #define tls_pinitialized (28) -#define tls_sigmask (-3996) +#define tls_sigmask (-3964) #define tls_psigmask (32) -#define tls_sigwait_mask (-3992) +#define tls_sigwait_mask (-3960) #define tls_psigwait_mask (36) -#define tls_sigwait_info (-3988) +#define tls_sigwait_info (-3956) #define tls_psigwait_info (40) -#define tls_threadkill (-3984) +#define tls_threadkill (-3952) #define tls_pthreadkill (44) -#define tls_infodata (-3980) +#define tls_infodata (-3948) #define tls_pinfodata (48) -#define tls_tid (-3832) +#define tls_tid (-3800) #define tls_ptid (196) -#define tls_local_clib (-3828) +#define tls_local_clib (-3796) #define tls_plocal_clib (200) -#define tls___dontuse (-3828) +#define tls___dontuse (-3796) #define tls_p__dontuse (200) -#define tls_locals (-2764) +#define tls_locals (-2732) #define tls_plocals (1264) -#define tls__ctinfo (-1132) +#define tls__ctinfo (-1100) #define tls_p_ctinfo (2896) -#define tls_el (-1128) +#define tls_el (-1096) #define tls_pel (2900) #define tls_andreas (-1088) -#define tls_pandreas (2940) +#define tls_pandreas (2908) #define tls_wq (-1080) -#define tls_pwq (2948) +#define tls_pwq (2916) #define tls_prev (-1052) -#define tls_pprev (2976) +#define tls_pprev (2944) #define tls_next (-1048) -#define tls_pnext (2980) +#define tls_pnext (2948) #define tls_stackptr (-1044) -#define tls_pstackptr (2984) +#define tls_pstackptr (2952) #define tls_sig (-1040) -#define tls_psig (2988) +#define tls_psig (2956) #define tls_incyg (-1036) -#define tls_pincyg (2992) +#define tls_pincyg (2960) #define tls_spinning (-1032) -#define tls_pspinning (2996) +#define tls_pspinning (2964) #define tls_stacklock (-1028) -#define tls_pstacklock (3000) +#define tls_pstacklock (2968) #define tls_stack (-1024) -#define tls_pstack (3004) +#define tls_pstack (2972) #define tls_padding (0) -#define tls_ppadding (4028) +#define tls_ppadding (3996)