Loading .bzrignore +1 −0 Original line number Diff line number Diff line Loading @@ -923,3 +923,4 @@ Docs/Images/mydsn-trace.txt Docs/Images/mydsn.txt Docs/Images/myflowchart.txt mysql-test/mysql_test_run_new ndb/tools/ndb_test_platform dbug/dbug.c +41 −15 Original line number Diff line number Diff line Loading @@ -227,14 +227,15 @@ static my_bool init_done = FALSE; /* Set to TRUE when initialization done */ static struct state *stack=0; typedef struct st_code_state { int lineno; /* Current debugger output line number */ int level; /* Current function nesting level */ const char *func; /* Name of current user function */ const char *file; /* Name of current user file */ char **framep; /* Pointer to current frame */ int jmplevel; /* Remember nesting level at setjmp () */ const char *jmpfunc; /* Remember current function for setjmp */ const char *jmpfile; /* Remember current file for setjmp */ int lineno; /* Current debugger output line number */ int level; /* Current function nesting level */ int disable_output; /* Set to it if output is disabled */ int jmplevel; /* Remember nesting level at setjmp () */ /* * The following variables are used to hold the state information Loading @@ -247,8 +248,8 @@ typedef struct st_code_state { */ uint u_line; /* User source code line number */ const char *u_keyword; /* Keyword for current macro */ int locked; /* If locked with _db_lock_file */ const char *u_keyword; /* Keyword for current macro */ } CODE_STATE; /* Parse a debug command string */ Loading Loading @@ -370,8 +371,10 @@ static CODE_STATE *code_state(void) #define code_state() (&static_code_state) #define pthread_mutex_lock(A) {} #define pthread_mutex_unlock(A) {} static CODE_STATE static_code_state = { 0,0,"?func","?file",NULL,0,NULL, NULL,0,"?",0}; static CODE_STATE static_code_state= { "?func", "?file", NULL, NullS, NullS, 0,0,0,0,0,0, NullS }; #endif Loading Loading @@ -728,9 +731,12 @@ char ***_sframep_ __attribute__((unused))) if (DoProfile ()) { long stackused; if (*state->framep == NULL) { if (*state->framep == NULL) { stackused = 0; } else { } else { stackused = ((long)(*state->framep)) - ((long)(state->framep)); stackused = stackused > 0 ? stackused : -stackused; } Loading @@ -754,7 +760,7 @@ char ***_sframep_ __attribute__((unused))) dbug_flush (state); /* This does a unlock */ } #ifdef SAFEMALLOC if (stack -> flags & SANITY_CHECK_ON) if (stack->flags & SANITY_CHECK_ON && !state->disable_output) if (_sanity(_file_,_line_)) /* Check of safemalloc */ stack -> flags &= ~SANITY_CHECK_ON; #endif Loading Loading @@ -809,9 +815,11 @@ uint *_slevel_) else { #ifdef SAFEMALLOC if (stack -> flags & SANITY_CHECK_ON) if (stack->flags & SANITY_CHECK_ON && !state->disable_output) { if (_sanity(*_sfile_,_line_)) stack->flags &= ~SANITY_CHECK_ON; } #endif #ifndef THREAD if (DoProfile ()) Loading Loading @@ -954,7 +962,6 @@ uint length) int pos; char dbuff[90]; CODE_STATE *state; /* Sasha: pre-my_thread_init() safety */ if (!(state=code_state())) return; Loading Loading @@ -994,6 +1001,25 @@ uint length) } } /* Enable/Disable output for this thread SYNOPSIS _db_output_() flag 1 = enable output, 0 = disable_output */ void _db_output_(uint flag) { CODE_STATE *state; if (!(state=code_state())) return; state->disable_output= !flag; } /* * FUNCTION * Loading Loading @@ -1159,7 +1185,7 @@ static BOOLEAN DoTrace (CODE_STATE *state) { reg2 BOOLEAN trace=FALSE; if (TRACING && if (TRACING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> functions, state->func) && InList (stack -> processes, _db_process_)) Loading Loading @@ -1195,7 +1221,7 @@ static BOOLEAN DoProfile () state=code_state(); profile = FALSE; if (PROFILING && if (PROFILING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> p_functions, state->func) && InList (stack -> processes, _db_process_)) Loading Loading @@ -1242,7 +1268,7 @@ const char *keyword) if (!(state=code_state())) return FALSE; result = FALSE; if (DEBUGGING && if (DEBUGGING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> functions, state->func) && InList (stack -> keywords, keyword) && Loading include/my_dbug.h +3 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); extern void _db_output_(); extern void _db_lock_file(); extern void _db_unlock_file(); Loading Loading @@ -66,6 +67,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON _no_db_=0 #define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); } #define DBUG_OUTPUT(A) { _db_output_(A); } #define DBUG_ASSERT(A) assert(A) #else /* No debugger */ Loading @@ -86,6 +88,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON #define DBUG_LOCK_FILE #define DBUG_UNLOCK_FILE #define DBUG_OUTPUT(A) #define DBUG_ASSERT(A) {} #endif #ifdef __cplusplus Loading include/my_global.h +6 −0 Original line number Diff line number Diff line Loading @@ -370,6 +370,12 @@ int __void__; #define LINT_INIT(var) #endif #if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify) #define PURIFY_OR_LINT_INIT(var) var=0 #else #define PURIFY_OR_LINT_INIT(var) #endif /* Define some useful general macros */ #if defined(__cplusplus) && defined(__GNUC__) #define max(a, b) ((a) >? (b)) Loading include/my_sys.h +1 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,7 @@ extern ulong my_cache_w_requests, my_cache_write, my_cache_r_requests, my_cache_read; extern ulong my_blocks_used, my_blocks_changed; extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; extern uint mysys_usage_id; extern my_bool my_init_done; /* Point to current my_message() */ Loading Loading
.bzrignore +1 −0 Original line number Diff line number Diff line Loading @@ -923,3 +923,4 @@ Docs/Images/mydsn-trace.txt Docs/Images/mydsn.txt Docs/Images/myflowchart.txt mysql-test/mysql_test_run_new ndb/tools/ndb_test_platform
dbug/dbug.c +41 −15 Original line number Diff line number Diff line Loading @@ -227,14 +227,15 @@ static my_bool init_done = FALSE; /* Set to TRUE when initialization done */ static struct state *stack=0; typedef struct st_code_state { int lineno; /* Current debugger output line number */ int level; /* Current function nesting level */ const char *func; /* Name of current user function */ const char *file; /* Name of current user file */ char **framep; /* Pointer to current frame */ int jmplevel; /* Remember nesting level at setjmp () */ const char *jmpfunc; /* Remember current function for setjmp */ const char *jmpfile; /* Remember current file for setjmp */ int lineno; /* Current debugger output line number */ int level; /* Current function nesting level */ int disable_output; /* Set to it if output is disabled */ int jmplevel; /* Remember nesting level at setjmp () */ /* * The following variables are used to hold the state information Loading @@ -247,8 +248,8 @@ typedef struct st_code_state { */ uint u_line; /* User source code line number */ const char *u_keyword; /* Keyword for current macro */ int locked; /* If locked with _db_lock_file */ const char *u_keyword; /* Keyword for current macro */ } CODE_STATE; /* Parse a debug command string */ Loading Loading @@ -370,8 +371,10 @@ static CODE_STATE *code_state(void) #define code_state() (&static_code_state) #define pthread_mutex_lock(A) {} #define pthread_mutex_unlock(A) {} static CODE_STATE static_code_state = { 0,0,"?func","?file",NULL,0,NULL, NULL,0,"?",0}; static CODE_STATE static_code_state= { "?func", "?file", NULL, NullS, NullS, 0,0,0,0,0,0, NullS }; #endif Loading Loading @@ -728,9 +731,12 @@ char ***_sframep_ __attribute__((unused))) if (DoProfile ()) { long stackused; if (*state->framep == NULL) { if (*state->framep == NULL) { stackused = 0; } else { } else { stackused = ((long)(*state->framep)) - ((long)(state->framep)); stackused = stackused > 0 ? stackused : -stackused; } Loading @@ -754,7 +760,7 @@ char ***_sframep_ __attribute__((unused))) dbug_flush (state); /* This does a unlock */ } #ifdef SAFEMALLOC if (stack -> flags & SANITY_CHECK_ON) if (stack->flags & SANITY_CHECK_ON && !state->disable_output) if (_sanity(_file_,_line_)) /* Check of safemalloc */ stack -> flags &= ~SANITY_CHECK_ON; #endif Loading Loading @@ -809,9 +815,11 @@ uint *_slevel_) else { #ifdef SAFEMALLOC if (stack -> flags & SANITY_CHECK_ON) if (stack->flags & SANITY_CHECK_ON && !state->disable_output) { if (_sanity(*_sfile_,_line_)) stack->flags &= ~SANITY_CHECK_ON; } #endif #ifndef THREAD if (DoProfile ()) Loading Loading @@ -954,7 +962,6 @@ uint length) int pos; char dbuff[90]; CODE_STATE *state; /* Sasha: pre-my_thread_init() safety */ if (!(state=code_state())) return; Loading Loading @@ -994,6 +1001,25 @@ uint length) } } /* Enable/Disable output for this thread SYNOPSIS _db_output_() flag 1 = enable output, 0 = disable_output */ void _db_output_(uint flag) { CODE_STATE *state; if (!(state=code_state())) return; state->disable_output= !flag; } /* * FUNCTION * Loading Loading @@ -1159,7 +1185,7 @@ static BOOLEAN DoTrace (CODE_STATE *state) { reg2 BOOLEAN trace=FALSE; if (TRACING && if (TRACING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> functions, state->func) && InList (stack -> processes, _db_process_)) Loading Loading @@ -1195,7 +1221,7 @@ static BOOLEAN DoProfile () state=code_state(); profile = FALSE; if (PROFILING && if (PROFILING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> p_functions, state->func) && InList (stack -> processes, _db_process_)) Loading Loading @@ -1242,7 +1268,7 @@ const char *keyword) if (!(state=code_state())) return FALSE; result = FALSE; if (DEBUGGING && if (DEBUGGING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> functions, state->func) && InList (stack -> keywords, keyword) && Loading
include/my_dbug.h +3 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); extern void _db_output_(); extern void _db_lock_file(); extern void _db_unlock_file(); Loading Loading @@ -66,6 +67,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON _no_db_=0 #define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); } #define DBUG_OUTPUT(A) { _db_output_(A); } #define DBUG_ASSERT(A) assert(A) #else /* No debugger */ Loading @@ -86,6 +88,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON #define DBUG_LOCK_FILE #define DBUG_UNLOCK_FILE #define DBUG_OUTPUT(A) #define DBUG_ASSERT(A) {} #endif #ifdef __cplusplus Loading
include/my_global.h +6 −0 Original line number Diff line number Diff line Loading @@ -370,6 +370,12 @@ int __void__; #define LINT_INIT(var) #endif #if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify) #define PURIFY_OR_LINT_INIT(var) var=0 #else #define PURIFY_OR_LINT_INIT(var) #endif /* Define some useful general macros */ #if defined(__cplusplus) && defined(__GNUC__) #define max(a, b) ((a) >? (b)) Loading
include/my_sys.h +1 −0 Original line number Diff line number Diff line Loading @@ -214,6 +214,7 @@ extern ulong my_cache_w_requests, my_cache_write, my_cache_r_requests, my_cache_read; extern ulong my_blocks_used, my_blocks_changed; extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; extern uint mysys_usage_id; extern my_bool my_init_done; /* Point to current my_message() */ Loading