MySQL 8.4.2
Source Code Documentation
|
Debug utilities for Innobase. More...
#include "my_compiler.h"
#include <cstdio>
#include <functional>
#include <sstream>
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
Go to the source code of this file.
Classes | |
class | ut_chrono_t |
A "chronometer" used to clock snippets of code. More... | |
Macros | |
#define | ut_a_op(LHS, OP, RHS) |
Assert that LHS OP RHS, where OP is an operator. More... | |
#define | ut_a_lt(LHS, RHS) ut_a_op(LHS, <, RHS) |
Assert that LHS < RHS. More... | |
#define | ut_a_le(LHS, RHS) ut_a_op(LHS, <=, RHS) |
Assert that LHS <= RHS. More... | |
#define | ut_a_eq(LHS, RHS) ut_a_op(LHS, ==, RHS) |
Assert that LHS == RHS. More... | |
#define | ut_a_ne(LHS, RHS) ut_a_op(LHS, !=, RHS) |
Assert that LHS != RHS. More... | |
#define | ut_a(EXPR) |
Abort execution if EXPR does not evaluate to nonzero. More... | |
#define | ut_error ut_dbg_assertion_failed(nullptr, __FILE__, __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 | ut_ad_lt(LHS, RHS) ut_a_lt(LHS, RHS) |
Debug-only assertion that LHS < RHS. More... | |
#define | ut_ad_le(LHS, RHS) ut_a_le(LHS, RHS) |
Debug-only assertion that LHS <= RHS. More... | |
#define | ut_ad_eq(LHS, RHS) ut_a_eq(LHS, RHS) |
Debug-only assertion that LHS == RHS. More... | |
#define | ut_ad_ne(LHS, RHS) ut_a_op(LHS, !=, RHS) |
Assert that LHS != RHS. 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) std::ignore = A |
Silence warnings about an unused variable by doing a null assignment. More... | |
#define | HAVE_UT_CHRONO_T |
#define | timersub(a, b, r) |
#define | CHRONO_PRINT(type, tvp) |
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, uint64_t line) |
Report a failed assertion. More... | |
template<typename L , typename R > | |
void | ut_dbg_comparison_failed (const char *lhs_expr, const L &lhs_value, const char *op, const char *rhs_expr, const R &rhs_value, const char *file, uint64_t line) |
Debug utilities for Innobase.
Created 1/30/1994 Heikki Tuuri
#define CHRONO_PRINT | ( | type, | |
tvp | |||
) |
#define DBUG_INJECT_CRASH | ( | prefix, | |
count | |||
) |
Debug crash point.
#define DBUG_INJECT_CRASH_WITH_LOG_FLUSH | ( | prefix, | |
count | |||
) |
#define HAVE_UT_CHRONO_T |
#define timersub | ( | a, | |
b, | |||
r | |||
) |
#define ut_a | ( | EXPR | ) |
Abort execution if EXPR does not evaluate to nonzero.
EXPR | assertion expression that should hold |
#define ut_a_eq | ( | LHS, | |
RHS | |||
) | ut_a_op(LHS, ==, RHS) |
Assert that LHS == RHS.
Abort execution otherwise.
#define ut_a_le | ( | LHS, | |
RHS | |||
) | ut_a_op(LHS, <=, RHS) |
Assert that LHS <= RHS.
Abort execution otherwise.
#define ut_a_lt | ( | LHS, | |
RHS | |||
) | ut_a_op(LHS, <, RHS) |
Assert that LHS < RHS.
Abort execution otherwise.
#define ut_a_ne | ( | LHS, | |
RHS | |||
) | ut_a_op(LHS, !=, RHS) |
Assert that LHS != RHS.
Abort execution otherwise.
#define ut_a_op | ( | LHS, | |
OP, | |||
RHS | |||
) |
Assert that LHS OP RHS, where OP is an operator.
Abort execution otherwise. Technical remarks: The LHS and RHS are evaluated exactly once (no short circuiting, even if OP is && or ||). Each value is stored in a local variable, so it's fine for LHS or RHS to return a temporary. In case of assertion failure references to const values of LHS and RHS will be passed to std::ostringstream::operator<<, so it must be implemented for them.
#define ut_ad | ( | EXPR | ) | ut_a(EXPR) |
Debug assertion.
Does nothing unless UNIV_DEBUG is defined.
#define ut_ad_eq | ( | LHS, | |
RHS | |||
) | ut_a_eq(LHS, RHS) |
Debug-only assertion that LHS == RHS.
#define ut_ad_le | ( | LHS, | |
RHS | |||
) | ut_a_le(LHS, RHS) |
Debug-only assertion that LHS <= RHS.
#define ut_ad_lt | ( | LHS, | |
RHS | |||
) | ut_a_lt(LHS, RHS) |
Debug-only assertion that LHS < RHS.
#define ut_ad_ne | ( | LHS, | |
RHS | |||
) | ut_a_op(LHS, !=, RHS) |
Assert that LHS != RHS.
Abort execution otherwise.
#define ut_d | ( | EXPR | ) | EXPR |
Debug statement.
Does nothing unless UNIV_DEBUG is defined.
#define ut_error ut_dbg_assertion_failed(nullptr, __FILE__, __LINE__) |
Abort execution.
#define UT_NOT_USED | ( | A | ) | std::ignore = A |
Silence warnings about an unused variable by doing a null assignment.
A | the unused variable |
#define ut_o | ( | EXPR | ) |
Opposite of ut_d().
Does nothing if UNIV_DEBUG is defined.
void ut_dbg_assertion_failed | ( | const char * | expr, |
const char * | file, | ||
uint64_t | line | ||
) |
Report a failed assertion.
[in] | expr | The failed assertion |
[in] | file | Source file containing the assertion |
[in] | line | Line number of the assertion |
|
inline |
void ut_set_assert_callback | ( | std::function< void()> & | callback | ) |
Set a callback function to be called before exiting.
[in] | callback | user callback function |