From 6946073e784471e1fc51fffd705b0cbc4d58e730 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 8 Feb 2004 19:59:27 +0000 Subject: * localtime.cc (localtime_r): Call tzset. * Makefile.in: Make version.h/cygwin.din version check a warning since it is not foolproof. * cygheap.h (CYGHEAPSIZE): Bump size down. * cygtls.h (_threadinfo::stacklock): New element. (_threadinfo::pop): Make regparm. (_threadinfo::lock): New function. (_threadinfo::unlock): New function. * cygtls.cc (_threadinfo::push): Wait for a lock on the stack before performing the operation. (_threadinfo::pop): Move to another file. * cygwin.din: More SIGFE changes. * exceptions.cc (try_to_debug): Always display messages on console. (handle_exceptions): Unwind stack only when actually about to call sig_send. (setup_handler): Lock stack prior to performing any operations. * gendef (_sigfe): Ditto. (_sigbe): Ditto. (_threadinfo::pop): Ditto. Move here. * gen_tlsoffsets: Generate positive offsets. * tlsoffsets.h: Regenerate. --- winsup/cygwin/exceptions.cc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'winsup/cygwin/exceptions.cc') diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 4983a2ede..e90d093a2 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -361,8 +361,8 @@ try_to_debug (bool waitloop) } } - small_printf ("*** starting debugger for pid %u\n", - cygwin_pid (GetCurrentProcessId ())); + console_printf ("*** starting debugger for pid %u\n", + cygwin_pid (GetCurrentProcessId ())); BOOL dbg; dbg = CreateProcess (NULL, debugger_command, @@ -380,17 +380,18 @@ try_to_debug (bool waitloop) else { if (!waitloop) - return 1; + return dbg; SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_IDLE); while (!being_debugged ()) Sleep (0); Sleep (2000); - small_printf ("*** continuing pid %u from debugger call\n", - cygwin_pid (GetCurrentProcessId ())); } + console_printf ("*** continuing pid %u from debugger call (%d)\n", + cygwin_pid (GetCurrentProcessId ()), dbg); + SetThreadPriority (GetCurrentThread (), prio); - return 0; + return dbg; } /* Main exception handler. */ @@ -416,10 +417,6 @@ handle_exceptions (EXCEPTION_RECORD *e0, void *frame, CONTEXT *in0, void *) EXCEPTION_RECORD e = *e0; CONTEXT in = *in0; - extern DWORD ret_here[]; - RtlUnwind (frame, ret_here, e0, 0); - __asm__ volatile (".equ _ret_here,."); - siginfo_t si; /* Coerce win32 value to posix value. */ switch (e.ExceptionCode) @@ -557,6 +554,10 @@ handle_exceptions (EXCEPTION_RECORD *e0, void *frame, CONTEXT *in0, void *) signal_exit (0x80 | si.si_signo); // Flag signal + core dump } + extern DWORD ret_here[]; + RtlUnwind (frame, ret_here, e0, 0); + __asm__ volatile (".equ _ret_here,."); + si.si_addr = ebp; si.si_code = SI_KERNEL; si.si_errno = si.si_pid = si.si_uid = 0; @@ -766,12 +767,15 @@ setup_handler (int sig, void *handler, struct sigaction& siga, _threadinfo *tls) __stack_t *retaddr_on_stack = tls->stackptr - 1; if (retaddr_on_stack >= tls->stack) { + if (!tls->lock (false)) + continue; __stack_t retaddr = InterlockedExchange ((LONG *) retaddr_on_stack, 0); if (!retaddr) continue; tls->reset_exception (); tls->interrupt_setup (sig, handler, siga, retaddr); sigproc_printf ("interrupted known cygwin routine"); + tls->unlock (); interrupted = true; break; } -- cgit v1.2.3