Rechercher dans le manuel MySQL

29.5.4 The DBUG Package

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 29.5.1.2, “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.

The DBUG package can be used by invoking a program with the --debug[=debug_options] or -# [debug_options] option. If you specify the --debug or -# option without a debug_options value, 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,/tmp/mysqld.trace, O,\mysqld.trace: Set the debug output file.

Most client programs use a default debug_options value of d:t:o,/tmp/program_name.trace, 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

For mysqld, it is also possible to change DBUG settings at runtime by setting the debug system variable. This variable has global and session values:

  1. mysql> SET GLOBAL debug = 'debug_options';
  2. mysql> SET SESSION debug = 'debug_options';

Changing the global debug value requires privileges sufficient to set global system variables. Changing the session debug value requires privileges sufficient to set restricted session system variables. See Section 5.1.9.1, “System Variable Privileges”.

The debug_options value is a sequence of colon-separated fields:

field_1:field_2:...:field_N

Each field within the value consists of a mandatory flag character, optionally preceded by a + or - character, and optionally followed by a comma-delimited list of modifiers:

[+|-]flag[,modifier,modifier,...,modifier]

The following table describes the permitted flag characters. Unrecognized flag characters are silently ignored.

Flag

Description

d

Enable output from DBUG_XXX macros for the current state. May be followed by a list of keywords, which enables output only for the DBUG macros with that keyword. An empty list of keywords enables output for all macros.

In MySQL, common debug macro keywords to enable are enter, exit, error, warning, info, and loop.

D

Delay after each debugger output line. The argument is the delay, in tenths of seconds, subject to machine capabilities. For example, D,20 specifies a delay of two seconds.

f

Limit debugging, tracing, and profiling to the list of named functions. An empty list enables all functions. The appropriate d or t flags must still be given; this flag only limits their actions if they are enabled.

F

Identify the source file name for each line of debug or trace output.

i

Identify the process with the PID or thread ID for each line of debug or trace output.

L

Identify the source file line number for each line of debug or trace output.

n

Print the current function nesting depth for each line of debug or trace output.

N

Number each line of debug output.

o

Redirect the debugger output stream to the specified file. The default output is stderr.

O

Like o, but the file is really flushed between each write. When needed, the file is closed and reopened between each write.

p

Limit debugger actions to specified processes. A process must be identified with the DBUG_PROCESS macro and match one in the list for debugger actions to occur.

P

Print the current process name for each line of debug or trace output.

r

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.

S

Do function _sanity(_file_,_line_) at each debugged function until _sanity() returns something that differs from 0.

t

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.

The leading + or - character and trailing list of modifiers are used for flag characters such as d or f that can enable a debug operation for all applicable modifiers or just some of them:

  • With no leading + or -, the flag value is set to exactly the modifier list as given.

  • With a leading + or -, the modifiers in the list are added to or subtracted from the current modifier list.

The following examples show how this works for the d flag. An empty d list enabled output for all debug macros. A nonempty list enables output only for the macro keywords in the list.

These statements set the d value to the modifier list as given:

  1. mysql> SET debug = 'd';
  2. mysql> SELECT @@debug;
  3. +---------+
  4. | @@debug |
  5. +---------+
  6. | d       |
  7. +---------+
  8. mysql> SET debug = 'd,error,warning';
  9. mysql> SELECT @@debug;
  10. +-----------------+
  11. | @@debug         |
  12. +-----------------+
  13. | d,error,warning |
  14. +-----------------+

A leading + or - adds to or subtracts from the current d value:

  1. mysql> SET debug = '+d,loop';
  2. mysql> SELECT @@debug;
  3. +----------------------+
  4. | @@debug              |
  5. +----------------------+
  6. | d,error,warning,loop |
  7. +----------------------+
  8.  
  9. mysql> SET debug = '-d,error,loop';
  10. mysql> SELECT @@debug;
  11. +-----------+
  12. | @@debug   |
  13. +-----------+
  14. | d,warning |
  15. +-----------+

Adding to all macros enabled results in no change:

  1. mysql> SET debug = 'd';
  2. mysql> SELECT @@debug;
  3. +---------+
  4. | @@debug |
  5. +---------+
  6. | d       |
  7. +---------+
  8.  
  9. mysql> SET debug = '+d,loop';
  10. mysql> SELECT @@debug;
  11. +---------+
  12. | @@debug |
  13. +---------+
  14. | d       |
  15. +---------+

Disabling all enabled macros disables the d flag entirely:

  1. mysql> SET debug = 'd,error,loop';
  2. mysql> SELECT @@debug;
  3. +--------------+
  4. | @@debug      |
  5. +--------------+
  6. | d,error,loop |
  7. +--------------+
  8.  
  9. mysql> SET debug = '-d,error,loop';
  10. mysql> SELECT @@debug;
  11. +---------+
  12. | @@debug |
  13. +---------+
  14. |         |
  15. +---------+

Zoek in de MySQL-handleiding

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-dbug-package.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:en Manuel MySQL : https://dev.mysql.com/

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut