MySQL  8.0.20
Source Code Documentation
gcs_debug.h File Reference

Go to the source code of this file.

Macros

#define TASK_DBUG_ON   0
 
#define TX_FMT   "{" SY_FMT_DEF " %lu}"
 
#define TX_MEM(x)   SY_MEM((x).cfg), (x).pc
 
#define STR_SIZE   2047
 
#define GET_GOUT
 
#define GET_NEW_GOUT
 
#define FREE_GOUT   xcom_log_buffer[0] = 0
 
#define ADD_GOUT(s)   xcom_temp_buf = mystrcat(xcom_temp_buf, &xcom_log_buffer_size, s)
 
#define COPY_AND_FREE_GOUT(s)
 
#define ADD_F_GOUT(...)
 
#define PRINT_LOUT(level)   xcom_log(level, xcom_log_buffer)
 
#define PRINT_GOUT   xcom_debug("%s", xcom_log_buffer)
 
#define RET_GOUT   return xcom_log_buffer
 
#define G_LOG_LEVEL(level, ...)
 
#define G_DEBUG_LEVEL(level, ...)
 
#define g_critical(...)   G_LOG_LEVEL(XCOM_LOG_FATAL, __VA_ARGS__)
 
#define G_ERROR(...)   G_LOG_LEVEL(XCOM_LOG_ERROR, __VA_ARGS__)
 
#define G_WARNING(...)   G_LOG_LEVEL(XCOM_LOG_WARN, __VA_ARGS__)
 
#define G_MESSAGE(...)   G_LOG_LEVEL(XCOM_LOG_INFO, __VA_ARGS__)
 
#define G_INFO(...)   G_LOG_LEVEL(XCOM_LOG_INFO, __VA_ARGS__)
 
#define G_DEBUG(...)   G_DEBUG_LEVEL(XCOM_DEBUG_BASIC | XCOM_DEBUG_TRACE, __VA_ARGS__)
 
#define G_TRACE(...)   G_DEBUG_LEVEL(XCOM_DEBUG_TRACE, __VA_ARGS__)
 
#define IS_XCOM_DEBUG_WITH(level)   xcom_debug_check(level)
 
#define DBGOHK(x)
 
#define DBGOUT(x)
 
#define MAY_DBG(x)
 
#define XDBG   #error
 
#define FN
 
#define PTREXP(x)   ADD_F_GOUT(#x ": %p ", (void *)(x))
 
#define PPUT(x)   ADD_F_GOUT("0x%p ", (void *)(x))
 
#define STREXP(x)   ADD_F_GOUT(#x ": %s ", x)
 
#define STRLIT(x)   ADD_GOUT(x)
 
#define NPUT(x, f)   ADD_F_GOUT("%" #f " ", x)
 
#define NDBG(x, f)
 
#define NDBG64(x)
 
#define NPUT64(x)   ADD_F_GOUT("%" PRIu64 " ", x)
 
#define NEXP(x, f)   ADD_F_GOUT(#x ": %" #f " ", x)
 
#define NUMEXP(x)   NEXP(x, d)
 
#define g_strerror   strerror
 
#define LOUT(pri, x)   ADD_F_GOUT(x);
 
#define SYCEXP(exp)
 
#define TIDCEXP(exp)
 
#define TIMECEXP(exp)   ADD_F_GOUT(#exp "=%f sec ", (exp))
 
#define BALCEXP(exp)   ADD_F_GOUT(#exp "={%d %d} ", (exp).cnt, (exp).node)
 

Functions

double task_now ()
 
void xcom_default_log (const int64_t l, const char *msg)
 Prints the logging messages to the console. More...
 
void xcom_default_debug (const char *format,...)
 Prints the logging messages to the console. More...
 
int xcom_default_debug_check (const int64_t options)
 Check whether a set of debug and trace options are enabled. More...
 
char * mystrcat (char *dest, int *size, const char *src)
 Concatenates two strings and returns pointer to last character of final string, allowing further concatenations without having to cycle through the entire string again. More...
 
char * mystrcat_sprintf (char *dest, int *size, const char *format,...)
 This function allocates a new string where the format string and optional arguments are rendered to. More...
 

Variables

xcom_logger xcom_log
 Callbacks used in the logging macros. More...
 
xcom_debugger xcom_debug
 
xcom_debugger_check xcom_debug_check
 
int64_t xcom_debug_options
 Define the set of debug and trace options that are enabled if there is no debugger check injected. More...
 

