Anonymous | Login | 2021-01-23 11:36 MSK | ![]() |
My View | View Issues | Change Log | Roadmap |
View Revisions: Issue #22545 | [ All Revisions ] [ Back to Issue ] | ||
Summary | 0022545: Improved exception handling | ||
Revision | 2011-11-25 14:50 by szy | ||
Description | RLN contribution. Detailed description: - Exception objects (Standard_Failure ancestors) are now defined/implemented using macros (see Standard_DefineException> in a way similar to defining handles. This enables creating user-defined exceptions without CDL. Note that as preprocessor does not allow to insert preprocessor instructions (starting with #) into macro definitions, it is impossible to define macros #<object_type>_Raise_if(). Therefore their generation is kept within CDL extractor as previously. The user does not really need to do this - he may rely on No_Exceptions macro. CPPExt_Template.edl must be copied to $WOKHOME/lib for CDL extractor to take effect. - Standard_Failure has Throw() non-virtual and ancestros does not have it anymore (implementation was the same). OSD_signal_WNT.cxx - OSD::SetSignal() now always sets signal handlers, exception handlers and structured exception (SE) translators. This > to deal correctly in case if user's code is compiled with /EHs or /EHa. UseSETranslation() are removed, as redundant. See detailed documentation in OSD_signal_WNT.cxx on OSD::SetSignal(). - very detailed documentation for OSD::Setsignal() in Doygen format is now in this file. - removed static variables that set signals only once to enable calling ::SetSignal() for other threads or even within the same thread if the user switched handlers before - mutexes are used to control multi-threading. - TODO: - Minimize signal handling by OSD_Signal.cxx to SIGSEGV and SIGFPE. On Unix it currently processes all (or almost all) signals (e.g. SIGHUP) by exiting. There is no value add to that. It's better to be done by user apps. OCC should only handle those which it can survive after, if at all it must do anything. OCC classes may or maynot be provided for convenience but should not be set in the OCC itself. - OSD_signal.cxx - if possible, get rid of sigaction() and replace with signal() and and other more advanced staff. We just need to map signals to C++ exceptions, so let's not make code more complex than neede> can simplify the OSD API and remove. If possible, minimize implementation discrepancies between OSes. - On SGI - remove use of env variable TRAP_FPE and replace with function handle_sigfpes() (as this is more reliable) - see SGI doc (http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0530&db=man&fname=/usr/s> [^] - minimize exposing OSD API by removing SegvHandler(), WntHandler() and others and keep SetSignal() only. Alternative approach is instead expose functions which map to OCC exceptions and document them, so that the user can reuse them in his own handlers. - rename OSD::SetSignal() with SetHandlers() as it not only sets signal handlers but exceptions also. - removed message box and call to a debugger. This is an ugly way and only pollutes the code. Moreover call to Debugger does really work on modern Windows (debugger is still ironically called due some failure within OSD_signal_WNT.cxx). In reality debugger can be attached to the process. Moreover, CSF_DEBUG_MODE was seemingly never tested - the message box could not display for FPE signals (because _fpreset() and _clearfp() were not called before it). In the ultimate case this code can be moved to some DRAW function as an example of how to implement own signal handling. - add additional boolean argument Reenforce into OSD::SetSignal() that would not redefine already set user's defined handlers. In this case, OSD_Pipeline should call OSD::SetSignal(aFloatingSignal=true, aReenforce=false) and would not reset user's handlers if they were redefined by user in the main thread |
||
Revision | 2011-10-21 16:38 by bugmaster | ||
Description | RLN Detailed description: - Exception objects (Standard_Failure ancestors) are now defined/implemented using macros (see Standard_DefineException> in a way similar to defining handles. This enables creating user-defined exceptions without CDL. Note that as preprocessor does not allow to insert preprocessor instructions (starting with #) into macro definitions, it is impossible to define macros #<object_type>_Raise_if(). Therefore their generation is kept within CDL extractor as previously. The user does not really need to do this - he may rely on No_Exceptions macro. CPPExt_Template.edl must be copied to $WOKHOME/lib for CDL extractor to take effect. - Standard_Failure has Throw() non-virtual and ancestros does not have it anymore (implementation was the same). OSD_signal_WNT.cxx - OSD::SetSignal() now always sets signal handlers, exception handlers and structured exception (SE) translators. This > to deal correctly in case if user's code is compiled with /EHs or /EHa. UseSETranslation() are removed, as redundant. See detailed documentation in OSD_signal_WNT.cxx on OSD::SetSignal(). - very detailed documentation for OSD::Setsignal() in Doygen format is now in this file. - removed static variables that set signals only once to enable calling ::SetSignal() for other threads or even within the same thread if the user switched handlers before - mutexes are used to control multi-threading. - TODO: - Minimize signal handling by OSD_Signal.cxx to SIGSEGV and SIGFPE. On Unix it currently processes all (or almost all) signals (e.g. SIGHUP) by exiting. There is no value add to that. It's better to be done by user apps. OCC should only handle those which it can survive after, if at all it must do anything. OCC classes may or maynot be provided for convenience but should not be set in the OCC itself. - OSD_signal.cxx - if possible, get rid of sigaction() and replace with signal() and and other more advanced staff. We just need to map signals to C++ exceptions, so let's not make code more complex than neede> can simplify the OSD API and remove. If possible, minimize implementation discrepancies between OSes. - On SGI - remove use of env variable TRAP_FPE and replace with function handle_sigfpes() (as this is more reliable) - see SGI doc (http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0530&db=man&fname=/usr/s> [^] - minimize exposing OSD API by removing SegvHandler(), WntHandler() and others and keep SetSignal() only. Alternative approach is instead expose functions which map to OCC exceptions and document them, so that the user can reuse them in his own handlers. - rename OSD::SetSignal() with SetHandlers() as it not only sets signal handlers but exceptions also. - removed message box and call to a debugger. This is an ugly way and only pollutes the code. Moreover call to Debugger does really work on modern Windows (debugger is still ironically called due some failure within OSD_signal_WNT.cxx). In reality debugger can be attached to the process. Moreover, CSF_DEBUG_MODE was seemingly never tested - the message box could not display for FPE signals (because _fpreset() and _clearfp() were not called before it). In the ultimate case this code can be moved to some DRAW function as an example of how to implement own signal handling. - add additional boolean argument Reenforce into OSD::SetSignal() that would not redefine already set user's defined handlers. In this case, OSD_Pipeline should call OSD::SetSignal(aFloatingSignal=true, aReenforce=false) and would not reset user's handlers if they were redefined by user in the main thread |
||
Revision | 2011-06-27 13:11 by bugmaster | ||
Description | RLN Detailed description: - Exception objects (Standard_Failure ancestors) are now defined/implemented using macros (see Standard_DefineException> in a way similar to defining handles. This enables creating user-defined exceptions without CDL. Note that as preprocessor does not allow to insert preprocessor instructions (starting with #) into macro definitions, it is impossible to define macros #<object_type>_Raise_if(). Therefore their generation is kept within CDL extractor as previously. The user does not really need to do this - he may rely on No_Exceptions macro. CPPExt_Template.edl must be copied to $WOKHOME/lib for CDL extractor to take effect. - Standard_Failure has Throw() non-virtual and ancestros does not have it anymore (implementation was the same). OSD_signal_WNT.cxx - OSD::SetSignal() now always sets signal handlers, exception handlers and structured exception (SE) translators. This > to deal correctly in case if user's code is compiled with /EHs or /EHa. UseSETranslation() are removed, as redundant. See detailed documentation in OSD_signal_WNT.cxx on OSD::SetSignal(). - very detailed documentation for OSD::Setsignal() in Doygen format is now in this file. - removed static variables that set signals only once to enable calling ::SetSignal() for other threads or even within the same thread if the user switched handlers before - mutexes are used to control multi-threading. - TODO: - Minimize signal handling by OSD_Signal.cxx to SIGSEGV and SIGFPE. On Unix it currently processes all (or almost all) signals (e.g. SIGHUP) by exiting. There is no value add to that. It's better to be done by user apps. OCC should only handle those which it can survive after, if at all it must do anything. OCC classes may or maynot be provided for convenience but should not be set in the OCC itself. - OSD_signal.cxx - if possible, get rid of sigaction() and replace with signal() and and other more advanced staff. We just need to map signals to C++ exceptions, so let's not make code more complex than neede> can simplify the OSD API and remove. If possible, minimize implementation discrepancies between OSes. - On SGI - remove use of env variable TRAP_FPE and replace with function handle_sigfpes() (as this is more reliable) - see SGI doc (http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0530&db=man&fname=/usr/s> [^] - minimize exposing OSD API by removing SegvHandler(), WntHandler() and others and keep SetSignal() only. Alternative approach is instead expose functions which map to OCC exceptions and document them, so that the user can reuse them in his own handlers. - rename OSD::SetSignal() with SetHandlers() as it not only sets signal handlers but exceptions also. - removed message box and call to a debugger. This is an ugly way and only pollutes the code. Moreover call to Debugger does really work on modern Windows (debugger is still ironically called due some failure within OSD_signal_WNT.cxx). In reality debugger can be attached to the process. Moreover, CSF_DEBUG_MODE was seemingly never tested - the message box could not display for FPE signals (because _fpreset() and _clearfp() were not called before it). In the ultimate case this code can be moved to some DRAW function as an example of how to implement own signal handling. - add additional boolean argument Reenforce into OSD::SetSignal() that would not redefine already set user's defined handlers. In this case, OSD_Pipeline should call OSD::SetSignal(aFloatingSignal=true, aReenforce=false) and would not reset user's handlers if they were redefined by user in the main thread |
Copyright © 2000 - 2021 MantisBT Team |