Add the expression to debug assertion log message
The actual expression that failed should help figure out what went wrong from the logs alone.
This commit is contained in:
parent
4f03aa674c
commit
5cd347ff18
@ -35,10 +35,12 @@ MXS_BEGIN_DECLS
|
||||
#if defined(SS_DEBUG) && defined(LOG_ASSERT)
|
||||
#include <maxscale/log_manager.h>
|
||||
# define ss_dassert(exp) do { if(!(exp)){\
|
||||
MXS_ERROR("debug assert %s:%d\n", (char*)__FILE__, __LINE__);\
|
||||
const char *debug_expr = #exp; /** The MXS_ERROR marco doesn't seem to like stringification */ \
|
||||
MXS_ERROR("debug assert at %s:%d failed: %s\n", (char*)__FILE__, __LINE__, debug_expr);\
|
||||
mxs_log_flush_sync(); assert(exp);} } while (false)
|
||||
#define ss_info_dassert(exp,info) do { if(!(exp)){\
|
||||
MXS_ERROR("debug assert %s:%d %s\n", (char*)__FILE__, __LINE__, info);\
|
||||
const char *debug_expr = #exp; \
|
||||
MXS_ERROR("debug assert at %s:%d failed: %s (%s)\n", (char*)__FILE__, __LINE__, info, debug_expr);\
|
||||
mxs_log_flush_sync();assert(exp);} } while (false)
|
||||
# define ss_debug(exp) exp
|
||||
# define ss_dfprintf fprintf
|
||||
|
Loading…
x
Reference in New Issue
Block a user