Macro Definition Documentation

◆ ADD_F_GOUT

#define ADD_F_GOUT (   ...)
Value:
xcom_temp_buf = \
mystrcat_sprintf(xcom_temp_buf, &xcom_log_buffer_size, __VA_ARGS__)

◆ ADD_GOUT

#define ADD_GOUT (   s)    xcom_temp_buf = mystrcat(xcom_temp_buf, &xcom_log_buffer_size, s)

◆ BALCEXP

#define BALCEXP (   exp)    ADD_F_GOUT(#exp "={%d %d} ", (exp).cnt, (exp).node)

◆ COPY_AND_FREE_GOUT

#define COPY_AND_FREE_GOUT (   s)
Value:
{ \
char *__funny = s; \
ADD_GOUT(__funny); \
free(__funny); \
}

◆ DBGOHK

#define DBGOHK (   x)
Value:
do { \
} while (0)

◆ DBGOUT

#define DBGOUT (   x)
Value:
do { \
} while (0)

◆ FN

#define FN
Value:
ADD_GOUT(__func__); \
ADD_F_GOUT(" " __FILE__ ":%d ", __LINE__)
#define ADD_GOUT(s)
Definition: gcs_debug.h:129

◆ FREE_GOUT

#define FREE_GOUT   xcom_log_buffer[0] = 0

◆ g_critical

#define g_critical (   ...)    G_LOG_LEVEL(XCOM_LOG_FATAL, __VA_ARGS__)

◆ G_DEBUG

#define G_DEBUG (   ...)    G_DEBUG_LEVEL(XCOM_DEBUG_BASIC | XCOM_DEBUG_TRACE, __VA_ARGS__)

◆ G_DEBUG_LEVEL

#define G_DEBUG_LEVEL (   level,
  ... 
)
Value:
{ \
if (IS_XCOM_DEBUG_WITH(level)) { \
xcom_debug(__VA_ARGS__); \
} \
}
#define IS_XCOM_DEBUG_WITH(level)
Definition: gcs_debug.h:179

◆ G_ERROR

#define G_ERROR (   ...)    G_LOG_LEVEL(XCOM_LOG_ERROR, __VA_ARGS__)

◆ G_INFO

#define G_INFO (   ...)    G_LOG_LEVEL(XCOM_LOG_INFO, __VA_ARGS__)

◆ G_LOG_LEVEL

#define G_LOG_LEVEL (   level,
  ... 
)
Value:
{ \
GET_GOUT; \
ADD_F_GOUT(__VA_ARGS__); \
PRINT_LOUT(level); \
FREE_GOUT; \
}

◆ G_MESSAGE

#define G_MESSAGE (   ...)    G_LOG_LEVEL(XCOM_LOG_INFO, __VA_ARGS__)

◆ g_strerror

#define g_strerror   strerror

◆ G_TRACE

#define G_TRACE (   ...)    G_DEBUG_LEVEL(XCOM_DEBUG_TRACE, __VA_ARGS__)

◆ G_WARNING

#define G_WARNING (   ...)    G_LOG_LEVEL(XCOM_LOG_WARN, __VA_ARGS__)

◆ GET_GOUT

#define GET_GOUT
Value:
char xcom_log_buffer[STR_SIZE + 1]; \
char *xcom_temp_buf = xcom_log_buffer; \
int xcom_log_buffer_size = 0; \
xcom_log_buffer[0] = 0
#define STR_SIZE
Definition: gcs_debug.h:116

◆ GET_NEW_GOUT

#define GET_NEW_GOUT
Value:
char *xcom_log_buffer = (char *)malloc((STR_SIZE + 1) * sizeof(char)); \
char *xcom_temp_buf = xcom_log_buffer; \
int xcom_log_buffer_size = 0; \
xcom_log_buffer[0] = 0
#define malloc(A)
Definition: fts0ast.h:41
#define STR_SIZE
Definition: gcs_debug.h:116

◆ IS_XCOM_DEBUG_WITH

#define IS_XCOM_DEBUG_WITH (   level)    xcom_debug_check(level)

◆ LOUT

#define LOUT (   pri,
 
)    ADD_F_GOUT(x);

◆ MAY_DBG

#define MAY_DBG (   x)
Value:
do { \
} while (0)

◆ NDBG

