MySQL  8.0.17
Source Code Documentation
my_dbug.h File Reference
#include <stdlib.h>
#include "my_compiler.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <sstream>
#include <string>

Go to the source code of this file.

Classes

struct  _db_stack_frame_
 
class  AutoDebugTrace
 A RAII helper to do DBUG_ENTER / DBUG_RETURN for you automatically. More...
 

Macros

#define DBUG_PRETTY_FUNCTION   __func__
 
#define DBUG_TRACE   AutoDebugTrace _db_trace(DBUG_PRETTY_FUNCTION, __FILE__, __LINE__)
 
#define DBUG_ENTER(a)
 
#define DBUG_LEAVE   _db_return_(__LINE__, &_db_stack_frame_)
 
#define DBUG_RETURN(a1)
 
#define DBUG_VOID_RETURN
 
#define DBUG_EXECUTE(keyword, a1)
 
#define DBUG_EXECUTE_IF(keyword, a1)
 
#define DBUG_EVALUATE(keyword, a1, a2)   (_db_keyword_(0, (keyword), 0) ? (a1) : (a2))
 
#define DBUG_EVALUATE_IF(keyword, a1, a2)   (_db_keyword_(0, (keyword), 1) ? (a1) : (a2))
 
#define DBUG_PRINT(keyword, arglist)
 
#define DBUG_PUSH(a1)   _db_push_(a1)
 
#define DBUG_POP()   _db_pop_()
 
#define DBUG_SET(a1)   _db_set_(a1)
 
#define DBUG_SET_INITIAL(a1)   _db_set_init_(a1)
 
#define DBUG_PROCESS(a1)   _db_process_(a1)
 
#define DBUG_FILE   _db_fp_()
 
#define DBUG_DUMP(keyword, a1, a2)   _db_dump_(__LINE__, keyword, a1, a2)
 
#define DBUG_END()   _db_end_()
 
#define DBUG_LOCK_FILE   _db_lock_file_()
 
#define DBUG_UNLOCK_FILE   _db_unlock_file_()
 
#define DBUG_ASSERT(A)   assert(A)
 
#define DBUG_EXPLAIN(buf, len)   _db_explain_(0, (buf), (len))
 
#define DBUG_EXPLAIN_INITIAL(buf, len)   _db_explain_init_((buf), (len))
 
#define DBUG_ABORT()   (_db_flush_(), abort())
 
#define DBUG_EXIT()   (_db_flush_(), exit(2))
 
#define DBUG_SUICIDE()   (_db_flush_(), _db_suicide_())
 
#define DBUG_LOG(keyword, v)
 

Functions

int _db_keyword_ (struct CODE_STATE *, const char *, int)
 
int _db_explain_ (struct CODE_STATE *cs, char *buf, size_t len)
 
int _db_explain_init_ (char *buf, size_t len)
 
int _db_is_pushed_ (void)
 Returns true if session-local settings have been set. More...
 
void _db_process_ (const char *name)
 
void _db_push_ (const char *control)
 
void _db_pop_ (void)
 
void _db_set_ (const char *control)
 
void _db_set_init_ (const char *control)
 
void _db_enter_ (const char *_func_, int func_len, const char *_file_, unsigned int _line_, struct _db_stack_frame_ *_stack_frame_)
 
void _db_return_ (unsigned int _line_, struct _db_stack_frame_ *_stack_frame_)
 
void _db_pargs_ (unsigned int _line_, const char *keyword)
 
int _db_enabled_ ()
 
void _db_doprnt_ (const char *format,...)
 
void _db_dump_ (unsigned int _line_, const char *keyword, const unsigned char *memory, size_t length)
 
void _db_end_ (void)
 
void _db_lock_file_ (void)
 
void _db_unlock_file_ (void)
 
FILE * _db_fp_ (void)
 
void _db_flush_ ()
 
const char * _db_get_func_ (void)
 
void _db_suicide_ ()
 
void _db_flush_gcov_ ()
 
void dump_trace ()
 

Macro Definition Documentation

◆ DBUG_ABORT

#define DBUG_ABORT ( )    (_db_flush_(), abort())

◆ DBUG_ASSERT

#define DBUG_ASSERT (   A)    assert(A)

◆ DBUG_DUMP

#define DBUG_DUMP (   keyword,
  a1,
  a2 
)    _db_dump_(__LINE__, keyword, a1, a2)

◆ DBUG_END

#define DBUG_END ( )    _db_end_()

◆ DBUG_ENTER

#define DBUG_ENTER (   a)
Value:
_db_enter_(a, ::strlen(a), __FILE__, __LINE__, &_db_stack_frame_)
Definition: my_dbug.h:45

◆ DBUG_EVALUATE

#define DBUG_EVALUATE (   keyword,
  a1,
  a2 
)    (_db_keyword_(0, (keyword), 0) ? (a1) : (a2))

◆ DBUG_EVALUATE_IF

#define DBUG_EVALUATE_IF (   keyword,
  a1,
  a2 
)    (_db_keyword_(0, (keyword), 1) ? (a1) : (a2))

◆ DBUG_EXECUTE

#define DBUG_EXECUTE (   keyword,
  a1 
)
Value:
do { \
if (_db_keyword_(0, (keyword), 0)) { \
a1 \
} \
} while (0)
int _db_keyword_(struct CODE_STATE *, const char *, int)
Definition: dbug.cc:1759

