mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
dbug changes:
1. dbug state is now local to a thread 2. new macros: DBUG_EXPLAIN, DBUG_EXPLAIN_INITIAL, DBUG_SET, DBUG_SET_INITIAL, DBUG_EVALUATE, DBUG_EVALUATE_IF 3. macros are do{}while(0) wrapped 4. incremental modifications to the dbug state (e.g. "+d,info:-t") 5. dbug code cleanup, style fixes 6. _db_on_ and DEBUGGER_ON/OFF removed 7. rest of MySQL code fixed because of 3 (missing ;) and 6 8. dbug manual updated 9. server variable @@debug (global and local) to control dbug from SQL! a. -#T to print timestamps in the log BitKeeper/deleted/.del-readme.prof~2f3bae1550a0038d: Delete: dbug/readme.prof client/mysqlslap.c: typo fixed configure.in: test for sleep() too dbug/dbug.c: thread local dbug settings DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL style changes to be more in line with MySQL code cleanup (many mallocs removed) incremental modification of dbug state (e.g. DBUG_PUSH("+t:-d,info")) DBUG_SET, _db_explain_ -#T dbug/monty.doc: obsolete and duplicate docs removed dbug/user.r: new features documented include/my_dbug.h: correct do{}while wrapping thread local dbug settings DBUG_EXPLAIN,DBUG_EXPLAIN_INITIAL,DBUG_SET,DBUG_SET_INITIAL DBUG_EVALUATE,DBUG_EVALUATE_IF libmysql/libmysql.c: remove _db_on_ and DEBUGGER_ON/OFF mysys/my_init.c: missed DBUG_RETURN mysys/my_thr_init.c: bugfix - transaction id's are unsigned mysys/testhash.c: remove _db_on_ and DEBUGGER_ON/OFF sql/ha_myisammrg.cc: missed ; sql/ha_ndbcluster.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; sql/ha_ndbcluster_binlog.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; sql/item_cmpfunc.cc: missed ; sql/lock.cc: missed DBUG_RETURN sql/log_event.cc: missed ; sql/mysqld.cc: remove _db_on_ and DEBUGGER_ON/OFF missed ; DBUG_SET_INITIAL sql/opt_range.cc: remove _db_on_ and DEBUGGER_ON/OFF sql/set_var.cc: class sys_var_thd_dbug and "debug" server variable sql/set_var.h: class sys_var_thd_dbug and "debug" server variable sql/slave.cc: missed ; sql/sql_cache.cc: missed ; sql/sql_plugin.cc: missed ; sql/sql_select.cc: remove _db_on_ and DEBUGGER_ON/OFF storage/heap/hp_test2.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/ft_eval.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/ft_test1.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_open.c: remove _db_on_ and DEBUGGER_ON/OFF missed ; storage/myisam/mi_test1.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_test2.c: remove _db_on_ and DEBUGGER_ON/OFF storage/myisam/mi_test3.c: remove _db_on_ and DEBUGGER_ON/OFF storage/ndb/src/ndbapi/DictCache.cpp: missed ; storage/ndb/src/ndbapi/NdbTransaction.cpp: missed ; tests/mysql_client_test.c: remove _db_on_ and DEBUGGER_ON/OFF
This commit is contained in:
parent
8017e9c4e7
commit
d3ee9abf2a
35 changed files with 1781 additions and 1611 deletions
|
@ -730,10 +730,10 @@ build_query_string(void)
|
|||
strmov(ptr->string, query_string.str);
|
||||
DBUG_PRINT("info", ("user_supplied_query %s", ptr->string));
|
||||
dynstr_free(&query_string);
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(ptr);
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
get_options(int *argc,char ***argv)
|
||||
{
|
||||
int ho_error;
|
||||
|
|
|
@ -1856,7 +1856,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
|
|||
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
|
||||
realpath rename rint rwlock_init setupterm \
|
||||
shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
|
||||
sighold sigset sigthreadmask \
|
||||
sighold sigset sigthreadmask sleep \
|
||||
snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr strtol \
|
||||
strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
|
||||
posix_fallocate)
|
||||
|
|
2726
dbug/dbug.c
2726
dbug/dbug.c
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,3 @@
|
|||
Some extra options to DBUG_PUSH:
|
||||
|
||||
O,logfile - As in "o,logfile", but do a close and reopen each time anything
|
||||
is written to the logfile. This is needed when one expects
|
||||
the program to crash anywhere, in which case one doesn't
|
||||
(at least in MSDOS) get a full log-file.
|
||||
|
||||
If one wants a logfile with a ':' in the filename, one can get it by
|
||||
giving a double ':'. (As in "O,c::\tmp\log")
|
||||
|
||||
DBUG_DUMP("keyword",memory-position,length) writes a hexdump of the
|
||||
given memory-area to the outputfile.
|
||||
|
||||
All changes that I or other people at MySQL AB have done to all files
|
||||
in the dbug library (Mainly in dbug.c, dbug_analyze.c, dbug_long.h,
|
||||
|
@ -18,3 +6,4 @@ dbug.h) are put in public domain, as the rest of the dbug.c library)
|
|||
To my knowledge, all code in dbug library is in public domain.
|
||||
|
||||
Michael Widenius
|
||||
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
Hi,
|
||||
|
||||
I'm sending you the modifications I made to your Dbug routines to
|
||||
allow profiling in a (relatively) machine independent fashion.
|
||||
I use your Dbug routines fairly extensively. Unfortunately, it's
|
||||
a royal pain to have to keep profiled versions of various libraries
|
||||
around. The modifications allow profiling without the need for this.
|
||||
|
||||
How it works.
|
||||
------------
|
||||
|
||||
Basically, I just added code in the dbug routines to write out a file
|
||||
called dbugmon.out (by default). This is an ascii file containing lines
|
||||
of the form:
|
||||
|
||||
<function-name> E <time-entered>
|
||||
<function-name> X <time-exited>
|
||||
|
||||
A second program (analyze) reads this file, and produces a report on
|
||||
standard output.
|
||||
|
||||
Profiling is enabled through the `g' flag. It can take a list of
|
||||
procedure names for which profiling is enabled. By default, it
|
||||
profiles all procedures.
|
||||
|
||||
The code in ``dbug.c'' opens the profile file for appending. This
|
||||
is in order that one can run a program several times, and get the
|
||||
sum total of all the times, etc.
|
||||
|
||||
The only system dependent part that I'm aware of is the routine
|
||||
Clock() at the end of dbug.c. This returns the elapsed user time
|
||||
in milliseconds. The version which I have is for 4.3 BSD. As I
|
||||
don't have access to other systems, I'm not certain how this would
|
||||
change.
|
||||
|
||||
An example of the report generated follows:
|
||||
|
||||
Profile of Execution
|
||||
Execution times are in milliseconds
|
||||
|
||||
Calls Time
|
||||
----- ----
|
||||
Times Percentage Time Spent Percentage
|
||||
Function Called of total in Function of total Importance
|
||||
======== ====== ========== =========== ========== ==========
|
||||
factorial 5 83.33 30 100.00 8333
|
||||
main 1 16.67 0 0.00 0
|
||||
======== ====== ========== =========== ==========
|
||||
Totals 6 100.00 30 100.00
|
||||
|
||||
|
||||
As you can see, it's quite self-evident. The ``Importance'' column is a
|
||||
metric obtained by multiplying the percentage of the calls and the percentage
|
||||
of the time. Functions with higher 'importance' benefit the most from
|
||||
being sped up.
|
||||
|
||||
I'm really not certain how to add support for setjmp/longjmp, or for
|
||||
child processes, so I've ignored that for the time being. In most of
|
||||
the code that I write, it isn't necessary. If you have any good ideas,
|
||||
feel free to add them.
|
||||
|
||||
This has been very useful to me. If you can use it as part of your
|
||||
dbug distribution, please feel free to do so.
|
||||
|
||||
Regards,
|
||||
|
||||
Binayak Banerjee
|
||||
{allegra | astrovax | bpa | burdvax}!sjuvax!bbanerje
|
||||
bbanerje%sjuvax.sju.edu@relay.cs.net
|
||||
July 9, 1987
|
297
dbug/user.r
297
dbug/user.r
|
@ -672,52 +672,26 @@ from the standard include directory.
|
|||
.SP 2
|
||||
.BL 20
|
||||
.LI DBUG_ENTER\
|
||||
Used to tell the runtime support module the name of the function
|
||||
being entered.
|
||||
The argument must be of type "pointer to character".
|
||||
The
|
||||
DBUG_ENTER
|
||||
macro must precede all executable lines in the
|
||||
function just entered, and must come after all local declarations.
|
||||
Each
|
||||
DBUG_ENTER
|
||||
macro must have a matching
|
||||
DBUG_RETURN
|
||||
or
|
||||
DBUG_VOID_RETURN
|
||||
macro
|
||||
at the function exit points.
|
||||
DBUG_ENTER
|
||||
macros used without a matching
|
||||
DBUG_RETURN
|
||||
or
|
||||
DBUG_VOID_RETURN
|
||||
macro
|
||||
will cause warning messages from the
|
||||
Used to tell the runtime support module the name of the function being
|
||||
entered. The argument must be of type "pointer to character". The
|
||||
DBUG_ENTER macro must precede all executable lines in the function
|
||||
just entered, and must come after all local declarations. Each
|
||||
DBUG_ENTER macro must have a matching DBUG_RETURN or DBUG_VOID_RETURN
|
||||
macro at the function exit points. DBUG_ENTER macros used without a
|
||||
matching DBUG_RETURN or DBUG_VOID_RETURN macro will cause warning
|
||||
messages from the
|
||||
.I dbug
|
||||
package runtime support module.
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_ENTER\ ("main");\fR
|
||||
.SP 1
|
||||
.LI DBUG_RETURN\
|
||||
Used at each exit point of a function containing a
|
||||
DBUG_ENTER
|
||||
macro
|
||||
at the entry point.
|
||||
The argument is the value to return.
|
||||
Functions which return no value (void) should use the
|
||||
DBUG_VOID_RETURN
|
||||
macro.
|
||||
It
|
||||
is an error to have a
|
||||
DBUG_RETURN
|
||||
or
|
||||
DBUG_VOID_RETURN
|
||||
macro in a function
|
||||
which has no matching
|
||||
DBUG_ENTER
|
||||
macro, and the compiler will complain
|
||||
if the macros are actually used (expanded).
|
||||
Used at each exit point of a function containing a DBUG_ENTER macro at
|
||||
the entry point. The argument is the value to return. Functions
|
||||
which return no value (void) should use the DBUG_VOID_RETURN macro.
|
||||
It is an error to have a DBUG_RETURN or DBUG_VOID_RETURN macro in a
|
||||
function which has no matching DBUG_ENTER macro, and the compiler will
|
||||
complain if the macros are actually used (expanded).
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_RETURN\ (value);\fR
|
||||
.br
|
||||
|
@ -727,24 +701,20 @@ EX:\ \fCDBUG_VOID_RETURN;\fR
|
|||
Used to name the current process being executed.
|
||||
A typical argument for this macro is "argv[0]", though
|
||||
it will be perfectly happy with any other string.
|
||||
Im multi-threaded environment threads may have different names.
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_PROCESS\ (argv[0]);\fR
|
||||
.SP 1
|
||||
.LI DBUG_PUSH\
|
||||
Sets a new debugger state by pushing the current
|
||||
.B dbug
|
||||
state onto an
|
||||
internal stack and setting up the new state using the debug control
|
||||
string passed as the macro argument.
|
||||
The most common usage is to set the state specified by a debug
|
||||
control string retrieved from the argument list.
|
||||
Note that the leading "-#" in a debug control string specified
|
||||
as a command line argument must
|
||||
.B not
|
||||
be passed as part of the macro argument.
|
||||
The proper usage is to pass a pointer to the first character
|
||||
.B after
|
||||
the "-#" string.
|
||||
state onto an internal stack and setting up the new state using the
|
||||
debug control string passed as the macro argument. The most common
|
||||
usage is to set the state specified by a debug control string
|
||||
retrieved from the argument list. If the control string is
|
||||
.I incremental,
|
||||
the new state is a copy of the old state, modified by the control
|
||||
string.
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_PUSH\ (\&(argv[i][2]));\fR
|
||||
.br
|
||||
|
@ -755,32 +725,37 @@ EX:\ \fCDBUG_PUSH\ ("");\fR
|
|||
.LI DBUG_POP\
|
||||
Restores the previous debugger state by popping the state stack.
|
||||
Attempting to pop more states than pushed will be ignored and no
|
||||
warning will be given.
|
||||
The
|
||||
DBUG_POP
|
||||
macro has no arguments.
|
||||
warning will be given. The DBUG_POP macro has no arguments.
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_POP\ ();\fR
|
||||
.SP 1
|
||||
.LI DBUG_SET\
|
||||
Modifies the current debugger state on top of the stack using the
|
||||
debug control string passed as the macro argument. Unless
|
||||
.I incremental
|
||||
control string is used (see below), it's equivalent to a combination of
|
||||
DBUG_POP and DBUG_PUSH.
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_SET\ ("d:t");\fR
|
||||
.br
|
||||
EX:\ \fCDBUG_SET\ ("+d,info");\fR
|
||||
.br
|
||||
EX:\ \fCDBUG_SET\ ("+t:-d");\fR
|
||||
.SP 1
|
||||
.LI DBUG_FILE\
|
||||
The
|
||||
DBUG_FILE
|
||||
macro is used to do explicit I/O on the debug output
|
||||
stream.
|
||||
It is used in the same manner as the symbols "stdout" and "stderr"
|
||||
in the standard I/O package.
|
||||
The DBUG_FILE macro is used to do explicit I/O on the debug output
|
||||
stream. It is used in the same manner as the symbols "stdout" and
|
||||
"stderr" in the standard I/O package.
|
||||
.SP 1
|
||||
EX:\ \fCfprintf\ (DBUG_FILE,\ "Doing\ my\ own\ I/O!\\n");\fR
|
||||
.SP 1
|
||||
.LI DBUG_EXECUTE\
|
||||
The DBUG_EXECUTE macro is used to execute any arbitrary C code.
|
||||
The first argument is the debug keyword, used to trigger execution
|
||||
of the code specified as the second argument.
|
||||
This macro must be used cautiously because, like the
|
||||
DBUG_PRINT
|
||||
macro,
|
||||
it is automatically selected by default whenever the 'd' flag has
|
||||
no argument list (i.e., a "-#d:t" control string).
|
||||
The DBUG_EXECUTE macro is used to execute any arbitrary C code. The
|
||||
first argument is the debug keyword, used to trigger execution of the
|
||||
code specified as the second argument. This macro must be used
|
||||
cautiously because, like the DBUG_PRINT macro, it is automatically
|
||||
selected by default whenever the 'd' flag has no argument list (i.e.,
|
||||
a "-#d:t" control string).
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_EXECUTE\ ("status",\ print_status\ ());\fR
|
||||
.SP 1
|
||||
|
@ -794,17 +769,40 @@ artificial delay checking for race conditions.
|
|||
.SP 1
|
||||
EX:\ \fCDBUG_EXECUTE_IF\ ("crashme",\ abort\ ());\fR
|
||||
.SP 1
|
||||
.LI DBUG_N\
|
||||
These macros, where N is in the range 2-5, are currently obsolete
|
||||
and will be removed in a future release.
|
||||
Use the new DBUG_PRINT macro.
|
||||
.LI DBUG_EVALUATE\
|
||||
The DBUG_EVALUATE macro is similar to DBUG_EXECUTE, but it can be used in
|
||||
the expression context. The first argument is the debug keyword that is used to
|
||||
choose whether the second (keyword is enabled) or the third (keyword is not
|
||||
enabled) argument is evaluated. When
|
||||
.B dbug
|
||||
is compiled off, the third argument is evaluated.
|
||||
.SP 1
|
||||
EX:\fC
|
||||
.br
|
||||
printf("Info-debug is %s",
|
||||
.br
|
||||
DBUG_EVALUATE\ ("info", "ON", "OFF"));\fR
|
||||
.SP 1
|
||||
.LI DBUG_EVALUATE_IF\
|
||||
Works like DBUG_EVALUATE macro, but the second argument is
|
||||
.B not
|
||||
evaluated, if the keyword is not explicitly listed in
|
||||
the 'd' flag. Like DBUG_EXECUTE_IF this could be used to conditionally execute
|
||||
"dangerous" actions.
|
||||
.SP 1
|
||||
EX:\fC
|
||||
.br
|
||||
if (prepare_transaction () ||
|
||||
.br
|
||||
DBUG_EVALUATE ("crashme", (abort (), 0), 0) ||
|
||||
.br
|
||||
commit_transaction () )\fR
|
||||
.SP 1
|
||||
.LI DBUG_PRINT\
|
||||
Used to do printing via the "fprintf" library function on the
|
||||
current debug stream,
|
||||
DBUG_FILE.
|
||||
The first argument is a debug keyword, the second is a format string
|
||||
and the corresponding argument list.
|
||||
Note that the format string and argument list are all one macro argument
|
||||
Used to do printing via the "fprintf" library function on the current
|
||||
debug stream, DBUG_FILE. The first argument is a debug keyword, the
|
||||
second is a format string and the corresponding argument list. Note
|
||||
that the format string and argument list are all one macro argument
|
||||
and
|
||||
.B must
|
||||
be enclosed in parentheses.
|
||||
|
@ -816,10 +814,10 @@ EX:\ \fCDBUG_PRINT\ ("type",\ ("type\ is\ %x", type));\fR
|
|||
EX:\ \fCDBUG_PRINT\ ("stp",\ ("%x\ ->\ %s", stp, stp\ ->\ name));\fR
|
||||
.SP 1
|
||||
.LI DBUG_DUMP\
|
||||
Used to dump a memory block in hex via the "fprintf" library function on the
|
||||
current debug stream, DBUG_FILE.
|
||||
The first argument is a debug keyword, the second is a pointer to
|
||||
a memory to dump, the third is a number of bytes to dump.
|
||||
Used to dump a memory block in hex via the "fprintf" library function
|
||||
on the current debug stream, DBUG_FILE. The first argument is a debug
|
||||
keyword, the second is a pointer to a memory to dump, the third is a
|
||||
number of bytes to dump.
|
||||
.SP 1
|
||||
EX: \fCDBUG_DBUG\ ("net",\ packet,\ len);\fR
|
||||
.SP 1
|
||||
|
@ -875,13 +873,28 @@ library. So there will be no need to disable asserts separately with NDEBUG.
|
|||
.SP 1
|
||||
EX:\ \fCDBUG_ASSERT(\ a\ >\ 0\ );\fR
|
||||
.SP 1
|
||||
.LI DBUG_OUTPUT\
|
||||
In multi-threaded environment disables (or enables) any
|
||||
.I dbug
|
||||
output from the current thread.
|
||||
.LI DBUG_EXPLAIN\
|
||||
Generates control string corresponding to the current debug state.
|
||||
The macro takes two arguments - a buffer to store the result string
|
||||
into and its length. The macro (which could be used as a function)
|
||||
returns 1 if the control string didn't fit into the buffer and was
|
||||
truncated and 0 otherwise.
|
||||
.SP 1
|
||||
EX:\ \fCDBUG_OUTPUT(\ 0\ );\fR
|
||||
EX:\fC
|
||||
.br
|
||||
char buf[256];
|
||||
.br
|
||||
DBUG_EXPLAIN( buf, sizeof(buf) );\fR
|
||||
.SP 1
|
||||
.LI DBUG_SET_INITIAL\
|
||||
.LI DBUG_EXPLAIN_INITIAL\
|
||||
.br
|
||||
These two macros are identical to DBUG_SET and DBUG_EXPLAIN, but they
|
||||
operate on the debug state that any new thread starts from.
|
||||
Modifying
|
||||
.I initial
|
||||
value does not affect threads that are already running. Obviously,
|
||||
these macros are only useful in the multi-threaded environment.
|
||||
.LE
|
||||
|
||||
.SK
|
||||
|
@ -893,42 +906,52 @@ DEBUG CONTROL STRING
|
|||
The debug control string is used to set the state of the debugger
|
||||
via the
|
||||
.B DBUG_PUSH
|
||||
macro.
|
||||
This section summarizes the currently available debugger options
|
||||
and the flag characters which enable or disable them.
|
||||
Argument lists enclosed in '[' and ']' are optional.
|
||||
or
|
||||
.B DBUG_SET
|
||||
macros. Control string consists of colon separate flags. A flag
|
||||
may take an argument or a list of arguments. If a control string
|
||||
starts from a '+' sign it works
|
||||
.I incrementally,
|
||||
that is, it can modify existing state without overriding it. In such a
|
||||
string every flag may be preceded by a '+' or '-' to enable or disable
|
||||
a corresponding option in the debugger state. This section summarizes
|
||||
the currently available debugger options and the flag characters which
|
||||
enable or disable them. Argument lists enclosed in '[' and ']' are
|
||||
optional.
|
||||
.SP 2
|
||||
.BL 22
|
||||
.LI a[,file]
|
||||
Redirect the debugger output stream and append it to the specified file.
|
||||
The default output stream is stderr.
|
||||
A null argument list causes output to be redirected to stdout.
|
||||
Double the colon, if you want it in the path
|
||||
Redirect the debugger output stream and append it to the specified
|
||||
file. The default output stream is stderr. A null argument list
|
||||
causes output to be redirected to stdout. A colon that is followed by
|
||||
the '\\' or '/' is cosidered a part of the path and not a flag
|
||||
separator.
|
||||
.SP 1
|
||||
EX: \fCa,C::\\tmp\\log\fR
|
||||
EX: \fCa,C:\\tmp\\log\fR
|
||||
.LI A[,file]
|
||||
Like 'a[,file]' but ensure that data are written after each write
|
||||
(this typically implies flush or close/reopen). It helps to get
|
||||
a complete log file in case of crashes. This mode is implied in
|
||||
a complete log file in case of crashes. This mode is implicit in
|
||||
multi-threaded environment.
|
||||
.LI d[,keywords]
|
||||
Enable output from macros with specified keywords.
|
||||
A null list of keywords implies that all keywords are selected.
|
||||
An empty list of keywords implies that all keywords are selected.
|
||||
.LI D[,time]
|
||||
Delay for specified time after each output line, to let output drain.
|
||||
Time is given in tenths of a second (value of 10 is one second).
|
||||
Default is zero.
|
||||
.LI f[,functions]
|
||||
Limit debugger actions to the specified list of functions.
|
||||
A null list of functions implies that all functions are selected.
|
||||
An empty list of functions implies that all functions are selected.
|
||||
.LI F
|
||||
Mark each debugger output line with the name of the source file
|
||||
containing the macro causing the output.
|
||||
.LI i
|
||||
Mark each debugger output line with the PID of the current process.
|
||||
Mark each debugger output line with the PID (or thread ID) of the
|
||||
current process.
|
||||
.LI g,[functions]
|
||||
Enable profiling for the specified list of functions.
|
||||
By default profiling is enabled for all functions.
|
||||
An empty list of functions enables profiling for all functions.
|
||||
See
|
||||
.B PROFILING\ WITH\ DBUG
|
||||
below.
|
||||
|
@ -946,20 +969,18 @@ Like 'a[,file]' but overwrite old file, do not append.
|
|||
.LI O[,file]
|
||||
Like 'A[,file]' but overwrite old file, do not append.
|
||||
.LI p[,processes]
|
||||
Limit debugger actions to the specified processes.
|
||||
A null list implies all processes.
|
||||
This is useful for processes which run child processes.
|
||||
Note that each debugger output line can be marked with the name of
|
||||
the current process via the 'P' flag.
|
||||
The process name must match the argument passed to the
|
||||
Limit debugger actions to the specified processes. An empty list
|
||||
implies all processes. This is useful for processes which run child
|
||||
processes. Note that each debugger output line can be marked with the
|
||||
name of the current process via the 'P' flag. The process name must
|
||||
match the argument passed to the
|
||||
.B DBUG_PROCESS
|
||||
macro.
|
||||
.LI P
|
||||
Mark each debugger output line with the name of the current process.
|
||||
Most useful when used with a process which runs child processes that
|
||||
are also being debugged.
|
||||
Note that the parent process must arrange for the debugger control
|
||||
string to be passed to the child processes.
|
||||
are also being debugged. Note that the parent process must arrange
|
||||
for the debugger control string to be passed to the child processes.
|
||||
.LI r
|
||||
Used in conjunction with the
|
||||
.B DBUG_PUSH
|
||||
|
@ -981,7 +1002,59 @@ and
|
|||
Enable function control flow tracing.
|
||||
The maximum nesting depth is specified by N, and defaults to
|
||||
200.
|
||||
.LI T
|
||||
Mark each debugger output line with the current timestamp.
|
||||
The value is printed with microsecond resolution, as returned by
|
||||
.I gettimeofday()
|
||||
system call. The actual resolution is OS- and hardware-dependent.
|
||||
.LE
|
||||
|
||||
.SK
|
||||
.B
|
||||
MULTI-THREADED DEBUGGING
|
||||
.R
|
||||
|
||||
.P
|
||||
When
|
||||
.I dbug
|
||||
is used in a multi-threaded environment there are few differences from a single-threaded
|
||||
case to keep in mind. This section tries to summarize them.
|
||||
.SP 2
|
||||
.BL 5
|
||||
.LI
|
||||
Every thread has its own stack of debugger states.
|
||||
.B DBUG_PUSH
|
||||
and
|
||||
.B DBUG_POP
|
||||
affect only the thread that executed them.
|
||||
.LI
|
||||
At the bottom of the stack for all threads there is the common
|
||||
.I initial
|
||||
state. Changes to this state (for example, with
|
||||
.B DBUG_SET_INITIAL
|
||||
macro) affect all new threads and all running threads that didn't
|
||||
.B DBUG_PUSH
|
||||
yet.
|
||||
.LI
|
||||
Every thread can have its own name, that can be set with
|
||||
.B DBUG_PROCESS
|
||||
macro. Thus, "-#p,name1,name2" can be used to limit the output to specific threads.
|
||||
.LI
|
||||
When printing directly to
|
||||
.B DBUG_FILE
|
||||
it may be necessary to prevent other threads from writing something between two parts
|
||||
of logically indivisible output. It is done with
|
||||
.B DBUG_LOCK_FILE
|
||||
and
|
||||
.B DBUG_UNLOCK_FILE
|
||||
macors. See the appropriate section for examples.
|
||||
.LI
|
||||
"-#o,file" and "-#O,file" are treated as "-#a,file" and "-#A,file" respectively. That is
|
||||
all writes to a file are always followed by a flush.
|
||||
.LI
|
||||
"-#i" prints not a PID but a thread id in the form of "T@nnn"
|
||||
.LE
|
||||
|
||||
.SK
|
||||
.B
|
||||
PROFILING WITH DBUG
|
||||
|
|
|
@ -21,15 +21,18 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
#if !defined(DBUG_OFF) && !defined(_lint)
|
||||
extern int _db_on_,_no_db_;
|
||||
extern FILE *_db_fp_;
|
||||
extern char *_db_process_;
|
||||
extern int _db_keyword_(const char *keyword);
|
||||
struct _db_code_state_;
|
||||
extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword);
|
||||
extern int _db_strict_keyword_(const char *keyword);
|
||||
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, int len);
|
||||
extern int _db_explain_init_(char *buf, int len);
|
||||
extern void _db_setjmp_(void);
|
||||
extern void _db_longjmp_(void);
|
||||
extern void _db_process_(const char *name);
|
||||
extern void _db_push_(const char *control);
|
||||
extern void _db_pop_(void);
|
||||
extern void _db_set_(struct _db_code_state_ *cs, const char *control);
|
||||
extern void _db_set_init_(const char *control);
|
||||
extern void _db_enter_(const char *_func_,const char *_file_,uint _line_,
|
||||
const char **_sfunc_,const char **_sfile_,
|
||||
uint *_slevel_, char ***);
|
||||
|
@ -39,61 +42,66 @@ 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_(uint flag);
|
||||
extern void _db_lock_file(void);
|
||||
extern void _db_unlock_file(void);
|
||||
extern void _db_lock_file_(void);
|
||||
extern void _db_unlock_file_(void);
|
||||
extern FILE *_db_fp_(void);
|
||||
|
||||
#define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \
|
||||
char **_db_framep_; \
|
||||
_db_enter_ (a,__FILE__,__LINE__,&_db_func_,&_db_file_,&_db_level_, \
|
||||
&_db_framep_)
|
||||
#define DBUG_LEAVE \
|
||||
(_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_))
|
||||
#define DBUG_RETURN(a1) {DBUG_LEAVE; return(a1);}
|
||||
#define DBUG_VOID_RETURN {DBUG_LEAVE; return;}
|
||||
_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)
|
||||
#define DBUG_RETURN(a1) do {DBUG_LEAVE; return(a1);} while(0)
|
||||
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
|
||||
#define DBUG_EXECUTE(keyword,a1) \
|
||||
{if (_db_on_) {if (_db_keyword_ (keyword)) { a1 }}}
|
||||
do {if (_db_keyword_(0, (keyword))) { a1 }} while(0)
|
||||
#define DBUG_EXECUTE_IF(keyword,a1) \
|
||||
do {if (_db_strict_keyword_ (keyword)) { a1 } } while(0)
|
||||
#define DBUG_EVALUATE(keyword,a1,a2) \
|
||||
(_db_keyword_(0,(keyword)) ? (a1) : (a2))
|
||||
#define DBUG_EVALUATE_IF(keyword,a1,a2) \
|
||||
(_db_strict_keyword_((keyword)) ? (a1) : (a2))
|
||||
#define DBUG_PRINT(keyword,arglist) \
|
||||
{if (_db_on_) {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;}}
|
||||
do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0)
|
||||
#define DBUG_PUSH(a1) _db_push_ (a1)
|
||||
#define DBUG_POP() _db_pop_ ()
|
||||
#define DBUG_PROCESS(a1) (_db_process_ = a1)
|
||||
#define DBUG_FILE (_db_fp_)
|
||||
#define DBUG_SET(a1) _db_set_ (0, (a1))
|
||||
#define DBUG_SET_INITIAL(a1) _db_set_init_ (a1)
|
||||
#define DBUG_PROCESS(a1) _db_process_(a1)
|
||||
#define DBUG_FILE _db_fp_()
|
||||
#define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1))
|
||||
#define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2))
|
||||
#define DBUG_DUMP(keyword,a1,a2)\
|
||||
{if (_db_on_) {_db_dump_(__LINE__,keyword,a1,a2);}}
|
||||
#define DBUG_IN_USE (_db_fp_ && _db_fp_ != stderr)
|
||||
#define DEBUGGER_OFF _no_db_=1;_db_on_=0;
|
||||
#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_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2)
|
||||
#define DBUG_LOCK_FILE _db_lock_file_()
|
||||
#define DBUG_UNLOCK_FILE _db_unlock_file_()
|
||||
#define DBUG_ASSERT(A) assert(A)
|
||||
#define DBUG_EXECUTE_IF(keyword,a1) \
|
||||
{if (_db_on_) {if (_db_strict_keyword_ (keyword)) { a1 }}}
|
||||
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
|
||||
#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
|
||||
#else /* No debugger */
|
||||
|
||||
#define DBUG_ENTER(a1)
|
||||
#define DBUG_RETURN(a1) return(a1)
|
||||
#define DBUG_VOID_RETURN return
|
||||
#define DBUG_EXECUTE(keyword,a1) {}
|
||||
#define DBUG_EXECUTE_IF(keyword,a1) {}
|
||||
#define DBUG_PRINT(keyword,arglist) {}
|
||||
#define DBUG_PUSH(a1) {}
|
||||
#define DBUG_POP() {}
|
||||
#define DBUG_PROCESS(a1) {}
|
||||
#define DBUG_FILE (stderr)
|
||||
#define DBUG_SETJMP setjmp
|
||||
#define DBUG_LONGJMP longjmp
|
||||
#define DBUG_DUMP(keyword,a1,a2) {}
|
||||
#define DBUG_IN_USE 0
|
||||
#define DEBUGGER_OFF
|
||||
#define DEBUGGER_ON
|
||||
#define DBUG_RETURN(a1) do { return(a1); } while(0)
|
||||
#define DBUG_VOID_RETURN do { return; } while(0)
|
||||
#define DBUG_EXECUTE(keyword,a1) do { } while(0)
|
||||
#define DBUG_EXECUTE_IF(keyword,a1) do { } while(0)
|
||||
#define DBUG_EVALUATE(keyword,a1,a2) (a2)
|
||||
#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
|
||||
#define DBUG_PRINT(keyword,arglist) do { } while(0)
|
||||
#define DBUG_PUSH(a1)
|
||||
#define DBUG_SET(a1)
|
||||
#define DBUG_SET_INITIAL(a1)
|
||||
#define DBUG_POP()
|
||||
#define DBUG_PROCESS(a1) (a1)
|
||||
#define DBUG_SETJMP(a1) setjmp(a1)
|
||||
#define DBUG_LONGJMP(a1) longjmp(a1)
|
||||
#define DBUG_DUMP(keyword,a1,a2)
|
||||
#define DBUG_ASSERT(A)
|
||||
#define DBUG_LOCK_FILE
|
||||
#define DBUG_FILE (stderr)
|
||||
#define DBUG_UNLOCK_FILE
|
||||
#define DBUG_OUTPUT(A)
|
||||
#define DBUG_ASSERT(A) {}
|
||||
#define DBUG_EXPLAIN(buf,len)
|
||||
#define DBUG_EXPLAIN_INITIAL(buf,len)
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -179,10 +179,8 @@ void STDCALL mysql_server_end()
|
|||
if (!org_my_init_done)
|
||||
{
|
||||
my_end(0);
|
||||
#ifndef THREAD
|
||||
/* Remove TRACING, if enabled by mysql_debug() */
|
||||
DBUG_POP();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
mysql_thread_end();
|
||||
|
@ -267,16 +265,12 @@ mysql_debug(const char *debug __attribute__((unused)))
|
|||
{
|
||||
#ifndef DBUG_OFF
|
||||
char *env;
|
||||
if (_db_on_)
|
||||
return; /* Already using debugging */
|
||||
if (debug)
|
||||
{
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH(debug);
|
||||
}
|
||||
else if ((env = getenv("MYSQL_DEBUG")))
|
||||
{
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH(env);
|
||||
#if !defined(_WINVER) && !defined(WINVER)
|
||||
puts("\n-------------------------------------------------------");
|
||||
|
|
|
@ -213,6 +213,7 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
|
|||
WSACleanup();
|
||||
#endif /* __WIN__ */
|
||||
my_init_done=0;
|
||||
DBUG_VOID_RETURN;
|
||||
} /* my_end */
|
||||
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ const char *my_thread_name(void)
|
|||
if (!tmp->name[0])
|
||||
{
|
||||
long id=my_thread_id();
|
||||
sprintf(name_buff,"T@%ld", id);
|
||||
sprintf(name_buff,"T@%lu", id);
|
||||
strmake(tmp->name,name_buff,THREAD_NAME_SIZE);
|
||||
}
|
||||
return tmp->name;
|
||||
|
|
|
@ -250,7 +250,6 @@ err:
|
|||
static int get_options(int argc, char **argv)
|
||||
{
|
||||
char *pos,*progname;
|
||||
DEBUGGER_OFF;
|
||||
|
||||
progname= argv[0];
|
||||
|
||||
|
@ -270,7 +269,6 @@ static int get_options(int argc, char **argv)
|
|||
printf("Usage: %s [-?ABIKLWv] [-m#] [-t#]\n",progname);
|
||||
exit(0);
|
||||
case '#':
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH (++pos);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
|
|||
DBUG_PRINT("info", ("ha_myisammrg::open exit %d", my_errno));
|
||||
return (my_errno ? my_errno : -1);
|
||||
}
|
||||
DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."))
|
||||
DBUG_PRINT("info", ("ha_myisammrg::open myrg_extrafunc..."));
|
||||
myrg_extrafunc(file, query_cache_invalidate_by_MyISAM_filename_ref);
|
||||
if (!(test_if_locked == HA_OPEN_WAIT_IF_LOCKED ||
|
||||
test_if_locked == HA_OPEN_ABORT_IF_LOCKED))
|
||||
|
|
|
@ -2773,7 +2773,7 @@ void ndb_unpack_record(TABLE *table, NdbValue *value,
|
|||
ndb_blob->getDefined(isNull);
|
||||
if (isNull == 1)
|
||||
{
|
||||
DBUG_PRINT("info",("[%u] NULL", col_no))
|
||||
DBUG_PRINT("info",("[%u] NULL", col_no));
|
||||
field->set_null(row_offset);
|
||||
}
|
||||
else if (isNull == -1)
|
||||
|
@ -2811,15 +2811,18 @@ void ha_ndbcluster::unpack_record(byte *buf)
|
|||
const NDBCOL *hidden_col= tab->getColumn(hidden_no);
|
||||
const NdbRecAttr* rec= m_value[hidden_no].rec;
|
||||
DBUG_ASSERT(rec);
|
||||
DBUG_PRINT("hidden", ("%d: %s \"%llu\"", hidden_no,
|
||||
DBUG_PRINT("hidden", ("%d: %s \"%llu\"", hidden_no,
|
||||
hidden_col->getName(), rec->u_64_value()));
|
||||
}
|
||||
//print_results();
|
||||
}
|
||||
//DBUG_EXECUTE("value", print_results(););
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Utility function to print/dump the fetched field
|
||||
to avoid unnecessary work, wrap in DBUG_EXECUTE as in:
|
||||
|
||||
DBUG_EXECUTE("value", print_results(););
|
||||
*/
|
||||
|
||||
void ha_ndbcluster::print_results()
|
||||
|
@ -2827,8 +2830,6 @@ void ha_ndbcluster::print_results()
|
|||
DBUG_ENTER("print_results");
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
if (!_db_on_)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
char buf_type[MAX_FIELD_WIDTH], buf_val[MAX_FIELD_WIDTH];
|
||||
String type(buf_type, sizeof(buf_type), &my_charset_bin);
|
||||
|
@ -6413,7 +6414,7 @@ ha_ndbcluster::register_query_cache_table(THD *thd,
|
|||
|
||||
if (!is_autocommit)
|
||||
{
|
||||
DBUG_PRINT("exit", ("Can't register table during transaction"))
|
||||
DBUG_PRINT("exit", ("Can't register table during transaction"));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
@ -6421,7 +6422,7 @@ ha_ndbcluster::register_query_cache_table(THD *thd,
|
|||
if (ndb_get_commitcount(thd, m_dbname, m_tabname, &commit_count))
|
||||
{
|
||||
*engine_data= 0;
|
||||
DBUG_PRINT("exit", ("Error, could not get commitcount"))
|
||||
DBUG_PRINT("exit", ("Error, could not get commitcount"));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
*engine_data= commit_count;
|
||||
|
|
|
@ -100,24 +100,21 @@ static TABLE_LIST binlog_tables;
|
|||
#ifndef DBUG_OFF
|
||||
static void print_records(TABLE *table, const char *record)
|
||||
{
|
||||
if (_db_on_)
|
||||
for (uint j= 0; j < table->s->fields; j++)
|
||||
{
|
||||
for (uint j= 0; j < table->s->fields; j++)
|
||||
char buf[40];
|
||||
int pos= 0;
|
||||
Field *field= table->field[j];
|
||||
const byte* field_ptr= field->ptr - table->record[0] + record;
|
||||
int pack_len= field->pack_length();
|
||||
int n= pack_len < 10 ? pack_len : 10;
|
||||
|
||||
for (int i= 0; i < n && pos < 20; i++)
|
||||
{
|
||||
char buf[40];
|
||||
int pos= 0;
|
||||
Field *field= table->field[j];
|
||||
const byte* field_ptr= field->ptr - table->record[0] + record;
|
||||
int pack_len= field->pack_length();
|
||||
int n= pack_len < 10 ? pack_len : 10;
|
||||
|
||||
for (int i= 0; i < n && pos < 20; i++)
|
||||
{
|
||||
pos+= sprintf(&buf[pos]," %x", (int) (unsigned char) field_ptr[i]);
|
||||
}
|
||||
buf[pos]= 0;
|
||||
DBUG_PRINT("info",("[%u]field_ptr[0->%d]: %s", j, n, buf));
|
||||
pos+= sprintf(&buf[pos]," %x", (int) (unsigned char) field_ptr[i]);
|
||||
}
|
||||
buf[pos]= 0;
|
||||
DBUG_PRINT("info",("[%u]field_ptr[0->%d]: %s", j, n, buf));
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -2483,7 +2480,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
|
|||
DBUG_ASSERT(ret == 0);
|
||||
}
|
||||
ndb_unpack_record(table, share->ndb_value[n], &b, table->record[n]);
|
||||
print_records(table, table->record[n]);
|
||||
DBUG_EXECUTE("info", print_records(table, table->record[n]););
|
||||
trans.delete_row(::server_id, injector::transaction::table(table, true),
|
||||
&b, n_fields, table->record[n]);
|
||||
}
|
||||
|
@ -2502,7 +2499,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
|
|||
}
|
||||
ndb_unpack_record(table, share->ndb_value[0],
|
||||
&b, table->record[0]);
|
||||
print_records(table, table->record[0]);
|
||||
DBUG_EXECUTE("info", print_records(table, table->record[0]););
|
||||
if (table->s->primary_key != MAX_KEY)
|
||||
{
|
||||
/*
|
||||
|
@ -2527,7 +2524,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
|
|||
DBUG_ASSERT(ret == 0);
|
||||
}
|
||||
ndb_unpack_record(table, share->ndb_value[1], &b, table->record[1]);
|
||||
print_records(table, table->record[1]);
|
||||
DBUG_EXECUTE("info", print_records(table, table->record[1]););
|
||||
trans.update_row(::server_id,
|
||||
injector::transaction::table(table, true),
|
||||
&b, n_fields,
|
||||
|
|
|
@ -2860,7 +2860,7 @@ longlong Item_is_not_null_test::val_int()
|
|||
}
|
||||
if (args[0]->is_null())
|
||||
{
|
||||
DBUG_PRINT("info", ("null"))
|
||||
DBUG_PRINT("info", ("null"));
|
||||
owner->was_null|= 1;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
|
|
@ -622,7 +622,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
|
|||
table_ptr[i], count,
|
||||
(thd == logger.get_general_log_thd()) ||
|
||||
(thd == logger.get_slow_log_thd())))
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
if (!(sql_lock= (MYSQL_LOCK*)
|
||||
|
|
|
@ -5654,7 +5654,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
|
|||
|
||||
|
||||
m_data_size= TABLE_MAP_HEADER_LEN;
|
||||
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", m_data_size= 6;)
|
||||
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", m_data_size= 6;);
|
||||
m_data_size+= m_dblen + 2; // Include length and terminating \0
|
||||
m_data_size+= m_tbllen + 2; // Include length and terminating \0
|
||||
m_data_size+= 1 + m_colcnt; // COLCNT and column types
|
||||
|
|
|
@ -1089,12 +1089,8 @@ pthread_handler_t kill_server_thread(void *arg __attribute__((unused)))
|
|||
|
||||
extern "C" sig_handler print_signal_warning(int sig)
|
||||
{
|
||||
if (!DBUG_IN_USE)
|
||||
{
|
||||
if (global_system_variables.log_warnings)
|
||||
sql_print_warning("Got signal %d from thread %d",
|
||||
sig,my_thread_id());
|
||||
}
|
||||
if (global_system_variables.log_warnings)
|
||||
sql_print_warning("Got signal %d from thread %d", sig,my_thread_id());
|
||||
#ifdef DONT_REMEMBER_SIGNAL
|
||||
my_sigset(sig,print_signal_warning); /* int. thread system calls */
|
||||
#endif
|
||||
|
@ -1717,7 +1713,7 @@ void end_thread(THD *thd, bool put_in_cache)
|
|||
! abort_loop && !kill_cached_threads)
|
||||
{
|
||||
/* Don't kill the thread, just put it in cache for reuse */
|
||||
DBUG_PRINT("info", ("Adding thread to cache"))
|
||||
DBUG_PRINT("info", ("Adding thread to cache"));
|
||||
cached_thread_count++;
|
||||
while (!abort_loop && ! wake_thread && ! kill_cached_threads)
|
||||
(void) pthread_cond_wait(&COND_thread_cache, &LOCK_thread_count);
|
||||
|
@ -1738,13 +1734,13 @@ void end_thread(THD *thd, bool put_in_cache)
|
|||
}
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("sending a broadcast"))
|
||||
DBUG_PRINT("info", ("sending a broadcast"));
|
||||
|
||||
/* Tell main we are ready */
|
||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||
/* It's safe to broadcast outside a lock (COND... is not deleted here) */
|
||||
(void) pthread_cond_broadcast(&COND_thread_count);
|
||||
DBUG_PRINT("info", ("unlocked thread_count mutex"))
|
||||
DBUG_PRINT("info", ("unlocked thread_count mutex"));
|
||||
#ifdef ONE_THREAD
|
||||
if (!(test_flags & TEST_NO_THREADS)) // For debugging under Linux
|
||||
#endif
|
||||
|
@ -3467,8 +3463,6 @@ int win_main(int argc, char **argv)
|
|||
int main(int argc, char **argv)
|
||||
#endif
|
||||
{
|
||||
DEBUGGER_OFF;
|
||||
|
||||
rpl_filter= new Rpl_filter;
|
||||
binlog_filter= new Rpl_filter;
|
||||
if (!rpl_filter || !binlog_filter)
|
||||
|
@ -7065,7 +7059,6 @@ static void mysql_init_variables(void)
|
|||
max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
|
||||
global_system_variables.old_passwords= 0;
|
||||
global_system_variables.old_alter_table= 0;
|
||||
|
||||
/*
|
||||
Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
|
||||
when collecting index statistics for MyISAM tables.
|
||||
|
@ -7172,7 +7165,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
switch(optid) {
|
||||
case '#':
|
||||
#ifndef DBUG_OFF
|
||||
DBUG_PUSH(argument ? argument : default_dbug_option);
|
||||
DBUG_SET(argument ? argument : default_dbug_option);
|
||||
DBUG_SET_INITIAL(argument ? argument : default_dbug_option);
|
||||
#endif
|
||||
opt_endinfo=1; /* unireg: memory allocation */
|
||||
break;
|
||||
|
|
|
@ -10162,8 +10162,6 @@ static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map,
|
|||
int idx;
|
||||
char buff[1024];
|
||||
DBUG_ENTER("print_sel_tree");
|
||||
if (! _db_on_)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
String tmp(buff,sizeof(buff),&my_charset_bin);
|
||||
tmp.length(0);
|
||||
|
@ -10192,9 +10190,7 @@ static void print_ror_scans_arr(TABLE *table, const char *msg,
|
|||
struct st_ror_scan_info **start,
|
||||
struct st_ror_scan_info **end)
|
||||
{
|
||||
DBUG_ENTER("print_ror_scans");
|
||||
if (! _db_on_)
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_ENTER("print_ror_scans_arr");
|
||||
|
||||
char buff[1024];
|
||||
String tmp(buff,sizeof(buff),&my_charset_bin);
|
||||
|
@ -10258,7 +10254,7 @@ static void print_quick(QUICK_SELECT_I *quick, const key_map *needed_reg)
|
|||
{
|
||||
char buf[MAX_KEY/8+1];
|
||||
DBUG_ENTER("print_quick");
|
||||
if (! _db_on_ || !quick)
|
||||
if (!quick)
|
||||
DBUG_VOID_RETURN;
|
||||
DBUG_LOCK_FILE;
|
||||
|
||||
|
|
|
@ -205,6 +205,9 @@ sys_var_long_ptr sys_concurrent_insert("concurrent_insert",
|
|||
&myisam_concurrent_insert);
|
||||
sys_var_long_ptr sys_connect_timeout("connect_timeout",
|
||||
&connect_timeout);
|
||||
#ifndef DBUG_OFF
|
||||
sys_var_thd_dbug sys_dbug("debug");
|
||||
#endif
|
||||
sys_var_enum sys_delay_key_write("delay_key_write",
|
||||
&delay_key_write_options,
|
||||
&delay_key_write_typelib,
|
||||
|
@ -722,13 +725,16 @@ SHOW_VAR init_vars[]= {
|
|||
{"datadir", mysql_real_data_home, SHOW_CHAR},
|
||||
{sys_date_format.name, (char*) &sys_date_format, SHOW_SYS},
|
||||
{sys_datetime_format.name, (char*) &sys_datetime_format, SHOW_SYS},
|
||||
#ifndef DBUG_OFF
|
||||
{sys_dbug.name, (char*) &sys_dbug, SHOW_SYS},
|
||||
#endif
|
||||
{sys_default_week_format.name, (char*) &sys_default_week_format, SHOW_SYS},
|
||||
{sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS},
|
||||
{sys_delayed_insert_limit.name, (char*) &sys_delayed_insert_limit,SHOW_SYS},
|
||||
{sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS},
|
||||
{sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS},
|
||||
{sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
|
||||
{sys_engine_condition_pushdown.name,
|
||||
{sys_engine_condition_pushdown.name,
|
||||
(char*) &sys_engine_condition_pushdown, SHOW_SYS},
|
||||
{sys_event_executor.name, (char*) &sys_event_executor, SHOW_SYS},
|
||||
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
|
||||
|
@ -3461,6 +3467,33 @@ bool sys_var_trust_routine_creators::update(THD *thd, set_var *var)
|
|||
return sys_var_bool_ptr::update(thd, var);
|
||||
}
|
||||
|
||||
/* even session variable here requires SUPER, because of -#o,file */
|
||||
bool sys_var_thd_dbug::check(THD *thd, set_var *var)
|
||||
{
|
||||
return check_global_access(thd, SUPER_ACL);
|
||||
}
|
||||
|
||||
bool sys_var_thd_dbug::update(THD *thd, set_var *var)
|
||||
{
|
||||
if (var->type == OPT_GLOBAL)
|
||||
DBUG_SET_INITIAL(var ? var->value->str_value.c_ptr() : "");
|
||||
else
|
||||
{
|
||||
DBUG_POP();
|
||||
DBUG_PUSH(var ? var->value->str_value.c_ptr() : "");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
byte *sys_var_thd_dbug::value_ptr(THD *thd, enum_var_type type, LEX_STRING *b)
|
||||
{
|
||||
char buf[256];
|
||||
if (type == OPT_GLOBAL)
|
||||
DBUG_EXPLAIN_INITIAL(buf, sizeof(buf));
|
||||
else
|
||||
DBUG_EXPLAIN(buf, sizeof(buf));
|
||||
(byte*) thd->strdup(buf);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Used templates
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
struct my_option *option_limits; /* Updated by by set_var_init() */
|
||||
uint name_length; /* Updated by by set_var_init() */
|
||||
const char *name;
|
||||
|
||||
|
||||
sys_after_update_func after_update;
|
||||
bool no_support_one_shot;
|
||||
sys_var(const char *name_arg)
|
||||
|
@ -413,7 +413,7 @@ class sys_var_thd_bit :public sys_var_thd
|
|||
public:
|
||||
ulong bit_flag;
|
||||
bool reverse;
|
||||
sys_var_thd_bit(const char *name_arg,
|
||||
sys_var_thd_bit(const char *name_arg,
|
||||
sys_check_func c_func, sys_update_func u_func,
|
||||
ulong bit, bool reverse_arg=0)
|
||||
:sys_var_thd(name_arg), check_func(c_func), update_func(u_func),
|
||||
|
@ -427,6 +427,24 @@ public:
|
|||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
|
||||
};
|
||||
|
||||
class sys_var_thd_dbug :public sys_var_thd
|
||||
{
|
||||
public:
|
||||
sys_var_thd_dbug(const char *name_arg) :sys_var_thd(name_arg) {}
|
||||
bool check_update_type(Item_result type) { return type != STRING_RESULT; }
|
||||
bool check(THD *thd, set_var *var);
|
||||
SHOW_TYPE type() { return SHOW_CHAR; }
|
||||
bool update(THD *thd, set_var *var);
|
||||
void set_default(THD *thd, enum_var_type type)
|
||||
{
|
||||
char buf[256];
|
||||
DBUG_EXPLAIN_INITIAL(buf, sizeof(buf));
|
||||
DBUG_SET(buf);
|
||||
}
|
||||
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* some variables that require special handling */
|
||||
|
||||
|
|
|
@ -2920,7 +2920,7 @@ static int has_temporary_error(THD *thd)
|
|||
MYSQL_ERROR *err;
|
||||
while ((err= it++))
|
||||
{
|
||||
DBUG_PRINT("info", ("has warning %d %s", err->code, err->msg))
|
||||
DBUG_PRINT("info", ("has warning %d %s", err->code, err->msg));
|
||||
switch (err->code)
|
||||
{
|
||||
case ER_GET_TEMPORARY_ERRMSG:
|
||||
|
|
|
@ -316,13 +316,13 @@ TODO list:
|
|||
#define MUTEX_UNLOCK(M) {DBUG_PRINT("lock", ("mutex unlock 0x%lx",\
|
||||
(ulong)(M))); pthread_mutex_unlock(M);}
|
||||
#define RW_WLOCK(M) {DBUG_PRINT("lock", ("rwlock wlock 0x%lx",(ulong)(M))); \
|
||||
if (!rw_wrlock(M)) DBUG_PRINT("lock", ("rwlock wlock ok")) \
|
||||
if (!rw_wrlock(M)) DBUG_PRINT("lock", ("rwlock wlock ok")); \
|
||||
else DBUG_PRINT("lock", ("rwlock wlock FAILED %d", errno)); }
|
||||
#define RW_RLOCK(M) {DBUG_PRINT("lock", ("rwlock rlock 0x%lx", (ulong)(M))); \
|
||||
if (!rw_rdlock(M)) DBUG_PRINT("lock", ("rwlock rlock ok")) \
|
||||
if (!rw_rdlock(M)) DBUG_PRINT("lock", ("rwlock rlock ok")); \
|
||||
else DBUG_PRINT("lock", ("rwlock wlock FAILED %d", errno)); }
|
||||
#define RW_UNLOCK(M) {DBUG_PRINT("lock", ("rwlock unlock 0x%lx",(ulong)(M))); \
|
||||
if (!rw_unlock(M)) DBUG_PRINT("lock", ("rwlock unlock ok")) \
|
||||
if (!rw_unlock(M)) DBUG_PRINT("lock", ("rwlock unlock ok")); \
|
||||
else DBUG_PRINT("lock", ("rwlock unlock FAILED %d", errno)); }
|
||||
#define STRUCT_LOCK(M) {DBUG_PRINT("lock", ("%d struct lock...",__LINE__)); \
|
||||
pthread_mutex_lock(M);DBUG_PRINT("lock", ("struct lock OK"));}
|
||||
|
|
|
@ -518,7 +518,7 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
|||
sql_print_error("Plugin '%s' init function returned error.",
|
||||
plugin->name.str);
|
||||
DBUG_PRINT("warning", ("Plugin '%s' init function returned error.",
|
||||
plugin->name.str))
|
||||
plugin->name.str));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
|||
sql_print_error("Plugin '%s' handlerton init returned error.",
|
||||
plugin->name.str);
|
||||
DBUG_PRINT("warning", ("Plugin '%s' handlerton init returned error.",
|
||||
plugin->name.str))
|
||||
plugin->name.str));
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
|
@ -580,7 +580,7 @@ static void plugin_call_deinitializer(void)
|
|||
if (tmp->plugin->deinit())
|
||||
{
|
||||
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
|
||||
tmp->name.str))
|
||||
tmp->name.str));
|
||||
}
|
||||
}
|
||||
tmp->state= PLUGIN_IS_UNINITIALIZED;
|
||||
|
|
|
@ -13197,7 +13197,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
|
|||
for (i= 0; (item= it++); i++)
|
||||
{
|
||||
Field *field;
|
||||
|
||||
|
||||
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
|
||||
item_field= item;
|
||||
else
|
||||
|
@ -13216,7 +13216,7 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
|
|||
DBUG_RETURN(TRUE); // Fatal error
|
||||
item_field->name= item->name;
|
||||
#ifndef DBUG_OFF
|
||||
if (_db_on_ && !item_field->name)
|
||||
if (!item_field->name)
|
||||
{
|
||||
char buff[256];
|
||||
String str(buff,sizeof(buff),&my_charset_bin);
|
||||
|
|
|
@ -617,7 +617,6 @@ err:
|
|||
static int get_options(int argc,char *argv[])
|
||||
{
|
||||
char *pos,*progname;
|
||||
DEBUGGER_OFF;
|
||||
|
||||
progname= argv[0];
|
||||
|
||||
|
@ -646,7 +645,6 @@ static int get_options(int argc,char *argv[])
|
|||
printf("Usage: %s [-?ABIKLsWv] [-m#] [-t#]\n",progname);
|
||||
exit(0);
|
||||
case '#':
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH (++pos);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
case 'q': silent=1; break;
|
||||
case 'S': if (stopwordlist==ft_precompiled_stopwords) stopwordlist=NULL; break;
|
||||
case '#':
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH (argument);
|
||||
break;
|
||||
case 'V':
|
||||
|
|
|
@ -284,7 +284,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
case 'N': no_search=1; break;
|
||||
case 'S': no_stopwords=1; break;
|
||||
case '#':
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH (argument);
|
||||
break;
|
||||
case 'V':
|
||||
|
|
|
@ -208,9 +208,9 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
|||
if (len != MI_BASE_INFO_SIZE)
|
||||
{
|
||||
DBUG_PRINT("warning",("saved_base_info_length: %d base_info_length: %d",
|
||||
len,MI_BASE_INFO_SIZE))
|
||||
len,MI_BASE_INFO_SIZE));
|
||||
}
|
||||
disk_pos= (char*)
|
||||
disk_pos= (char*)
|
||||
my_n_base_info_read((uchar*) disk_cache + base_pos, &share->base);
|
||||
share->state.state_length=base_pos;
|
||||
|
||||
|
|
|
@ -648,7 +648,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
|||
printf("test1 Ver 1.2 \n");
|
||||
exit(0);
|
||||
case '#':
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH (argument);
|
||||
break;
|
||||
case '?':
|
||||
|
|
|
@ -864,7 +864,6 @@ err:
|
|||
static void get_options(int argc, char **argv)
|
||||
{
|
||||
char *pos,*progname;
|
||||
DEBUGGER_OFF;
|
||||
|
||||
progname= argv[0];
|
||||
|
||||
|
@ -977,7 +976,6 @@ static void get_options(int argc, char **argv)
|
|||
progname);
|
||||
exit(0);
|
||||
case '#':
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH (++pos);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -120,7 +120,6 @@ int main(int argc,char **argv)
|
|||
static void get_options(int argc, char **argv)
|
||||
{
|
||||
char *pos,*progname;
|
||||
DEBUGGER_OFF;
|
||||
|
||||
progname= argv[0];
|
||||
|
||||
|
@ -150,7 +149,6 @@ static void get_options(int argc, char **argv)
|
|||
printf("Usage: %s [-?lKA] [-f#] [-t#]\n",progname);
|
||||
exit(0);
|
||||
case '#':
|
||||
DEBUGGER_ON;
|
||||
DBUG_PUSH (++pos);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -281,7 +281,7 @@ GlobalDictCache::drop(NdbTableImpl * tab)
|
|||
ver.m_refCount--;
|
||||
ver.m_status = DROPPED;
|
||||
if(ver.m_refCount == 0){
|
||||
DBUG_PRINT("info", ("refCount is zero, deleting m_impl"))
|
||||
DBUG_PRINT("info", ("refCount is zero, deleting m_impl"));
|
||||
delete ver.m_impl;
|
||||
vers->erase(i);
|
||||
}
|
||||
|
|
|
@ -978,7 +978,7 @@ void
|
|||
NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
|
||||
{
|
||||
DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation");
|
||||
DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp))
|
||||
DBUG_PRINT("enter", ("this=0x%x op=0x%x", (UintPtr)this, (UintPtr)cursorOp));
|
||||
|
||||
// here is one reason to make op lists doubly linked
|
||||
if (m_firstExecutedScanOp == cursorOp) {
|
||||
|
|
|
@ -15153,7 +15153,6 @@ int main(int argc, char **argv)
|
|||
{
|
||||
struct my_tests_st *fptr;
|
||||
|
||||
DEBUGGER_OFF;
|
||||
MY_INIT(argv[0]);
|
||||
|
||||
load_defaults("my", client_test_load_default_groups, &argc, &argv);
|
||||
|
|
Loading…
Reference in a new issue