Hi !
Originally posted message over here:
> Hello everybody!
> The feature of getting stacktraces from exceptions was requested in
> Annual C++ Developer Survey".
> I've created a prototype for getting stacktraces from exceptions
> More details can be found in the paper D2370R0 "Stacktrace from exception"
here -
> Any comments are welcome!
vRegards, Andrei
C# in it's design does not allow only to catch exception, but also to survive from it.
The mechanics goes deeper in handling such events as DispatcherUnhandledException
and deeper into C#, like HandleProcessCorruptedStateExceptions special kind of attributes.
But I was wondering whether same kind of exception handling system could be implemented in c++.
C++ application would be able to survive it.
Initial idea of how low level exception could be implemented in illustrated in this header file:
and sample code:
Where you get exception code and exception textual representation if you want to log it.
Exception codes and their description could be also generalized - I have just listed all for windows and linux:
but I think null pointer exception code for windows is EXCEPTION_ACCESS_VIOLATION and for linux SIGSEGV - but that could be abstracted behind common exception code
and common description message.
There are more problems on the way - especially if you mix C++ and C# code, then windows C++ implementation might need to ignore special .net framework codes
But this is something Microsoft team will need to work on.
More information for Microsoft team, Windows port:
- There exists a way to probe at run-time whether application is pure C++ or mixed mode C++.
But I think we can clearly define interface, and let Microsoft worry about implementation details later on.
So would it be possible to add following use case:
Application can detect abnormal application behavior and survive from it without terminating the process.
Call stack determination might be used when such low level exception happens.
-- Have a nice day! Tarmo.