mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:54:14 +08:00
mdbx-windows: использование _CrtDbgReport() в отладочных сборках.
This commit is contained in:
parent
ad09164604
commit
14eda2cd17
16
src/osal.c
16
src/osal.c
@ -20,6 +20,10 @@
|
||||
|
||||
#include <winioctl.h>
|
||||
|
||||
#if !MDBX_WITHOUT_MSVC_CRT && defined(_DEBUG)
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
static int waitstatus2errcode(DWORD result) {
|
||||
switch (result) {
|
||||
case WAIT_OBJECT_0:
|
||||
@ -252,9 +256,14 @@ MDBX_NORETURN __cold void assert_fail(const char *msg, const char *func,
|
||||
|
||||
while (1) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#if !MDBX_WITHOUT_MSVC_CRT && defined(_DEBUG)
|
||||
_CrtDbgReport(_CRT_ASSERT, func ? func : "unknown", line, "libmdbx",
|
||||
"assertion failed: %s", msg);
|
||||
#else
|
||||
if (IsDebuggerPresent())
|
||||
DebugBreak();
|
||||
FatalExit(ERROR_UNHANDLED_ERROR);
|
||||
#endif
|
||||
FatalExit(STATUS_ASSERTION_FAILURE);
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
@ -278,10 +287,15 @@ __cold void mdbx_panic(const char *fmt, ...) {
|
||||
|
||||
while (1) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#if !MDBX_WITHOUT_MSVC_CRT && defined(_DEBUG)
|
||||
_CrtDbgReport(_CRT_ASSERT, "mdbx.c", 0, "libmdbx", "panic: %s",
|
||||
const_message);
|
||||
#else
|
||||
OutputDebugStringA("\r\nMDBX-PANIC: ");
|
||||
OutputDebugStringA(const_message);
|
||||
if (IsDebuggerPresent())
|
||||
DebugBreak();
|
||||
#endif
|
||||
FatalExit(ERROR_UNHANDLED_ERROR);
|
||||
#else
|
||||
__assert_fail(const_message, "mdbx", 0, "panic");
|
||||
|
Loading…
x
Reference in New Issue
Block a user