Skip to content

Commit 12ff819

Browse files
authored
Merge pull request #369 from adierking/crtassert
Report crash messages on Windows to the CRT
2 parents 30d3c8c + 8804977 commit 12ff819

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/internal.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
293293
#endif
294294
#if defined(_WIN32)
295295
#include <io.h>
296+
#include <crtdbg.h>
296297
#endif
297298

298299
#if defined(__GNUC__) || defined(__clang__)
@@ -876,9 +877,19 @@ _dispatch_ktrace_impl(uint32_t code, uint64_t a, uint64_t b,
876877
#define _dispatch_hardware_crash() \
877878
__asm__(""); __builtin_trap() // <rdar://problem/17464981>
878879

880+
#ifdef _WIN32
881+
#define _dispatch_set_crash_log_cause_and_message(ac, msg) do { \
882+
(void)(ac); \
883+
_dispatch_set_crash_log_message_dynamic((msg)); \
884+
} while (0)
885+
#define _dispatch_set_crash_log_message(msg) \
886+
_dispatch_set_crash_log_message_dynamic((msg))
887+
#define _dispatch_set_crash_log_message_dynamic(msg) _RPTF0(_CRT_ASSERT, (msg))
888+
#else
879889
#define _dispatch_set_crash_log_cause_and_message(ac, msg) ((void)(ac))
880890
#define _dispatch_set_crash_log_message(msg)
881891
#define _dispatch_set_crash_log_message_dynamic(msg)
892+
#endif
882893

883894
#if HAVE_MACH
884895
// MIG_REPLY_MISMATCH means either:

0 commit comments

Comments
 (0)