diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2005-05-19 22:44:13 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2005-05-19 22:44:13 +0000 |
commit | 45e3403e7bdabd845864b13f4563ed9c731a58a3 (patch) | |
tree | 1cf2d7098d54b20eace5a71502f26f22e59a4ef9 | |
parent | 89e5f7f81e84110d93e704afc35d51728486c9f7 (diff) | |
download | newlib-45e3403e7bdabd845864b13f4563ed9c731a58a3.zip newlib-45e3403e7bdabd845864b13f4563ed9c731a58a3.tar.gz newlib-45e3403e7bdabd845864b13f4563ed9c731a58a3.tar.bz2 |
* crt1.c (_gnu_exception_handler): Handle illegal instruction
OS exception as a signal if user has defined a SIGILL handler.
-rw-r--r-- | winsup/mingw/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/mingw/crt1.c | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 32a8f25..5c74d22 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,8 @@ +2005-05-20 Danny Smith <dannysmith@users.sourceforge + + * crt1.c (_gnu_exception_handler): Handle illegal instruction + OS exception as a signal if user has defined a SIGILL handler. + 2005-05-10 Danny Smith <dannysmith@users.sourceforge.net> * mingwex/math/nexttoward.c: New file. diff --git a/winsup/mingw/crt1.c b/winsup/mingw/crt1.c index 780b75e..b9b2bd5 100644 --- a/winsup/mingw/crt1.c +++ b/winsup/mingw/crt1.c @@ -124,6 +124,25 @@ _gnu_exception_handler (EXCEPTION_POINTERS * exception_data) } break; + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_PRIV_INSTRUCTION: + /* test if the user has set SIGILL */ + old_handler = signal (SIGILL, SIG_DFL); + if (old_handler == SIG_IGN) + { + /* this is undefined if the signal was raised by anything other + than raise (). */ + signal (SIGILL, SIG_IGN); + action = EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGILL); + action = EXCEPTION_CONTINUE_EXECUTION; + } + break; + case EXCEPTION_FLT_INVALID_OPERATION: case EXCEPTION_FLT_DIVIDE_BY_ZERO: case EXCEPTION_FLT_DENORMAL_OPERAND: |