Boost logo

Boost :

Subject: Re: [boost] [stacktrace] Stacktrace library review
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2016-12-14 14:01:34


2016-12-14 12:55 GMT+03:00 Vladimir Batov <Vladimir.Batov_at_[hidden]>:
<...>
> I have not used the library. However, when it's in Boost I'll make use of it
> immediately. Can't say much about implementation either. However, the
> interface and the output seemed straightforward and sensible... Although in
> my implementation I decided not to report the superfluous
>
> 0# boost::stacktrace::detail::backend::backend(void**, unsigned long)

I've tried to do the same thing and failed:
* BOOST_FORCEINLINE may be ignored by compilers (and even worse -
produces a warning on some platforms when it is ignored).
* skipping predefined frames count fail too - depending on the
compiler/flags/version/platform different inlinement heuristics are
used and a chance of skipping useful frames appears

I'll try to do some more tweaking with BOOST_FORCEINLINE + warning
suppression. It may get better, but in some cases will continue to
output internals in backtraces.

> Additionally the number of macros seemed surprisingly high and I might say
> worrisome. Are they really that unavoidable?

By default everything works out-of-the-box and you do not need to
define macro. You will need those macros only for very experienced
tuning.

I can drop BOOST_STACKTRACE_USE_UNWIND and
BOOST_STACKTRACE_USE_WINDBG, but users may wish to make assertions on
those macro and even may wish to have different code:

void foo() {
#if defined(BOOST_STACKTRACE_USE_UNWIND) || defined(BOOST_STACKTRACE_USE_NOOP)
    // Async safe code, do our own async safe printing
#else
    // Not async safe, run only in non-production builds
#endif
}

> Secondly, when it crashes out there on the customer site, I want as
> much info as I can get.

Yes, that's the default behavior.

> I myself use a similar facility to identify and to address a problem promptly when reported by a customer. I am fortunate to only work on Linux.

Please, take a quick look at the Linux implementation
https://github.com/apolukhin/stacktrace/blob/master/include/boost/stacktrace/detail/backend_linux.hpp#L229
If your implementation has a more advanced technique for detecting
source file/line - I'd really appreciate a hint.

Thank you for the review!

-- 
Best regards,
Antony Polukhin

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk