forked from premiere/premiere-libtorrent
parent
0ea449a7b5
commit
6777ec5d05
|
@ -146,12 +146,19 @@ TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth)
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "libtorrent/utf8.hpp"
|
#include "libtorrent/utf8.hpp"
|
||||||
|
#include "libtorrent/thread.hpp"
|
||||||
|
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "dbghelp.h"
|
#include "dbghelp.h"
|
||||||
|
|
||||||
|
static libtorrent::mutex dbghlp_mutex;
|
||||||
|
|
||||||
TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth)
|
TORRENT_EXPORT void print_backtrace(char* out, int len, int max_depth)
|
||||||
{
|
{
|
||||||
|
// all calls to DbgHlp.dll are thread-unsafe. i.e. they all need to be
|
||||||
|
// synchronized and not called concurrently. This mutex serializes access
|
||||||
|
libtorrent::mutex::scoped_lock l(dbghlp_mutex);
|
||||||
|
|
||||||
typedef USHORT (WINAPI *RtlCaptureStackBackTrace_t)(
|
typedef USHORT (WINAPI *RtlCaptureStackBackTrace_t)(
|
||||||
__in ULONG FramesToSkip,
|
__in ULONG FramesToSkip,
|
||||||
__in ULONG FramesToCapture,
|
__in ULONG FramesToCapture,
|
||||||
|
|
|
@ -51,6 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <windows.h> // fot SetErrorMode
|
#include <windows.h> // fot SetErrorMode
|
||||||
#include <io.h> // for _dup and _dup2
|
#include <io.h> // for _dup and _dup2
|
||||||
#include <process.h> // for _getpid
|
#include <process.h> // for _getpid
|
||||||
|
#include <crtdbg.h>
|
||||||
|
|
||||||
#define dup _dup
|
#define dup _dup
|
||||||
#define dup2 _dup2
|
#define dup2 _dup2
|
||||||
|
@ -224,6 +225,12 @@ EXPORT int main(int argc, char const* argv[])
|
||||||
| SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
| SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
||||||
|
|
||||||
SetUnhandledExceptionFilter(&seh_exception_handler);
|
SetUnhandledExceptionFilter(&seh_exception_handler);
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
|
||||||
|
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef O_NONBLOCK
|
#ifdef O_NONBLOCK
|
||||||
|
|
Loading…
Reference in New Issue