
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.