#define NDBG (   x,
 
)
Value:
ADD_F_GOUT(#x " = "); \
NPUT(x, f)
#define ADD_F_GOUT(...)
Definition: gcs_debug.h:137

◆ NDBG64

#define NDBG64 (   x)
Value:
ADD_F_GOUT(#x " = "); \
NPUT64(x);
#define ADD_F_GOUT(...)
Definition: gcs_debug.h:137

◆ NEXP

#define NEXP (   x,
 
)    ADD_F_GOUT(#x ": %" #f " ", x)

◆ NPUT

#define NPUT (   x,
 
)    ADD_F_GOUT("%" #f " ", x)

◆ NPUT64

#define NPUT64 (   x)    ADD_F_GOUT("%" PRIu64 " ", x)

◆ NUMEXP

#define NUMEXP (   x)    NEXP(x, d)

◆ PPUT

#define PPUT (   x)    ADD_F_GOUT("0x%p ", (void *)(x))

◆ PRINT_GOUT

#define PRINT_GOUT   xcom_debug("%s", xcom_log_buffer)

◆ PRINT_LOUT

#define PRINT_LOUT (   level)    xcom_log(level, xcom_log_buffer)

◆ PTREXP

#define PTREXP (   x)    ADD_F_GOUT(#x ": %p ", (void *)(x))

◆ RET_GOUT

#define RET_GOUT   return xcom_log_buffer

◆ STR_SIZE

#define STR_SIZE   2047

◆ STREXP

#define STREXP (   x)    ADD_F_GOUT(#x ": %s ", x)

◆ STRLIT

#define STRLIT (   x)    ADD_GOUT(x)

◆ SYCEXP

#define SYCEXP (   exp)
Value:
ADD_F_GOUT(#exp "={%x %" PRIu64 " %u} ", (exp).group_id, ((exp).msgno), \
((exp).node))
#define ADD_F_GOUT(...)
Definition: gcs_debug.h:137

◆ TASK_DBUG_ON

#define TASK_DBUG_ON   0

◆ TIDCEXP

#define TIDCEXP (   exp)
Value:
ADD_F_GOUT(#exp "={%x %" PRIu64 " %u %u} ", (exp).cfg.group_id, \
(exp).cfg.msgno, (exp).cfg.node, (exp).pc)
#define ADD_F_GOUT(...)
Definition: gcs_debug.h:137

◆ TIMECEXP

#define TIMECEXP (   exp)    ADD_F_GOUT(#exp "=%f sec ", (exp))

◆ TX_FMT

#define TX_FMT   "{" SY_FMT_DEF " %lu}"

◆ TX_MEM

#define TX_MEM (   x)    SY_MEM((x).cfg), (x).pc

◆ XDBG

#define XDBG   #error

Function Documentation

◆ mystrcat()

char* mystrcat ( char *  dest,
int *  size,
const char *  src 
)

Concatenates two strings and returns pointer to last character of final string, allowing further concatenations without having to cycle through the entire string again.

Parameters
destpointer to last character of destination string
sizepointer to the number of characters currently added to xcom_log_buffer
srcpointer to the string to append to dest
Returns
pointer to the last character of destination string after appending dest, which corresponds to the position of the '\0' character

◆ mystrcat_sprintf()

char* mystrcat_sprintf ( char *  dest,
int *  size,
const char *  format,
  ... 
)

This function allocates a new string where the format string and optional arguments are rendered to.

Finally, it invokes mystr_cat to concatenate the rendered string to the string received in the first parameter.

◆ task_now()

double task_now ( )

◆ xcom_default_debug()

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

Prints the logging messages to the console.

It is invoked when no debugger callback was set by an upper layer.

Prints the logging messages to the console.

It is invoked when no debugger callback was set by an upper layer.

◆ xcom_default_debug_check()

int xcom_default_debug_check ( const int64_t  debug_options)

Check whether a set of debug and trace options are enabled.

It is invoked when no debugger callback was set by an upper layer.

Check whether a set of debug and trace options are enabled.

◆ xcom_default_log()

void xcom_default_log ( const int64_t  l,
const char *  msg 
)

Prints the logging messages to the console.

It is invoked when no logger callback was set by an upper layer.

Variable Documentation

◆ xcom_debug

xcom_debugger xcom_debug

◆ xcom_debug_check

xcom_debugger_check xcom_debug_check

◆ xcom_debug_options

int64_t xcom_debug_options

Define the set of debug and trace options that are enabled if there is no debugger check injected.

◆ xcom_log

xcom_logger xcom_log

Callbacks used in the logging macros.