MantisBT - Community
View Issue Details
0022545Community[OCCT] OCCT:Foundation Classespublic2011-05-27 20:472019-06-17 15:37
Roman Lygin 
[OCCT] 6.5.1 
[OCCT] 6.6.0[OCCT] 6.6.0 
Not needed
0022545: Improved exception handling
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::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
      - 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
(> [^]
             - 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
               aReenforce=false) and would not reset user's handlers if they
were redefined by user in the main thread
No tags attached.
Issue History
2011-08-02 11:23bugmasterCategoryOCCT:FDC => OCCT:Foundation Classes
2011-10-21 16:38bugmasterAssigned Tobugmaster => abv
2011-10-21 16:38bugmasterStatusacknowledged => assigned
2011-10-21 16:38bugmasterResolutionsuspended => open
2011-10-21 16:38bugmasterFixed in VersionEMPTY =>
2011-10-21 16:38bugmasterDescription Updatedbug_revision_view_page.php?rev_id=704#r704
2011-11-15 12:54abvStatusassigned => resolved
2011-11-15 12:54abvProduct Version => 6.5.1
2011-11-15 12:54abvTarget Version => 6.5.3
2011-11-25 14:50szyDescription Updatedbug_revision_view_page.php?rev_id=1098#r1098
2012-01-24 16:20bugmasterAssigned Toabv => kgv
2012-01-24 16:20bugmasterStatusresolved => reviewed
2012-01-26 09:41apnNote Added: 0019268
2012-01-26 09:41apnTest case number => Test case is not required
2012-01-26 09:41apnStatusreviewed => tested
2012-01-26 10:03abvNote Added: 0019269
2012-01-26 10:03abvAssigned Tokgv => abv
2012-01-26 10:03abvStatustested => assigned
2012-02-09 09:03abvTarget Version6.5.3 => 6.5.4
2012-10-23 19:27abvTarget Version6.5.4 => 6.6.0
2012-10-24 14:09kgvNote Added: 0021922
2012-10-24 14:09kgvStatusassigned => resolved
2012-10-24 14:13kgvAssigned Toabv => bugmaster
2012-10-24 14:13kgvStatusresolved => reviewed
2012-11-01 11:30apnNote Added: 0022045
2012-11-01 11:30apnTest case numberTest case is not required => Not needed
2012-11-01 11:30apnStatusreviewed => tested
2012-11-16 13:03Roman LyginChangeset attached => occt master 0ac0c8b4
2012-11-16 13:03Roman LyginAssigned Tobugmaster => Roman Lygin
2012-11-16 13:03Roman LyginStatustested => verified
2012-11-16 13:03Roman LyginResolutionopen => fixed
2012-12-10 17:16Roman LyginChangeset attached => occt master 0ac0c8b4
2013-04-23 13:36aivStatusverified => closed
2013-04-29 15:21aivFixed in Version => 6.6.0
2019-06-17 15:37kgvRelationship addedrelated to 0030775

2011-06-27 15:11   
Patch was reviewed. Corrected version was committed to SVN branch
http://svn/svn/occt/branches/OCC22545 [^]

Branch is ready for regression tests.
2012-01-26 09:41   
Dear BugMaster,
Workbench KAS:dev:apn-22545-occt was created from SVN branch http://svn/svn/occt/branches/OCC22545 [^]
(and apn-22545-products from trunk) and compiled on Linux platform.

There are not regressions in apn-22545-products regarding to KAS:dev:products-20120120-opt

See results in /QADisk/occttests/results/KAS/dev/ apn-22545-products_25012012/lin
See reference results in /QADisk/occttests/results/KAS/dev/products-20120120-opt_20012012/lin
See test cases in /QADisk/occttests/tests/ED
2012-01-26 10:03   
The results of testing on Linux are irrelevant since the change is Windows-specific.
2012-10-24 14:09   
Patch was rebased and pushed to CR22545 branch in git.
Please perform testing on Windows platform.
2012-11-01 11:30   
Dear BugMaster,
Branch CR22545 (and products from GIT master) was compiled on Linux and Windows platforms and tested.

Not detected

Not detected

Testing case:
Not needed