Boost logo

Boost :

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


Antony Polukhin wrote:

> The bad thing is that any printf like function, kernel calls (including
> multithreading) or malloc are not async signal handler safe. I'm quite
> sure that COM functions allocate memory and do some synchronization.

We can't speak of "COM functions" as such. Every COM function does its own
thing. In the in-process case, COM is basically just an ABI. What Dbgeng.dll
does is what it does. It certainly doesn't allocate using (the program's)
malloc though. And if it does synchronize, it does it with its own
CRITICAL_SECTIONs, and those can be used in a structured exception handler.

If Dbgeng.dll itself crashes, it would most likely be unable to resolve its
own crash, of course.

For async safe printing itself, you should use write/WriteFile. Something
like

    void frame::print_to_fd( int fd ); // POSIX
    void frame::print_to_fd( void* fd ); // Windows, void* is HANDLE

Now the user will be able to pass GetStdHandle( STD_ERROR_HANDLE ) for
stderr output, or a file handle for log output.


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