* cygtls.h (_cygtls::handle_threadlist_exception): Eliminate.
(_cygtls::init_threadlist_exceptions): Ditto. * cygtls.cc (_cygtls::handle_threadlist_exception): Eliminate. (_cygtls::init_threadlist_exceptions): Ditto. (_cygtls::find_tls): Use myfault handling to deal with errors caused by nonexistent threads.
This commit is contained in:
parent
f78f85ce6d
commit
2d80b55b4e
|
@ -1,3 +1,12 @@
|
||||||
|
2008-03-01 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
* cygtls.h (_cygtls::handle_threadlist_exception): Eliminate.
|
||||||
|
(_cygtls::init_threadlist_exceptions): Ditto.
|
||||||
|
* cygtls.cc (_cygtls::handle_threadlist_exception): Eliminate.
|
||||||
|
(_cygtls::init_threadlist_exceptions): Ditto.
|
||||||
|
(_cygtls::find_tls): Use myfault handling to deal with errors caused by
|
||||||
|
nonexistent threads.
|
||||||
|
|
||||||
2008-03-01 Christopher Faylor <me+cygwin@cgf.cx>
|
2008-03-01 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
* cygtls.cc (_cygtls::init_exception_handler): Just return.
|
* cygtls.cc (_cygtls::init_exception_handler): Just return.
|
||||||
|
|
|
@ -195,23 +195,28 @@ _cygtls::push (__stack_t addr)
|
||||||
*stackptr++ = (__stack_t) addr;
|
*stackptr++ = (__stack_t) addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BAD_IX ((size_t) -1)
|
|
||||||
static size_t NO_COPY threadlist_ix = BAD_IX;
|
|
||||||
|
|
||||||
_cygtls *
|
_cygtls *
|
||||||
_cygtls::find_tls (int sig)
|
_cygtls::find_tls (int sig)
|
||||||
{
|
{
|
||||||
|
static int NO_COPY threadlist_ix;
|
||||||
|
|
||||||
debug_printf ("sig %d\n", sig);
|
debug_printf ("sig %d\n", sig);
|
||||||
sentry here (INFINITE);
|
sentry here (INFINITE);
|
||||||
__asm__ volatile (".equ _threadlist_exception_return,.");
|
|
||||||
_cygtls *res = NULL;
|
_cygtls *res = NULL;
|
||||||
for (threadlist_ix = 0; threadlist_ix < nthreads; threadlist_ix++)
|
threadlist_ix = -1;
|
||||||
|
|
||||||
|
myfault efault;
|
||||||
|
if (efault.faulted ())
|
||||||
|
cygheap->threadlist[threadlist_ix]->remove (INFINITE);
|
||||||
|
|
||||||
|
while (++threadlist_ix < (int) nthreads)
|
||||||
if (sigismember (&(cygheap->threadlist[threadlist_ix]->sigwait_mask), sig))
|
if (sigismember (&(cygheap->threadlist[threadlist_ix]->sigwait_mask), sig))
|
||||||
{
|
{
|
||||||
res = cygheap->threadlist[threadlist_ix];
|
res = cygheap->threadlist[threadlist_ix];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
threadlist_ix = BAD_IX;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,35 +226,6 @@ _cygtls::set_siginfo (sigpacket *pack)
|
||||||
infodata = pack->si;
|
infodata = pack->si;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" DWORD __stdcall RtlUnwind (void *, void *, void *, DWORD) __attribute__ ((noreturn));
|
|
||||||
int
|
|
||||||
_cygtls::handle_threadlist_exception (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *c, void *)
|
|
||||||
{
|
|
||||||
if (e->ExceptionCode != STATUS_ACCESS_VIOLATION)
|
|
||||||
{
|
|
||||||
system_printf ("unhandled exception %p at %p", e->ExceptionCode, c->Eip);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sentry here;
|
|
||||||
if (threadlist_ix == BAD_IX)
|
|
||||||
{
|
|
||||||
api_fatal ("called with threadlist_ix %d", BAD_IX);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!here.acquired ())
|
|
||||||
{
|
|
||||||
system_printf ("couldn't aquire muto");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void *threadlist_exception_return;
|
|
||||||
cygheap->threadlist[threadlist_ix]->remove (INFINITE);
|
|
||||||
threadlist_ix = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up the exception handler for the current thread. The x86 uses segment
|
/* Set up the exception handler for the current thread. The x86 uses segment
|
||||||
register fs, offset 0 to point to the current exception handler. */
|
register fs, offset 0 to point to the current exception handler. */
|
||||||
|
|
||||||
|
@ -273,9 +249,3 @@ _cygtls::init_exception_handler (exception_handler *eh)
|
||||||
el.prev = _except_list;
|
el.prev = _except_list;
|
||||||
_except_list = ⪙
|
_except_list = ⪙
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_cygtls::init_threadlist_exceptions ()
|
|
||||||
{
|
|
||||||
init_exception_handler (handle_threadlist_exception);
|
|
||||||
}
|
|
||||||
|
|
|
@ -190,10 +190,8 @@ struct _cygtls
|
||||||
|
|
||||||
/* exception handling */
|
/* exception handling */
|
||||||
static int handle_exceptions (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void *);
|
static int handle_exceptions (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void *);
|
||||||
static int handle_threadlist_exception (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void *);
|
|
||||||
bool inside_kernel (CONTEXT *);
|
bool inside_kernel (CONTEXT *);
|
||||||
void init_exception_handler (int (*) (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void*));
|
void init_exception_handler (int (*) (EXCEPTION_RECORD *, exception_list *, CONTEXT *, void*));
|
||||||
void init_threadlist_exceptions ();
|
|
||||||
void signal_exit (int) __attribute__ ((noreturn, regparm(2)));
|
void signal_exit (int) __attribute__ ((noreturn, regparm(2)));
|
||||||
void copy_context (CONTEXT *) __attribute__ ((regparm(2)));
|
void copy_context (CONTEXT *) __attribute__ ((regparm(2)));
|
||||||
void signal_debugger (int) __attribute__ ((regparm(2)));
|
void signal_debugger (int) __attribute__ ((regparm(2)));
|
||||||
|
|
|
@ -1166,7 +1166,6 @@ wait_sig (VOID *)
|
||||||
SetEvent (wait_sig_inited);
|
SetEvent (wait_sig_inited);
|
||||||
|
|
||||||
_sig_tls = &_my_tls;
|
_sig_tls = &_my_tls;
|
||||||
_sig_tls->init_threadlist_exceptions ();
|
|
||||||
sigproc_printf ("entering ReadFile loop, my_readsig %p, my_sendsig %p",
|
sigproc_printf ("entering ReadFile loop, my_readsig %p, my_sendsig %p",
|
||||||
my_readsig, my_sendsig);
|
my_readsig, my_sendsig);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue