-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement stacktrace from current exception for MSVC #159
Implement stacktrace from current exception for MSVC #159
Conversation
3039cdc
to
036c9de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very impressive!
Added some comments and nitpicks
std::current_exception() makes a copy of current exception object into returned std::exception_ptr. So the tracking of the original exception object and its stacktrace are lost.
036c9de
to
f76e128
Compare
Many thanks for the great PR! |
it is possible to track nested exceptions and to map exception_ptr to their callsite, but it can (imho) only be done via IAT Hooking functions in each affected library. Alternatively one may also apply EAT Hooking, if it is guaranteed that the shared libs are not loaded dynamically into foreign processes ... i.e plugin libs into excel or inproc ole/com or other stuff. Besides that, the perf and abilities of boost::stacktrace are quite impressive. The dep to COM Init should be removed for Windows, if resolving symbols. The implementation of seems to bypass the CoInit and therefore avoid apartment model collisions. |
Original stacktrace from
std::exception_ptr
is not possible currently.std::current_exception()
makes a copy of current exception object into returnedstd::exception_ptr
. So the tracking of the original exception object and its stacktrace are lost.Support for nested exceptions
is not much meaningful IMO, itcomplicates the implementation (see the last commit). Without nested exceptions support, one can always get stacktrace from current exception immediately after enteringcatch
block, but it loses the original stacktrace forrethrow_after_other_exception
case.The exception object is destroyed by
__DestructExceptionObject
exported fromvcruntime.dll
, there is no simple way to cleanup stored traces in time unless override__DestructExceptionObject
.