MySQL  8.0.20
Source Code Documentation
ut0dbg.h File Reference

Debug utilities for Innobase. More...

#include <functional>
#include "os0thread.h"
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>

Go to the source code of this file.

Macros

#define ut_a(EXPR)
 Abort execution if EXPR does not evaluate to nonzero. More...
 
#define ut_error   ut_dbg_assertion_failed(0, __FILE__, (ulint)__LINE__)
 Abort execution. More...
 
#define ut_ad(EXPR)   ut_a(EXPR)
 Debug assertion. More...
 
#define ut_d(EXPR)   EXPR
 Debug statement. More...
 
#define ut_o(EXPR)
 Opposite of ut_d(). More...
 
#define DBUG_INJECT_CRASH(prefix, count)
 Debug crash point. More...
 
#define DBUG_INJECT_CRASH_WITH_LOG_FLUSH(prefix, count)
 
#define UT_NOT_USED(A)   A = A
 Silence warnings about an unused variable by doing a null assignment. More...
 

Functions

void ut_set_assert_callback (std::function< void()> &callback)
 Set a callback function to be called before exiting. More...
 
void ut_dbg_assertion_failed (const char *expr, const char *file, ulint line)
 Report a failed assertion. More...
 

Detailed Description

Debug utilities for Innobase.

Created 1/30/1994 Heikki Tuuri

Macro Definition Documentation

◆ DBUG_INJECT_CRASH

#define DBUG_INJECT_CRASH (   prefix,
  count 
)
Value:
do { \
char buf[64]; \
snprintf(buf, sizeof buf, prefix "_%u", count); \
DBUG_EXECUTE_IF(buf, DBUG_SUICIDE();); \
} while (0)
ssize_t count
Definition: memcached.c:386
#define DBUG_SUICIDE()
Definition: my_dbug.h:229

Debug crash point.

◆ DBUG_INJECT_CRASH_WITH_LOG_FLUSH

#define DBUG_INJECT_CRASH_WITH_LOG_FLUSH (   prefix,
  count 
)
Value:
do { \
char buf[64]; \
snprintf(buf, sizeof buf, prefix "_%u", count); \
DBUG_EXECUTE_IF(buf, log_buffer_flush_to_disk(); DBUG_SUICIDE();); \
} while (0)
ssize_t count
Definition: memcached.c:386
void log_buffer_flush_to_disk(log_t &log, bool sync=true)
Write to the log file up to the last log entry.
Definition: log0buf.cc:990
#define DBUG_SUICIDE()
Definition: my_dbug.h:229

◆ ut_a

#define ut_a (   EXPR)
Value:
do { \
if (UNIV_UNLIKELY(!(ulint)(EXPR))) { \
ut_dbg_assertion_failed(#EXPR, __FILE__, (ulint)__LINE__); \
} \
} while (0)

Abort execution if EXPR does not evaluate to nonzero.

Parameters
EXPRassertion expression that should hold

◆ ut_ad

#define ut_ad (   EXPR)    ut_a(EXPR)

Debug assertion.

Does nothing unless UNIV_DEBUG is defined.

◆ ut_d

#define ut_d (   EXPR)    EXPR

Debug statement.

Does nothing unless UNIV_DEBUG is defined.

◆ ut_error

#define ut_error   ut_dbg_assertion_failed(0, __FILE__, (ulint)__LINE__)

Abort execution.

◆ UT_NOT_USED

#define UT_NOT_USED (   A)    A = A

Silence warnings about an unused variable by doing a null assignment.

Parameters
Athe unused variable

◆ ut_o

#define ut_o (   EXPR)

Opposite of ut_d().

Does nothing if UNIV_DEBUG is defined.

Function Documentation

◆ ut_dbg_assertion_failed()

void ut_dbg_assertion_failed ( const char *  expr,
const char *  file,
ulint  line 
)

Report a failed assertion.

in: line number of the assertion

Parameters
exprin: the failed assertion (optional)
filein: source file containing the assertion
linein: line number of the assertion

◆ ut_set_assert_callback()

void ut_set_assert_callback ( std::function< void()> &  callback)

Set a callback function to be called before exiting.

Parameters
[in]callbackuser callback function