Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost] Checking interest in stacktrace library
From: Jason Roehm (jasonr_at_[hidden])
Date: 2016-06-18 13:51:35


> On Jun 18, 2016, at 12:44 PM, Antony Polukhin <antoshkka_at_[hidden]> wrote:
>
>
>
> 2016-06-18 17:49 GMT+03:00 Edward Diener <eldiener_at_[hidden]>:
>>> On 6/18/2016 6:34 AM, Antony Polukhin wrote:
>>> Is there interest in it?
>>> What functionality would you like to have in it?
>>
>> Documentation is always helpful.
>
> Yeep, that's currently missing :(
>
> If in short:
> namespace boost { namespace stacktrace {
> class stacktrace {
> public:
> BOOST_STATIC_CONSTEXPR std::size_t max_symbol_width = 256;
> typedef boost::array<char, max_symbol_width> frame_t;
>
> stacktrace() BOOST_NOEXCEPT;
> stacktrace(const stacktrace& bt) BOOST_NOEXCEPT;
> stacktrace& operator=(const stacktrace& bt) BOOST_NOEXCEPT;
> ~stacktrace() BOOST_NOEXCEPT;
>
> std::size_t size() const BOOST_NOEXCEPT;
> frame_t operator[](std::size_t frame) const BOOST_NOEXCEPT;
> };
>
> template <class CharT, class TraitsT>
> std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const stacktrace& bt);
> }}
>
> So you can construct stacktraces, copy them and output them to streams:
>
> std::cerr << stacktrace();

I think a library like this could be very useful for practical cross-platform development.

Are there any means for either inspecting the contents of the trace (e.g. iterating over the frames and extracting things like the function name, offset, source file/line if available, etc.)?

Alternatively, is there any way to control the formatting of the trace when it is inserted into a stream? If not, is the format platform-specific or in some common layout?

Jason



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net