Boost logo

Boost :

Subject: Re: [boost] [Stacktrace] Second review begins today 17th Mar ends 26th Mar
From: Peter Dimov (lists_at_[hidden])
Date: 2017-03-17 17:30:22

> You can find the documentation at
> and the github repo
> at

The heuristic that skips 3 frames (under Windows) doesn't quite work. It
seems that MSVC in whole program optimization mode ignores BOOST_NOINLINE
directives and makes inline decisions that differ in unpredictable ways
between compiles. This program, for instance:

#include <boost/stacktrace.hpp>
#include <iostream>
#include <algorithm>
#include <functional>

void g( int x )
    boost::stacktrace::stacktrace st( -3, -1 );
    std::cout << st << std::endl;

void f( int x )
    std::function<void(int)> h( g );
    std::for_each( &x, &x + 1, g );

int main()
    f( 1 );

gives this trace:

0# boost::stacktrace::detail::this_thread_frames::collect at
1# g at c:\projects\testbed2017\testbed2017.cpp:9
2# main at c:\projects\testbed2017\testbed2017.cpp:20
3# __scrt_common_main_seh at
4# BaseThreadInitThunk in kernel32
5# RtlInitializeExceptionChain in ntdll
6# RtlInitializeExceptionChain in ntdll

With the default constructor, #0, #1 and #2 disappear and nothing useful

There should probably be a way to optionally remove the +1 and +2 hardcoded
skips because passing a nonportable -3 to a size_t is not exactly a best

Boost list run by bdawes at, gregod at, cpdaniel at, john at