MySQL 9.1.0
Source Code Documentation
|
#include "my_config.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include <algorithm>
#include "dig_vec.h"
#include "m_string.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_macros.h"
#include "my_sys.h"
#include "my_thread_local.h"
#include "mysql/strings/int2str.h"
#include "nulls.h"
#include "thr_mutex.h"
#include "thr_rwlock.h"
#include <fnmatch.h>
#include <signal.h>
Classes | |
struct | link |
struct | settings |
struct | CODE_STATE |
Macros | |
#define | INDENT 2 /* Indentation per trace level */ |
#define | MAXDEPTH 200 /* Maximum trace depth default */ |
#define | DEBUG_ON (1 << 1) /* Debug enabled */ |
#define | FILE_ON (1 << 2) /* File name print enabled */ |
#define | LINE_ON (1 << 3) /* Line number print enabled */ |
#define | DEPTH_ON (1 << 4) /* Function nest level print enabled */ |
#define | PROCESS_ON (1 << 5) /* Process name print enabled */ |
#define | NUMBER_ON (1 << 6) /* Number each line of output */ |
#define | PROFILE_ON (1 << 7) /* Print out profiling code */ |
#define | PID_ON (1 << 8) /* Identify each line with process id */ |
#define | TIMESTAMP_ON (1 << 9) /* timestamp every line of output */ |
#define | FLUSH_ON_WRITE (1 << 10) /* Flush on every write */ |
#define | OPEN_APPEND (1 << 11) /* Open for append */ |
#define | TRACE_ON ((uint)1 << 31) /* Trace enabled. MUST be the highest bit!*/ |
#define | TRACING (cs->stack->flags & TRACE_ON) |
#define | DEBUGGING (cs->stack->flags & DEBUG_ON) |
#define | PROFILING (cs->stack->flags & PROFILE_ON) |
#define | SUBDIR 1 /* this MUST be 1 */ |
#define | INCLUDE 2 |
#define | EXCLUDE 4 |
#define | MATCHED 65536 |
#define | NOT_MATCHED 0 |
#define | is_shared(S, V) ((S)->next && (S)->next->V == (S)->V) |
#define | get_code_state_if_not_set_or_return if (!cs && !((cs = code_state()))) return |
#define | get_code_state_or_return if (!((cs = code_state()))) return |
#define | ListAdd(A, B, C) ListAddDel(A, B, C, INCLUDE) |
#define | ListDel(A, B, C) ListAddDel(A, B, C, EXCLUDE) |
#define | DO_TRACE 1 |
#define | DONT_TRACE 2 |
#define | ENABLE_TRACE 3 |
#define | DISABLE_TRACE 4 |
#define | ERR_MISSING_RETURN "missing DBUG_RETURN or DBUG_VOID_RETURN macro in function \"%s\"\n" |
#define | ERR_MISSING_UNLOCK "missing DBUG_UNLOCK_FILE macro in function \"%s\"\n" |
#define | ERR_OPEN "%s: can't open debug output stream \"%s\": " |
#define | ERR_CLOSE "%s: can't close debug file: " |
#define | ERR_ABORT "%s: debugger aborting because %s\n" |
#define | Delay(A) sleep(((uint)A) / 10) |
#define | framep_trace_flag(cs, frp) |
#define | fflags(cs) cs->stack->out_file ? ListFlags(cs->stack->functions) : TRACE_ON; |
#define | char_to_buf(C) |
#define | str_to_buf(S) |
#define | list_to_buf(l, f) |
#define | int_to_buf(i) |
#define | colon_to_buf |
#define | op_int_to_buf(C, val, def) |
#define | op_intf_to_buf(C, val, def, cond) |
#define | op_str_to_buf(C, val, cond) |
#define | op_list_to_buf(C, val, cond) |
#define | op_bool_to_buf(C, cond) |
Functions | |
static struct link * | ListAddDel (struct link *, const char *, const char *, int) |
static struct link * | ListCopy (struct link *) |
static int | InList (struct link *linkp, const char *cp) |
static uint | ListFlags (struct link *linkp) |
static void | FreeList (struct link *linkp) |
static int | isseparator (const char *ptr) |
static void | DBUGOpenFile (CODE_STATE *, const char *, const char *, int) |
static void | DBUGCloseFile (CODE_STATE *cs, FILE *fp) |
static void | PushState (CODE_STATE *cs) |
static void | FreeState (CODE_STATE *cs, struct settings *state, int free_state) |
static int | DoTrace (CODE_STATE *cs) |
static void | DoPrefix (CODE_STATE *cs, uint line) |
static bool | Writable (const char *pathname) |
static char * | DbugMalloc (size_t size) |
static const char * | BaseName (const char *pathname) |
static void | Indent (CODE_STATE *cs, int indent) |
static void | DbugFlush (CODE_STATE *) |
static void | DbugExit (const char *why) |
static const char * | DbugStrTok (const char *s) |
static void | DbugVfprintf (FILE *stream, const char *format, va_list args) |
static CODE_STATE * | code_state (void) |
static void | read_lock_stack (CODE_STATE *cs) |
Lock the stack debugging settings. More... | |
static void | unlock_stack (CODE_STATE *cs) |
Unlock the stack debugging settings. More... | |
void | _db_process_ (const char *name) |
static int | DbugParse (CODE_STATE *cs, const char *control) |
static void | FixTraceFlags_helper (CODE_STATE *cs, const char *func, struct _db_stack_frame_ *framep) |
static void | FixTraceFlags (uint old_fflags, CODE_STATE *cs) |
void | _db_set_ (const char *control) |
void | _db_push_ (const char *control) |
int | _db_is_pushed_ () |
Returns true if session-local settings have been set. More... | |
void | _db_set_init_ (const char *control) |
void | _db_pop_ () |
int | _db_explain_ (CODE_STATE *cs, char *buf, size_t len) |
int | _db_explain_init_ (char *buf, size_t len) |
void | _db_enter_ (const char *_func_, int func_len, const char *_file_, uint _line_, struct _db_stack_frame_ *_stack_frame_) |
void | _db_return_ (uint _line_, struct _db_stack_frame_ *_stack_frame_) |
void | _db_pargs_ (uint _line_, const char *keyword) |
int | _db_enabled_ () |
void | _db_doprnt_ (const char *format,...) |
void | _db_dump_ (uint _line_, const char *keyword, const unsigned char *memory, size_t length) |
void | _db_end_ () |
FILE * | _db_fp_ (void) |
int | _db_keyword_ (CODE_STATE *cs, const char *keyword, int strict) |
void | _db_flush_ () |
void | _db_flush_gcov_ () |
void | _db_suicide_ () |
void | _db_lock_file_ () |
void | _db_unlock_file_ () |
Variables | |
static bool | init_done = false |
static struct settings | init_settings |
Global debugging settings. More... | |
static const char * | db_process = nullptr |
static native_mutex_t | THR_LOCK_dbug |
static native_mutex_t | THR_LOCK_gcov |
A mutex protecting flushing of gcov data, see db_flush_gcov(). More... | |
static native_rw_lock_t | THR_LOCK_init_settings |
Lock, to protect init_settings . More... | |
#define char_to_buf | ( | C | ) |
#define colon_to_buf |
#define DEBUG_ON (1 << 1) /* Debug enabled */ |
#define Delay | ( | A | ) | sleep(((uint)A) / 10) |
#define DEPTH_ON (1 << 4) /* Function nest level print enabled */ |
#define DISABLE_TRACE 4 |
#define DO_TRACE 1 |
#define DONT_TRACE 2 |
#define ENABLE_TRACE 3 |
#define ERR_ABORT "%s: debugger aborting because %s\n" |
#define ERR_CLOSE "%s: can't close debug file: " |
#define ERR_MISSING_RETURN "missing DBUG_RETURN or DBUG_VOID_RETURN macro in function \"%s\"\n" |
#define ERR_MISSING_UNLOCK "missing DBUG_UNLOCK_FILE macro in function \"%s\"\n" |
#define ERR_OPEN "%s: can't open debug output stream \"%s\": " |
#define EXCLUDE 4 |
#define FLUSH_ON_WRITE (1 << 10) /* Flush on every write */ |
#define framep_trace_flag | ( | cs, | |
frp | |||
) |
#define get_code_state_if_not_set_or_return if (!cs && !((cs = code_state()))) return |
#define get_code_state_or_return if (!((cs = code_state()))) return |
#define INCLUDE 2 |
#define INDENT 2 /* Indentation per trace level */ |
#define int_to_buf | ( | i | ) |
#define is_shared | ( | S, | |
V | |||
) | ((S)->next && (S)->next->V == (S)->V) |
#define LINE_ON (1 << 3) /* Line number print enabled */ |
#define list_to_buf | ( | l, | |
f | |||
) |
#define ListAdd | ( | A, | |
B, | |||
C | |||
) | ListAddDel(A, B, C, INCLUDE) |
#define ListDel | ( | A, | |
B, | |||
C | |||
) | ListAddDel(A, B, C, EXCLUDE) |
#define MATCHED 65536 |
#define MAXDEPTH 200 /* Maximum trace depth default */ |
#define NOT_MATCHED 0 |
#define NUMBER_ON (1 << 6) /* Number each line of output */ |
#define op_bool_to_buf | ( | C, | |
cond | |||
) |
#define op_int_to_buf | ( | C, | |
val, | |||
def | |||
) |
#define op_intf_to_buf | ( | C, | |
val, | |||
def, | |||
cond | |||
) |
#define op_list_to_buf | ( | C, | |
val, | |||
cond | |||
) |
#define op_str_to_buf | ( | C, | |
val, | |||
cond | |||
) |
#define OPEN_APPEND (1 << 11) /* Open for append */ |
#define PID_ON (1 << 8) /* Identify each line with process id */ |
#define PROFILE_ON (1 << 7) /* Print out profiling code */ |
#define PROFILING (cs->stack->flags & PROFILE_ON) |
#define str_to_buf | ( | S | ) |
#define SUBDIR 1 /* this MUST be 1 */ |
#define TIMESTAMP_ON (1 << 9) /* timestamp every line of output */ |
#define TRACE_ON ((uint)1 << 31) /* Trace enabled. MUST be the highest bit!*/ |
void _db_doprnt_ | ( | const char * | format, |
... | |||
) |
void _db_dump_ | ( | uint | _line_, |
const char * | keyword, | ||
const unsigned char * | memory, | ||
size_t | length | ||
) |
int _db_enabled_ | ( | ) |
void _db_end_ | ( | void | ) |
void _db_enter_ | ( | const char * | _func_, |
int | func_len, | ||
const char * | _file_, | ||
uint | _line_, | ||
struct _db_stack_frame_ * | _stack_frame_ | ||
) |
int _db_explain_ | ( | CODE_STATE * | cs, |
char * | buf, | ||
size_t | len | ||
) |
int _db_explain_init_ | ( | char * | buf, |
size_t | len | ||
) |
void _db_flush_ | ( | ) |
void _db_flush_gcov_ | ( | ) |
FILE * _db_fp_ | ( | void | ) |
int _db_is_pushed_ | ( | void | ) |
Returns true if session-local settings have been set.
int _db_keyword_ | ( | CODE_STATE * | cs, |
const char * | keyword, | ||
int | strict | ||
) |
void _db_lock_file_ | ( | void | ) |
void _db_pargs_ | ( | uint | _line_, |
const char * | keyword | ||
) |
void _db_pop_ | ( | void | ) |
void _db_process_ | ( | const char * | name | ) |
void _db_push_ | ( | const char * | control | ) |
void _db_return_ | ( | uint | _line_, |
struct _db_stack_frame_ * | _stack_frame_ | ||
) |
void _db_set_ | ( | const char * | control | ) |
void _db_set_init_ | ( | const char * | control | ) |
void _db_suicide_ | ( | ) |
void _db_unlock_file_ | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
Lock the stack debugging settings.
Only the shared (global) settings are locked if necessary, per thread settings are local and safe to use. This lock is re entrant.
|
static |
Unlock the stack debugging settings.
|
static |
|
static |
|
static |
|
static |
Global debugging settings.
This structure shared between all threads, and is the last element in each thread CODE_STATE::stack
chain. Protected by THR_LOCK_init_settings
.
|
static |
|
static |
A mutex protecting flushing of gcov data, see db_flush_gcov().
We don't re-use THR_LOCK_dbug, because that would disallow: DBUG_LOCK_FILE; ..... DBUG_SUICIDE(); .... DBUG_UNLOCK_FILE;
|
static |
Lock, to protect init_settings
.
For performance reasons, the member init_settings.flags
is not protected.