summaryrefslogtreecommitdiff
path: root/include/my_dbug.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/my_dbug.h')
-rw-r--r--include/my_dbug.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/my_dbug.h b/include/my_dbug.h
index 4b69787c2fe..bce33285788 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
- Copyright (C) 2000, 2017, MariaDB Corporation Ab
+ Copyright (C) 2000, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,6 +35,7 @@ struct _db_stack_frame_ {
};
struct _db_code_state_;
+extern MYSQL_PLUGIN_IMPORT my_bool my_assert;
extern my_bool _dbug_on_;
extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int);
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
@@ -103,7 +104,10 @@ extern int (*dbug_sanity)(void);
#define DBUG_END() _db_end_ ()
#define DBUG_LOCK_FILE _db_lock_file_()
#define DBUG_UNLOCK_FILE _db_unlock_file_()
-#define DBUG_ASSERT(A) do { if (!(A)) { _db_flush_(); assert(A); }} while (0)
+#define DBUG_ASSERT(A) do { if (!(A)) { _db_flush_(); \
+ if (my_assert) assert(A); \
+ else fprintf(stderr, "%s:%d: assert: %s\n", __FILE__, __LINE__, #A); \
+}} while (0)
#define DBUG_SLOW_ASSERT(A) DBUG_ASSERT(A)
#define DBUG_ASSERT_EXISTS
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))