◆ DBUG_EXECUTE_IF

#define DBUG_EXECUTE_IF (   keyword,
  a1 
)
Value:
do { \
if (_db_keyword_(0, (keyword), 1)) { \
a1 \
} \
} while (0)
int _db_keyword_(struct CODE_STATE *, const char *, int)
Definition: dbug.cc:1759

◆ DBUG_EXIT

#define DBUG_EXIT ( )    (_db_flush_(), exit(2))

◆ DBUG_EXPLAIN

#define DBUG_EXPLAIN (   buf,
  len 
)    _db_explain_(0, (buf), (len))

◆ DBUG_EXPLAIN_INITIAL

#define DBUG_EXPLAIN_INITIAL (   buf,
  len 
)    _db_explain_init_((buf), (len))

◆ DBUG_FILE

#define DBUG_FILE   _db_fp_()

◆ DBUG_LEAVE

#define DBUG_LEAVE   _db_return_(__LINE__, &_db_stack_frame_)

◆ DBUG_LOCK_FILE

#define DBUG_LOCK_FILE   _db_lock_file_()

◆ DBUG_LOG

#define DBUG_LOG (   keyword,
 
)
Value:
do { \
std::ostringstream sout; \
sout << v; \
DBUG_PRINT(keyword, ("%s", sout.str().c_str())); \
} while (0)

◆ DBUG_POP

#define DBUG_POP ( )    _db_pop_()

◆ DBUG_PRETTY_FUNCTION

#define DBUG_PRETTY_FUNCTION   __func__

◆ DBUG_PRINT

#define DBUG_PRINT (   keyword,
  arglist 
)
Value:
do { \
_db_pargs_(__LINE__, keyword); \
if (_db_enabled_()) { \
_db_doprnt_ arglist; \
} \
} while (0)
int _db_enabled_()
Definition: dbug.cc:1275

◆ DBUG_PROCESS

#define DBUG_PROCESS (   a1)    _db_process_(a1)

◆ DBUG_PUSH

#define DBUG_PUSH (   a1)    _db_push_(a1)

◆ DBUG_RETURN

#define DBUG_RETURN (   a1)
Value:
do { \
DBUG_LEAVE; \
return (a1); \
} while (0)

◆ DBUG_SET

#define DBUG_SET (   a1)    _db_set_(a1)

◆ DBUG_SET_INITIAL

#define DBUG_SET_INITIAL (   a1)    _db_set_init_(a1)

◆ DBUG_SUICIDE

#define DBUG_SUICIDE ( )    (_db_flush_(), _db_suicide_())

◆ DBUG_TRACE

#define DBUG_TRACE   AutoDebugTrace _db_trace(DBUG_PRETTY_FUNCTION, __FILE__, __LINE__)

◆ DBUG_UNLOCK_FILE

#define DBUG_UNLOCK_FILE   _db_unlock_file_()

◆ DBUG_VOID_RETURN

#define DBUG_VOID_RETURN
Value:
do { \
DBUG_LEAVE; \
return; \
} while (0)

Function Documentation

◆ _db_doprnt_()

void _db_doprnt_ ( const char *  format,
  ... 
)

◆ _db_dump_()

void _db_dump_ ( unsigned int  _line_,
const char *  keyword,
const unsigned char *  memory,
size_t  length 
)

◆ _db_enabled_()

int _db_enabled_ ( )

◆ _db_end_()

void _db_end_ ( void  )

◆ _db_enter_()

void _db_enter_ ( const char *  _func_,
int  func_len,
const char *  _file_,
unsigned int  _line_,
struct _db_stack_frame_ _stack_frame_ 
)

◆ _db_explain_()

int _db_explain_ ( struct CODE_STATE cs,
char *  buf,
size_t  len 
)

◆ _db_explain_init_()

int _db_explain_init_ ( char *  buf,
size_t  len 
)

◆ _db_flush_()

void _db_flush_ ( )

◆ _db_flush_gcov_()

void _db_flush_gcov_ ( )

◆ _db_fp_()

FILE* _db_fp_ ( void  )

◆ _db_get_func_()

const char* _db_get_func_ ( void  )

◆ _db_is_pushed_()

int _db_is_pushed_ ( void  )

Returns true if session-local settings have been set.

◆ _db_keyword_()

int _db_keyword_ ( struct CODE_STATE ,
const char *  ,
int   
)

◆ _db_lock_file_()

void _db_lock_file_ ( void  )

◆ _db_pargs_()

void _db_pargs_ ( unsigned int  _line_,
const char *  keyword 
)

◆ _db_pop_()

void _db_pop_ ( void  )

◆ _db_process_()

void _db_process_ ( const char *  name)

◆ _db_push_()

void _db_push_ ( const char *  control)

◆ _db_return_()

void _db_return_ ( unsigned int  _line_,
struct _db_stack_frame_ _stack_frame_ 
)

◆ _db_set_()

void _db_set_ ( const char *  control)

◆ _db_set_init_()

void _db_set_init_ ( const char *  control)

◆ _db_suicide_()

void _db_suicide_ ( )

◆ _db_unlock_file_()

void _db_unlock_file_ ( void  )

◆ dump_trace()

void dump_trace ( )