As you know, when an exception is thrown the stack is unwound. As that is happening, objects are destructed and their destructors are called. If one of these destructors calls a function instrumented with STACK, that function will be incorrectly added to the stack trace.
I worked around this by adding the following at the beginning of Scope's constructor:
// Don't add new stacks while unwinding when destructors, etc. may call lots of instrumented functions
if (std::uncaught_exception())
return;
Thanks for this code, it is helpful.
As you know, when an exception is thrown the stack is unwound. As that is happening, objects are destructed and their destructors are called. If one of these destructors calls a function instrumented with
STACK
, that function will be incorrectly added to the stack trace.I worked around this by adding the following at the beginning of
Scope
's constructor: