* cygtls.h (_cygtls::init_exception_handler): Eliminate argument.

(_cygtls::andreas): Convert to a pointer.
(san): Convert to a real class with methods.  Use a linked list to keep track
of previous handlers on the "stack".
(myfault): Rewrite to use new san class rather than calling directly into
_cygtls.
* cygtls.cc (_cygtls::init_exception_handler): Just assume that we're always
using the standard exception handler.
(_cygtls::init_thread): Reflect loss of argument to init_exception_handler.
* dcrt0.cc (dll_crt0_1): Ditto.
* dfcn.cc (dlopen): Ditto.
(dlclose): Reset the exception handler after FreeLibrary.
* dll_init.cc (dll_list::detach): Make sure that the exception handler is
initialized before calling destructors.
* exceptions.cc (_cygtls::handle_exceptions): Accommodate new andreas pointer.
* thread.cc (verifyable_object_isvalid): Pass objectptr to faulted for explicit
NULL pointer checking.
* tlsoffsets.h: Regenerate.
This commit is contained in:
Christopher Faylor
2010-02-26 21:36:31 +00:00
parent b6336c95b4
commit d5d5bf4dd5
9 changed files with 125 additions and 89 deletions

View File

@@ -110,7 +110,7 @@ dlopen (const char *name, int)
ret = (void *) LoadLibraryW (path);
/* In case it was removed by LoadLibrary. */
_my_tls.init_exception_handler (_cygtls::handle_exceptions);
_my_tls.init_exception_handler ();
/* Restore original cxx_malloc pointer. */
__cygwin_user_data.cxx_malloc = tmp_malloc;
@@ -160,9 +160,18 @@ dlsym (void *handle, const char *name)
int
dlclose (void *handle)
{
int ret = -1;
if (handle == GetModuleHandle (NULL) || FreeLibrary ((HMODULE) handle))
int ret;
if (handle == GetModuleHandle (NULL))
ret = 0;
else
{
if (FreeLibrary ((HMODULE) handle))
ret = 0;
else
ret = -1;
/* In case it was removed by FreeLibrary */
_my_tls.init_exception_handler ();
}
if (ret)
set_dl_error ("dlclose");
return ret;