View Issue Details

IDProjectCategoryView StatusLast Update
0022545CommunityOCCT:Foundation Classespublic2019-06-17 15:37
Reporterszy Assigned ToRoman Lygin  
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
OSAll 
Product Version6.5.1 
Target Version6.6.0Fixed in Version6.6.0 
Summary0022545: Improved exception handling
DescriptionRLN 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
TagsNo tags attached.
Test case numberNot needed

Activities

kgv

2011-06-27 15:11

developer   ~0017529

Patch was reviewed. Corrected version was committed to SVN branch
http://svn/svn/occt/branches/OCC22545

Branch is ready for regression tests.

apn

2012-01-26 09:41

administrator   ~0019268

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

abv

2012-01-26 10:03

manager   ~0019269

The results of testing on Linux are irrelevant since the change is Windows-specific.

kgv

2012-10-24 14:09

developer   ~0021922

Patch was rebased and pushed to CR22545 branch in git.
Please perform testing on Windows platform.

apn

2012-11-01 11:30

administrator   ~0022045

Dear BugMaster,
Branch CR22545 (and products from GIT master) was compiled on Linux and Windows platforms and tested.

Regression:
Not detected

Improvements:
Not detected

Testing case:
Not needed

Related Changesets

occt: master 0ac0c8b4

2012-11-15 09:17:30

Roman Lygin

Details Diff
0022545: Improved exception handling Affected Issues
0022545
mod - src/OSD/OSD.cdl Diff File
mod - src/OSD/OSD_signal_WNT.cxx Diff File

Issue History

Date Modified Username Field Change
2011-08-02 11:23 bugmaster Category OCCT:FDC => OCCT:Foundation Classes
2011-10-21 16:38 bugmaster Assigned To bugmaster => abv
2011-10-21 16:38 bugmaster Status acknowledged => assigned
2011-10-21 16:38 bugmaster Resolution suspended => open
2011-10-21 16:38 bugmaster Fixed in Version EMPTY =>
2011-10-21 16:38 bugmaster Description Updated
2011-11-15 12:54 abv Status assigned => resolved
2011-11-15 12:54 abv Product Version => 6.5.1
2011-11-15 12:54 abv Target Version => 6.5.3
2011-11-25 14:50 szy Description Updated
2012-01-24 16:20 bugmaster Assigned To abv => kgv
2012-01-24 16:20 bugmaster Status resolved => reviewed
2012-01-26 09:41 apn Note Added: 0019268
2012-01-26 09:41 apn Test case number => Test case is not required
2012-01-26 09:41 apn Status reviewed => tested
2012-01-26 10:03 abv Note Added: 0019269
2012-01-26 10:03 abv Assigned To kgv => abv
2012-01-26 10:03 abv Status tested => assigned
2012-02-09 09:03 abv Target Version 6.5.3 => 6.5.4
2012-10-23 19:27 abv Target Version 6.5.4 => 6.6.0
2012-10-24 14:09 kgv Note Added: 0021922
2012-10-24 14:09 kgv Status assigned => resolved
2012-10-24 14:13 kgv Assigned To abv => bugmaster
2012-10-24 14:13 kgv Status resolved => reviewed
2012-11-01 11:30 apn Note Added: 0022045
2012-11-01 11:30 apn Test case number Test case is not required => Not needed
2012-11-01 11:30 apn Status reviewed => tested
2012-11-16 13:03 Roman Lygin Changeset attached => occt master 0ac0c8b4
2012-11-16 13:03 Roman Lygin Assigned To bugmaster => Roman Lygin
2012-11-16 13:03 Roman Lygin Status tested => verified
2012-11-16 13:03 Roman Lygin Resolution open => fixed
2012-12-10 17:16 Roman Lygin Changeset attached => occt master 0ac0c8b4
2013-04-23 13:36 aiv Status verified => closed
2013-04-29 15:21 aiv Fixed in Version => 6.6.0