The MySQL server and most MySQL clients are compiled with the DBUG package originally created by Fred Fish. When you have configured MySQL for debugging, this package makes it possible to get a trace file of what the program is doing. See Section 184.108.40.206, “Creating Trace Files”.
This section summarizes the argument values that you can specify
in debug options on the command line for MySQL programs that
have been built with debugging support. For more information
about programming with the DBUG package, see the DBUG manual in
dbug directory of MySQL source
distributions. It's best to use a recent distribution to get the
most updated DBUG manual.
The DBUG package can be used by invoking a program with the
[ option. If
you specify the
option without a
most MySQL programs use a default value. The server default is
d:t:i:o,/tmp/mysqld.trace on Unix and
d:t:i:O,\mysqld.trace on Windows. The effect
of this default is:
d: Enable output for all debug macros
t: Trace function calls and exits
i: Add PID to output lines
O,\mysqld.trace: Set the debug output
Most client programs use a default
debug_options value of
regardless of platform.
Here are some example debug control strings as they might be specified on a shell command line:
--debug=d:t --debug=d:f,main,subr1:F:L:t,20 --debug=d,input,output,files:n --debug=d:t:i:O,\\mysqld.trace
debug_options value is a sequence
of colon-separated fields:
Each field within the value consists of a mandatory flag
character, optionally preceded by a
- character, and optionally followed by a
comma-delimited list of modifiers:
The following table describes the permitted flag characters. Unrecognized flag characters are silently ignored.
Enable output from DBUG_
In MySQL, common debug macro keywords to enable are
Delay after each debugger output line. The argument is
the delay, in tenths of seconds, subject to machine
capabilities. For example,
Limit debugging, tracing, and profiling to the list of
named functions. An empty list enables all functions.
Identify the source file name for each line of debug or trace output.
Identify the process with the PID or thread ID for each line of debug or trace output.
Identify the source file line number for each line of debug or trace output.
Print the current function nesting depth for each line of debug or trace output.
Number each line of debug output.
Redirect the debugger output stream to the specified
file. The default output is
Limit debugger actions to specified processes. A
process must be identified with the
Print the current process name for each line of debug or trace output.
When pushing a new state, do not inherit the previous state's function nesting level. Useful when the output is to start at the left margin.
Enable function call/exit trace lines. May be followed by a list (containing only one modifier) giving a numeric maximum trace level, beyond which no output occurs for either debugging or tracing macros. The default is a compile time option.
character and trailing list of modifiers are used for flag
characters such as
that can enable a debug operation for all applicable modifiers
or just some of them:
With no leading
-, the flag value is set to exactly the
modifier list as given.
With a leading
the modifiers in the list are added to or subtracted from
the current modifier list.