Boost logo

Boost :

Subject: Re: [boost] [Stacktrace] review, please stop discussing non-Stacktrace issues
From: Peter Dimov (lists_at_[hidden])
Date: 2016-12-18 17:54:38


Antony Polukhin wrote:

> As long as we have no strict documentation or source codes of the
> component - it is UB to use it in async-signal-handler.

Yes, obviously. It's not clear though what do Linux users gain from the
decision to keep their backend async-unsafe just because Windows is not
strictly documented.

And, FWIW, Windows is pretty resilient. Here for instance I crash in an APC
that is called by the kernel, and it works, even though I can't see g() in
the trace probably because Windows has handled the exception and rethrown
it:

#include <boost/stacktrace.hpp>
#include <iostream>
#include <signal.h>
#include <windows.h>

static void handler( int sig )
{
    boost::stacktrace::stacktrace st;
    std::cout << st << std::endl;

    _exit( 3 );
}

VOID CALLBACK g( ULONG_PTR )
{
    std::cout << "g\n";
    *(int*)0 = 0;
}

static void f()
{
    std::cout << "f\n";
    QueueUserAPC( g, GetCurrentThread(), 0 );
    SleepEx( 1000, TRUE );
}

int main()
{
    signal( SIGSEGV, handler );
    f();
}


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