backport of dbug extensions from 6.0:

function/ syntax
  glob(7) wildcards
  unit tests
This commit is contained in:
Sergei Golubchik 2009-10-30 19:13:58 +01:00
parent eff49de23e
commit 319847a4ec
29 changed files with 1317 additions and 789 deletions

View file

@ -3066,3 +3066,5 @@ sql/share/ukrainian
libmysqld/examples/mysqltest.cc
libmysqld/sql_signal.cc
libmysqld/debug_sync.cc
libmysqld/rpl_handler.cc
dbug/tests

View file

@ -1168,7 +1168,6 @@ void free_used_memory()
mysql_server_end();
/* Don't use DBUG after mysql_server_end() */
DBUG_VIOLATION_HELPER_LEAVE;
return;
}

View file

@ -1,3 +0,0 @@
.deps
Makefile
Makefile.in

View file

@ -23,19 +23,20 @@ libdbug_a_SOURCES = dbug.c sanity.c
EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \
user.r monty.doc dbug_add_tags.pl \
my_main.c main.c factorial.c dbug_analyze.c \
CMakeLists.txt
CMakeLists.txt tests.c tests-t.pl
NROFF_INC = example1.r example2.r example3.r main.r \
factorial.r output1.r output2.r output3.r \
output4.r output5.r
CLEANFILES = $(NROFF_INC) user.t user.ps
CLEANFILES = $(NROFF_INC) user.t user.ps tests-t
# Must be linked with libs that are not compiled yet
noinst_PROGRAMS = factorial dbug_analyze
noinst_PROGRAMS = factorial dbug_analyze tests
factorial_SOURCES = my_main.c factorial.c
tests_SOURCES = tests.c
dbug_analyze_SOURCES = dbug_analyze.c
all: user.t user.ps
all: user.t user.ps tests-t
user.t: user.r $(NROFF_INC)
-nroff -mm user.r > $@
@ -61,5 +62,7 @@ output5.r: factorial
@RM@ -f $@
@SED@ -e 's!\\!\\\\!g' $< > $@
# Don't update the files from bitkeeper
%::SCCS/s.%
# a hack to have executable in builddir, not in srcdir
tests-t: tests-t.pl
cp -f $(srcdir)/tests-t.pl ./tests-t

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@ $ctags="exctags -x -f - --c-types=f -u";
sub get_tag {
local $.; local $_=<TAGS>;
($symbol, $line)= /^(.*\S)\s+function\s+(\d+)/;
$symbol=$1 if /\s(\S+)\s*\(/;
$symbol=$1 if /[\s*]([^\s*]+)\s*\(/;
$line=1e50 unless $line;
}
@ -51,7 +51,7 @@ while($src=shift)
$skip=!$semicolon;
$semicolon= /;\s*$/;
print && next if $skip ||
(/^\s+\w+((::\w+)?|<\w+>)\s+\**\w+/ && !/^\s*return/);
(/^\s+\w+((::\w+)?|<\w+>)\s+\**\w+/ && !/^\s*return\b/);
last if /DBUG_ENTER/;
print "$tab DBUG_ENTER(\"$symbol\");\n";
print "\n" unless $_ eq "\n";

View file

@ -1,15 +0,0 @@
# Warning - first line left blank for sh/csh/ksh compatibility. Do not
# remove it. fnf@Unisoft
# doinstall.sh --- figure out environment and do recursive make with
# appropriate pathnames. Works under SV or BSD.
if [ -r /usr/include/search.h ]
then
# System V
$* LLIB=/usr/lib
else
# 4.2 BSD
$* LLIB=/usr/lib/lint
fi

View file

@ -1,64 +0,0 @@
# WARNING -- first line intentionally left blank for sh/csh/ksh
# compatibility. Do not remove it! FNF, UniSoft Systems.
#
# Usage is:
# install <from> <to>
#
# The file <to> is replaced with the file <from>, after first
# moving <to> to a backup file. The backup file name is created
# by prepending the filename (after removing any leading pathname
# components) with "OLD".
#
# This script is currently not real robust in the face of signals
# or permission problems. It also does not do (by intention) all
# the things that the System V or BSD install scripts try to do
#
if [ $# -ne 2 ]
then
echo "usage: $0 <from> <to>"
exit 1
fi
# Now extract the dirname and basename components. Unfortunately, BSD does
# not have dirname, so we do it the hard way.
fd=`expr $1'/' : '\(/\)[^/]*/$' \| $1'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \| .`
ff=`basename $1`
td=`expr $2'/' : '\(/\)[^/]*/$' \| $2'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \| .`
tf=`basename $2`
# Now test to make sure that they are not the same files.
if [ $fd/$ff = $td/$tf ]
then
echo "install: input and output are same files"
exit 2
fi
# Save a copy of the "to" file as a backup.
if test -f $td/$tf
then
if test -f $td/OLD$tf
then
rm -f $td/OLD$tf
fi
mv $td/$tf $td/OLD$tf
if [ $? != 0 ]
then
exit 3
fi
fi
# Now do the copy and return appropriate status
cp $fd/$ff $td/$tf
if [ $? != 0 ]
then
exit 4
else
exit 0
fi

View file

@ -1,30 +0,0 @@
# Warning - first line left blank for sh/csh/ksh compatibility. Do not
# remove it. fnf@Unisoft
# mklintlib --- make a lint library, under either System V or 4.2 BSD
#
# usage: mklintlib <infile> <outfile>
#
if test $# -ne 2
then
echo "usage: mklintlib <infile> <outfile>"
exit 1
fi
if grep SIGTSTP /usr/include/signal.h >/dev/null
then # BSD
if test -r /usr/include/whoami.h # 4.1
then
/lib/cpp -C -Dlint $1 >hlint
(/usr/lib/lint/lint1 <hlint >$2) 2>&1 | grep -v warning
else # 4.2
lint -Cxxxx $1
mv llib-lxxxx.ln $2
fi
else # USG
cc -E -C -Dlint $1 | /usr/lib/lint1 -vx -Hhlint >$2
rm -f hlint
fi
exit 0 # don't kill make

View file

@ -1,4 +0,0 @@
CL -I\my\include -AL -Gsm2 -FPi -DDBUG_OFF *.c
rm \my\lib\dbug.lib
lib.exe \my\lib\dbug dbug.obj sanity.obj;
link /NOD /STACK:8000 main factoria,factoria,,DBUG+STRINGS+LLIBCEP+DOSCALLS;

View file

@ -0,0 +1,26 @@
#!/usr/bin/perl
die <<EEE unless @ARGV;
Usage: $0 func1 [func2 [ ...] ]
This filter (stdin->stdout) removes lines from dbug trace that were generated
by specified functions and all functions down the call stack. Produces the
same effect as if the original source had DBUG_PUSH(""); right after
DBUG_ENTER() and DBUG_POP(); right before DBUG_RETURN in every such a function.
EEE
$re=join('|', @ARGV);
$skip='';
while(<STDIN>) {
print unless $skip;
next unless /^(?:.*: )*((?:\| )*)([<>])($re)\n/o;
if ($2 eq '>') {
$skip=$1.$3 unless $skip;
next;
}
next if $skip ne $1.$3;
$skip='';
print;
}

496
dbug/tests-t.pl Executable file
View file

@ -0,0 +1,496 @@
#!/usr/bin/env perl
#
# A driver program to test DBUG features - runs tests (shell commands)
# from the end of file to invoke tests.c, which does the real dbug work.
#
use Test::More;
$exe=$0;
die unless $exe =~ s/(tests)-t(\.exe)?$/$1$2 /;
# load tests
@tests=();
while (<DATA>) {
if (/^% \.\/tests /) {
push @tests, [ $' ]
} elsif (/^#/) {
next;
} else {
push @{$tests[$#tests]}, $_
}
}
plan skip_all => "because dbug is disabled" if system $exe;
plan tests => scalar(@tests);
for (@tests) {
$t=$exe . shift @$_;
chomp($t);
open F, '-|', $t or die "open($t|): $!";
local $";
$out=join($", <F>); close(F);
# special cases are handled here:
$out =~ s/Memory: 0x[0-9A-Fa-f]+/Memory: 0x####/g if $t =~ /dump/;
# compare ("\n" at the beginning makes better output in case of errors)
is("\n$out","\n@$_", $t);
}
__DATA__
% ./tests -#d
func2: info: s=ok
=> execute
=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d
func2: info: s=ok
% ./tests d,ret3
=> evaluate: OFF
=> evaluate_if: OFF
#
## Testing negative lists
#
% ./tests d:-d,ret3
func2: info: s=ko
=> execute
=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,ret3
func2: info: s=ko
% ./tests t:-d,ret3
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
% ./tests t:d,info:-d,ret3
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| | info: s=ko
| <func2
<main
% ./tests t:d,info:-d,ret3:-f,func2
>main
| >func1
| | | >func3
| | | <func3
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate
=> evaluate: ON
=> evaluate_if: OFF
% ./tests t:d,info:-d,ret3:-f,func2 d,evaluate_if
=> evaluate: OFF
=> evaluate_if: ON
% ./tests t:d:-d,ret3:-f,func2 d,evaluate_if
=> evaluate: OFF
=> evaluate_if: ON
% ./tests t:d:-d,ret3:-f,func2
>main
| >func1
| | | >func3
| | | <func3
| <func1
=> execute
=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:f:-f,func2:t
| | >func3
| | <func3
<main
#
## Adding incremental settings to the brew
#
% ./tests t:d:-d,ret3:-f,func2 +d,evaluate_if
>main
| >func1
| | | >func3
| | | <func3
| <func1
=> evaluate: OFF
=> evaluate_if: ON
| | >func3
| | <func3
<main
#
## DBUG_DUMP
#
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump
>main
| >func1
| | | >func3
| | | <func3
| <func1
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump
>main
| >func1
| | | >func3
| | | <func3
| <func1
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3:f:-f,func2:+d,dump
>main
| >func1
| | | >func3
| | | <func3
| <func1
| dump: Memory: 0x#### Bytes: (27)
64 2C 64 75 6D 70 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D 66 2C 66 75 6E 63 32 3A
74
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain
>main
| >func1
| | | >func3
| | | <func3
| <func1
| dump: Memory: 0x#### Bytes: (35)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 74
=> evaluate: OFF
=> evaluate_if: OFF
| explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:t
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain:P
dbug: >main
dbug-tests: | >func1
dbug-tests: | | | >func3
dbug-tests: | | | <func3
dbug-tests: | <func1
dbug-tests: | dump: Memory: 0x#### Bytes: (37)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 50 3A 74
=> evaluate: OFF
=> evaluate_if: OFF
dbug-tests: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:P:t
dbug-tests: | | >func3
dbug-tests: | | <func3
dbug-tests: <main
% ./tests t:d:-d,ret3:f:-f,func2 +d,dump,explain:P:F
dbug: tests.c: >main
dbug-tests: tests.c: | >func1
dbug-tests: tests.c: | | | >func3
dbug-tests: tests.c: | | | <func3
dbug-tests: tests.c: | <func1
dbug-tests: tests.c: | dump: Memory: 0x#### Bytes: (39)
64 2C 64 75 6D 70 2C 65 78 70 6C 61 69 6E 3A 2D 64 2C 72 65 74 33 3A 66 3A 2D
66 2C 66 75 6E 63 32 3A 46 3A 50 3A 74
=> evaluate: OFF
=> evaluate_if: OFF
dbug-tests: tests.c: | explain: dbug explained: d,dump,explain:-d,ret3:f:-f,func2:F:P:t
dbug-tests: tests.c: | | >func3
dbug-tests: tests.c: | | <func3
dbug-tests: tests.c: <main
#
## DBUG_EXPLAIN, DBUG_PUSH, DBUG_POP, DBUG_SET
#
% ./tests t:d:-d,ret3:f:-f,func2
>main
| >func1
| | | >func3
| | | <func3
| <func1
=> execute
=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:f:-f,func2:t
| | >func3
| | <func3
<main
% ./tests t:d:-d,ret3
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> execute
=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:-d,ret3:t
| >func2
| | >func3
| | <func3
| | info: s=ko
| <func2
<main
% ./tests d,info:-d,ret3:d,push
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| | info: s=ko
| <func2
<main
% ./tests d,info:-d,ret3:d,push,explain
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
| explain: dbug explained: d,info,push,explain:-d,ret3:t
| >func2
| | >func3
| | <func3
| | info: s=ko
| <func2
<main
% ./tests d,info:-d,ret3:d,explain
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain:-d,ret3
func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,pop
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
% ./tests d,info:-d,ret3:d,explain t:d,pop
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain:-d,ret3
func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,pop +t
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
main: explain: dbug explained: d,info,explain,pop:-d,ret3
func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,set
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
tests.c: main: explain: dbug explained: d,info,explain,set:-d,ret3:F
tests.c: func2: info: s=ko
% ./tests d,info:-d,ret3:d,explain,set:t
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t
tests.c: | >func2
tests.c: | | >func3
tests.c: | | <func3
tests.c: | | info: s=ko
tests.c: | <func2
tests.c: <main
% ./tests t d,info:-d,ret3:d,explain,set:t
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ko
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
tests.c: | explain: dbug explained: d,info,explain,set:-d,ret3:F:t
tests.c: | >func2
tests.c: | | >func3
tests.c: | | <func3
tests.c: | | info: s=ko
tests.c: | <func2
tests.c: <main
% ./tests t d,info:-d,ret3:d,explain,set,pop
func2: info: s=ko
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
% ./tests t:f,func2
| | >func2
| | <func2
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| <func2
#
## Testing SUBDIR rules
#
% ./tests t:-f,func2/:d
>main
| >func1
| <func1
=> execute
=> evaluate: ON
=> evaluate_if: OFF
| explain: dbug explained: d:f:-f,func2/:t
<main
% ./tests t:f,func1/:d
| >func1
| | >func2
| | | >func3
| | | <func3
| | | info: s=ok
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
% ./tests t:f,main/:d,pop
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
% ./tests f,main/:d,push
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
#
## Testing FixTraceFlags() - when we need to traverse the call stack
# (these tests fail with FixTraceFlags() disabled)
#
# delete the INCLUDE rule up the stack
% ./tests t:f,func1/ --push1=t:f,func3/
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
=> push1
=> evaluate: OFF
=> evaluate_if: OFF
| | >func3
| | <func3
# delete the EXCLUDE rule up the stack
% ./tests t:-f,func1/ --push1=t
>main
=> push1
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
# add the INCLUDE rule up the stack
% ./tests t:f,func3 --push1=t:f,main/
| | | >func3
| | | <func3
=> push1
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
# add the EXCLUDE rule up the stack
% ./tests t --push1=t:-f,main/
>main
| >func1
| | >func2
| | | >func3
| | | <func3
| | <func2
=> push1
=> evaluate: OFF
=> evaluate_if: OFF
# change the defaults
% ./tests t:f,func3 --push1=t
| | | >func3
| | | <func3
=> push1
| <func1
=> evaluate: OFF
=> evaluate_if: OFF
| >func2
| | >func3
| | <func3
| <func2
<main
# repeated keyword
% ./tests d:-d,info,info
=> execute
=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,info
% ./tests d:-d,info/,info
=> execute
=> evaluate: ON
=> evaluate_if: OFF
main: explain: dbug explained: d:-d,info/

87
dbug/tests.c Normal file
View file

@ -0,0 +1,87 @@
/*
A program to test DBUG features. Used by tests-t.pl
*/
char *push1=0;
#include <my_global.h> /* This includes dbug.h */
#include <my_pthread.h>
#include <string.h>
const char *func3()
{
DBUG_ENTER("func3");
DBUG_RETURN(DBUG_EVALUATE("ret3", "ok", "ko"));
}
void func2()
{
const char *s;
DBUG_ENTER("func2");
s=func3();
DBUG_PRINT("info", ("s=%s", s));
DBUG_VOID_RETURN;
}
int func1()
{
DBUG_ENTER("func1");
func2();
if (push1)
{
DBUG_PUSH(push1);
fprintf(DBUG_FILE, "=> push1\n");
}
DBUG_RETURN(10);
}
int main (int argc, char *argv[])
{
int i;
#ifdef DBUG_OFF
return 1;
#endif
if (argc == 1)
return 0;
#if defined(HAVE_PTHREAD_INIT) && defined(THREAD)
pthread_init(); /* Must be called before DBUG_ENTER */
#endif
#ifdef THREAD
my_thread_global_init();
#endif
dup2(1, 2);
for (i = 1; i < argc; i++)
{
if (strncmp(argv[i], "--push1=", 8) == 0)
push1=argv[i]+8;
else
DBUG_PUSH (argv[i]);
}
{
DBUG_ENTER ("main");
DBUG_PROCESS ("dbug-tests");
func1();
DBUG_EXECUTE_IF("dump",
{
char s[1000];
DBUG_EXPLAIN(s, sizeof(s)-1);
DBUG_DUMP("dump", (uchar*)s, strlen(s));
});
DBUG_EXECUTE_IF("push", DBUG_PUSH("+t"); );
DBUG_EXECUTE("execute", fprintf(DBUG_FILE, "=> execute\n"); );
DBUG_EXECUTE_IF("set", DBUG_SET("+F"); );
fprintf(DBUG_FILE, "=> evaluate: %s\n",
DBUG_EVALUATE("evaluate", "ON", "OFF"));
fprintf(DBUG_FILE, "=> evaluate_if: %s\n",
DBUG_EVALUATE_IF("evaluate_if", "ON", "OFF"));
DBUG_EXECUTE_IF("pop", DBUG_POP(); );
{
char s[1000] __attribute__((unused));
DBUG_EXPLAIN(s, sizeof(s)-1);
DBUG_PRINT("explain", ("dbug explained: %s", s));
}
func2();
DBUG_RETURN (0);
}
}

View file

@ -512,7 +512,7 @@ possible since all code preceding the first call to
.B DBUG_PUSH
is
essentially invisible to
.B dbug
.I dbug
(this can be worked around by
inserting a temporary
.B DBUG_PUSH(argv[1])
@ -708,7 +708,7 @@ EX:\ \fCDBUG_PROCESS\ (argv[0]);\fR
.SP 1
.LI DBUG_PUSH\
Sets a new debugger state by pushing the current
.B dbug
.I 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
@ -769,14 +769,14 @@ the 'd' flag. Used to conditionally execute "dangerous" actions, e.g
to crash the program testing how recovery works, or to introduce an
artificial delay checking for race conditions.
.SP 1
EX:\ \fCDBUG_EXECUTE_IF\ ("crashme",\ abort\ ());\fR
EX:\ \fCDBUG_EXECUTE_IF\ ("crashme",\ DBUG_ABORT()\ ());\fR
.SP 1
.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
.I dbug
is compiled off, the third argument is evaluated.
.SP 1
EX:\fC
@ -796,7 +796,7 @@ EX:\fC
.br
if (prepare_transaction () ||
.br
DBUG_EVALUATE ("crashme", (abort (), 0), 0) ||
DBUG_EVALUATE ("crashme", (DBUG_ABORT(), 0), 0) ||
.br
commit_transaction () )\fR
.SP 1
@ -875,6 +875,12 @@ 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_ABORT\
This macro could be used instead of abort(). It flushes DBUG_FILE stream
to ensure that no
.I dbug
output is lost and then calls abort().
.SP 1
.LI DBUG_EXPLAIN\
Generates control string corresponding to the current debug state.
The macro takes two arguments - a buffer to store the result string
@ -910,17 +916,17 @@ via the
.B DBUG_PUSH
or
.B DBUG_SET
macros. Control string consists of colon separate flags. Colons
macros. Control string consists of colon separated flags. Colons
that are part of ':\\', ':/', or '::' are not considered flag
separators. 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.
that is, it can modify existing state without overriding it. Every
flag may be preceded by a '+' or '-' to enable or disable a
corresponding option in the debugger state or to add or remove
arguments to the list. 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]
@ -936,6 +942,9 @@ 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.
Every keyword can be a
.I glob(7)
pattern.
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.
@ -943,7 +952,19 @@ 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.
Every function can be a
.I glob(7)
pattern.
An empty list of functions implies that all functions are selected.
Every function in the list may optionally be followed by a '/' -
this will implicitly select all the functions down the call stack.
.SP 1
EX: \fCf,func1,func2/:-f,func3,func4/\fR
.SP 1
This would enable debugger in functions 'func1()', 'func2()' and all
functions called from it (directly or indirectly). But not in
functions 'func3()' or 'func4()' and all functions called from
it.
.LI F
Mark each debugger output line with the name of the source file
containing the macro causing the output.
@ -952,6 +973,9 @@ 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.
Every function can be a
.I glob(7)
pattern.
An empty list of functions enables profiling for all functions.
See
.B PROFILING\ WITH\ DBUG
@ -970,7 +994,11 @@ 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. An empty list
Limit debugger actions to the specified processes.
Every name can be a
.I glob(7)
pattern.
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

View file

@ -1,139 +0,0 @@
/******************************************************************************
* *
* N O T I C E *
* *
* Copyright Abandoned, 1987, Fred Fish *
* *
* *
* This previously copyrighted work has been placed into the public *
* domain by the author and may be freely used for any purpose, *
* private or commercial. *
* *
* Because of the number of inquiries I was receiving about the use *
* of this product in commercially developed works I have decided to *
* simply make it public domain to further its unrestricted use. I *
* specifically would be most happy to see this material become a *
* part of the standard Unix distributions by AT&T and the Berkeley *
* Computer Science Research Group, and a standard part of the GNU *
* system from the Free Software Foundation. *
* *
* I would appreciate it, as a courtesy, if this notice is left in *
* all copies and derivative works. Thank you. *
* *
* The author makes no warranty of any kind with respect to this *
* product and explicitly disclaims any implied warranties of mer- *
* chantability or fitness for any particular purpose. *
* *
******************************************************************************
*/
/*
* FILE
*
* vargs.h include file for environments without varargs.h
*
* SCCS
*
* @(#)vargs.h 1.2 5/8/88
*
* SYNOPSIS
*
* #include "vargs.h"
*
* DESCRIPTION
*
* This file implements a varargs macro set for use in those
* environments where there is no system supplied varargs. This
* generally works because systems which don't supply a varargs
* package are precisely those which don't strictly need a varargs
* package. Using this one then allows us to minimize source
* code changes. So in some sense, this is a "portable" varargs
* since it is only used for convenience, when it is not strictly
* needed.
*
*/
/*
* These macros allow us to rebuild an argument list on the stack
* given only a va_list. We can use these to fake a function like
* vfprintf, which gets a fixed number of arguments, the last of
* which is a va_list, by rebuilding a stack and calling the variable
* argument form fprintf. Of course this only works when vfprintf
* is not available in the host environment, and thus is not available
* for fprintf to call (which would give us an infinite loop).
*
* Note that ARGS_TYPE is a long, which lets us get several bytes
* at a time while also preventing lots of "possible pointer alignment
* problem" messages from lint. The messages are valid, because this
* IS nonportable, but then we should only be using it in very
* nonrestrictive environments, and using the real varargs where it
* really counts.
*
*/
#define ARG0 a0
#define ARG1 a1
#define ARG2 a2
#define ARG3 a3
#define ARG4 a4
#define ARG5 a5
#define ARG6 a6
#define ARG7 a7
#define ARG8 a8
#define ARG9 a9
#define ARGS_TYPE long
#define ARGS_LIST ARG0,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8,ARG9
#define ARGS_DCL auto ARGS_TYPE ARGS_LIST
/*
* A pointer of type "va_list" points to a section of memory
* containing an array of variable sized arguments of unknown
* number. This pointer is initialized by the va_start
* macro to point to the first byte of the first argument.
* We can then use it to walk through the argument list by
* incrementing it by the size of the argument being referenced.
*/
typedef char *va_list;
/*
* The first variable argument overlays va_alist, which is
* nothing more than a "handle" which allows us to get the
* address of the first argument on the stack. Note that
* by definition, the va_dcl macro includes the terminating
* semicolon, which makes use of va_dcl in the source code
* appear to be missing a semicolon.
*/
#define va_dcl ARGS_TYPE va_alist;
/*
* The va_start macro takes a variable of type "va_list" and
* initializes it. In our case, it initializes a local variable
* of type "pointer to char" to point to the first argument on
* the stack.
*/
#define va_start(list) list = (char *) &va_alist
/*
* The va_end macro is a null operation for our use.
*/
#define va_end(list)
/*
* The va_arg macro is the tricky one. This one takes
* a va_list as the first argument, and a type as the second
* argument, and returns a value of the appropriate type
* while advancing the va_list to the following argument.
* For our case, we first increment the va_list arg by the
* size of the type being recovered, cast the result to
* a pointer of the appropriate type, and then dereference
* that pointer as an array to get the previous arg (which
* is the one we wanted.
*/
#define va_arg(list,type) ((type *) (list += sizeof (type)))[-1]

View file

@ -16,103 +16,64 @@
#ifndef _dbug_h
#define _dbug_h
#if defined(__cplusplus) && !defined(DBUG_OFF)
class Dbug_violation_helper
{
public:
inline Dbug_violation_helper() :
_entered(TRUE)
{ }
inline ~Dbug_violation_helper()
{
assert(!_entered);
}
inline void leave()
{
_entered= FALSE;
}
private:
bool _entered;
};
#endif /* C++ */
#ifdef __cplusplus
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(DBUG_OFF) && !defined(_lint)
struct _db_code_state_;
extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword);
extern int _db_keywords_(const char *, const char *);
extern int _db_strict_keyword_(const char *keyword);
struct _db_stack_frame_ {
const char *func; /* function name of the previous stack frame */
const char *file; /* filename of the function of previous frame */
uint level; /* this nesting level, highest bit enables tracing */
struct _db_stack_frame_ *prev; /* pointer to the previous frame */
};
struct _db_code_state_;
extern my_bool _dbug_on_;
extern my_bool _db_keyword_(struct _db_code_state_ *, const char *, int);
extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len);
extern int _db_explain_init_(char *buf, size_t len);
extern void _db_setjmp_(void);
extern void _db_longjmp_(void);
extern int _db_is_pushed_(void);
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_push_(const char *control);
extern void _db_pop_(void);
extern void _db_set_(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 ***);
extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
uint *_slevel_);
extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...))
extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
struct _db_stack_frame_ *_stack_frame_);
extern void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_);
extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...))
ATTRIBUTE_FORMAT(printf, 1, 2);
extern void _db_dump_(uint _line_,const char *keyword,
extern void _db_dump_(uint _line_,const char *keyword,
const unsigned char *memory, size_t length);
extern void _db_end_(void);
extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);
extern FILE *_db_fp_(void);
extern void _db_end_(void);
extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);
extern FILE *_db_fp_(void);
extern void _db_flush_();
extern const char* _db_get_func_(void);
#ifdef __cplusplus
#define DBUG_ENTER(a) \
const char *_db_func_, *_db_file_; \
uint _db_level_; \
char **_db_framep_; \
Dbug_violation_helper dbug_violation_helper; \
_db_enter_ (a, __FILE__, __LINE__, &_db_func_, &_db_file_, \
&_db_level_, &_db_framep_)
#define DBUG_VIOLATION_HELPER_LEAVE dbug_violation_helper.leave()
#else /* C */
#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_VIOLATION_HELPER_LEAVE do { } while(0)
#endif /* C++ */
#define DBUG_LEAVE \
DBUG_VIOLATION_HELPER_LEAVE; \
_db_return_ (__LINE__, &_db_func_, &_db_file_, &_db_level_)
#define DBUG_ENTER(a) struct _db_stack_frame_ _db_stack_frame_; \
_db_enter_ (a,__FILE__,__LINE__,&_db_stack_frame_)
#define DBUG_LEAVE _db_return_ (__LINE__, &_db_stack_frame_)
#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) \
do {if (_db_keyword_(0, (keyword))) { a1 }} while(0)
do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0)
#define DBUG_EXECUTE_IF(keyword,a1) \
do {if (_db_strict_keyword_ (keyword)) { a1 } } while(0)
do {if (_db_keyword_(0, (keyword), 1)) { a1 }} while(0)
#define DBUG_EVALUATE(keyword,a1,a2) \
(_db_keyword_(0,(keyword)) ? (a1) : (a2))
(_db_keyword_(0,(keyword), 0) ? (a1) : (a2))
#define DBUG_EVALUATE_IF(keyword,a1,a2) \
(_db_strict_keyword_((keyword)) ? (a1) : (a2))
(_db_keyword_(0,(keyword), 1) ? (a1) : (a2))
#define DBUG_PRINT(keyword,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_SET(a1) _db_set_ (0, (a1))
#define DBUG_SET(a1) _db_set_ (a1)
#define DBUG_SET_INITIAL(a1) _db_set_init_ (a1)
#define DBUG_PROCESS(a1) _db_process_(a1)
#define DBUG_FILE _db_fp_()
@ -125,54 +86,66 @@ extern const char* _db_get_func_(void);
#define DBUG_ASSERT(A) assert(A)
#define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len))
#define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len))
#define IF_DBUG(A) A
#define _DBUG_MAX_FUNC_NAME_ 255
#define DEBUGGER_OFF do { _dbug_on_= 0; } while(0)
#define DEBUGGER_ON do { _dbug_on_= 1; } while(0)
#ifndef __WIN__
#define DBUG_ABORT() (_db_flush_(), abort())
#else
/*
Avoid popup with abort/retry/ignore buttons. When BUG#31745 is fixed we can
call abort() instead of _exit(3) (now it would cause a "test signal" popup).
*/
#include <crtdbg.h>
#define DBUG_ABORT() (_db_flush_(),\
(void)_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE),\
(void)_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR),\
_exit(3))
#endif
#define DBUG_CHECK_CRASH(func, op) \
do { \
if (_db_keywords_((func), (op))) \
{ abort(); } \
} while (0)
do { char _dbuf_[255]; strxnmov(_dbuf_, sizeof(_dbuf_)-1, (func), (op)); \
DBUG_EXECUTE_IF(_dbuf_, DBUG_ABORT()); } while(0)
#define DBUG_CRASH_ENTER(func) \
DBUG_ENTER(func); DBUG_CHECK_CRASH(func, "_crash_enter")
#define DBUG_CRASH_RETURN(val) \
do {DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return"); \
DBUG_RETURN(val);} while(0)
DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return")
#define DBUG_CRASH_VOID_RETURN \
do {DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return"); \
DBUG_VOID_RETURN;} while(0)
#else /* No debugger */
DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return")
#else /* No debugger */
#define DBUG_ENTER(a1)
#define DBUG_LEAVE
#define DBUG_VIOLATION_HELPER_LEAVE
#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_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) do { } while(0)
#define DBUG_SET_INITIAL(a1) do { } while(0)
#define DBUG_POP()
#define DBUG_PROCESS(a1)
#define DBUG_PRINT(keyword,arglist) do { } while(0)
#define DBUG_PUSH(a1) do { } while(0)
#define DBUG_SET(a1) do { } while(0)
#define DBUG_SET_INITIAL(a1) do { } while(0)
#define DBUG_POP() do { } while(0)
#define DBUG_PROCESS(a1) do { } while(0)
#define DBUG_SETJMP(a1) setjmp(a1)
#define DBUG_LONGJMP(a1) longjmp(a1)
#define DBUG_DUMP(keyword,a1,a2) do { } while(0)
#define DBUG_END()
#define DBUG_ASSERT(A) do { } while(0)
#define DBUG_LOCK_FILE
#define DBUG_DUMP(keyword,a1,a2) do { } while(0)
#define DBUG_END() do { } while(0)
#define DBUG_ASSERT(A) do { } while(0)
#define DBUG_LOCK_FILE do { } while(0)
#define DBUG_FILE (stderr)
#define DBUG_UNLOCK_FILE
#define DBUG_UNLOCK_FILE do { } while(0)
#define DBUG_EXPLAIN(buf,len)
#define DBUG_EXPLAIN_INITIAL(buf,len)
#define IF_DBUG(A)
#define DEBUGGER_OFF do { } while(0)
#define DEBUGGER_ON do { } while(0)
#define DBUG_ABORT() abort()
#define DBUG_CRASH_ENTER(func)
#define DBUG_CRASH_RETURN(val) do { return(val); } while(0)
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
#define DBUG_CRASH_RETURN(val) do { return(val); } while(0)
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
#endif
#ifdef __cplusplus
#ifdef __cplusplus
}
#endif
#endif

View file

@ -649,8 +649,6 @@ C_MODE_END
# endif
#endif
#include <my_dbug.h>
#define MIN_ARRAY_SIZE 0 /* Zero or One. Gcc allows zero*/
#define ASCII_BITS_USED 8 /* Bit char used */
#define NEAR_F /* No near function handling */
@ -1177,6 +1175,8 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define reg16 register
#endif
#include <my_dbug.h>
/*
Sometimes we want to make sure that the variable is not put into
a register in debugging mode so we can see its value in the core

View file

@ -670,6 +670,7 @@ struct st_my_thread_var
};
extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
extern void **my_thread_var_dbug();
extern uint my_thread_end_wait_time;
#define my_thread_var (_my_thread_var())
#define my_errno my_thread_var->thr_errno

View file

@ -131,7 +131,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
mysql_port = MYSQL_PORT;
#ifndef MSDOS
{
struct servent *serv_ptr;
struct servent *serv_ptr __attribute__((unused));
char *env;
/*

View file

@ -387,6 +387,15 @@ const char *my_thread_name(void)
}
return tmp->name;
}
/* Return pointer to DBUG for holding current state */
extern void **my_thread_var_dbug()
{
struct st_my_thread_var *tmp=
my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
return tmp && tmp->init ? &tmp->dbug : 0;
}
#endif /* DBUG_OFF */

View file

@ -2389,7 +2389,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
for (i= 0; status && hp->h_addr_list[i]; i++)
{
IF_DBUG(char ipaddr[18];)
char ipaddr[18] __attribute__((unused));
memcpy(&sock_addr.sin_addr, hp->h_addr_list[i],
min(sizeof(sock_addr.sin_addr), (size_t) hp->h_length));
DBUG_PRINT("info",("Trying %s...",

View file

@ -1701,9 +1701,11 @@ uchar *sys_var_debug_sync::value_ptr(THD *thd,
static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
{
IF_DBUG(const char *dsp_name= action->sync_point.c_ptr());
IF_DBUG(const char *sig_emit= action->signal.c_ptr());
IF_DBUG(const char *sig_wait= action->wait_for.c_ptr());
#ifndef DBUG_OFF
const char *dsp_name= action->sync_point.c_ptr();
const char *sig_emit= action->signal.c_ptr();
const char *sig_wait= action->wait_for.c_ptr();
#endif
DBUG_ENTER("debug_sync_execute");
DBUG_ASSERT(thd);
DBUG_ASSERT(action);

View file

@ -6729,9 +6729,8 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
void Field_string::sort_string(uchar *to,uint length)
{
IF_DBUG(uint tmp=) my_strnxfrm(field_charset,
to, length,
ptr, field_length);
uint tmp __attribute__((unused))=
my_strnxfrm(field_charset, to, length, ptr, field_length);
DBUG_ASSERT(tmp == length);
}

View file

@ -4316,7 +4316,7 @@ int ha_ndbcluster::end_bulk_insert()
}
else
{
IF_DBUG(int res=) trans->restart();
int res __attribute__((unused))= trans->restart();
DBUG_ASSERT(res == 0);
}
}
@ -5928,7 +5928,7 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
{
DBUG_PRINT("NDB_SHARE", ("%s temporary use_count: %u",
share->key, share->use_count));
IF_DBUG(int r=) rename_share(share, to);
int r __attribute__((unused))= rename_share(share, to);
DBUG_ASSERT(r == 0);
}
#endif
@ -5952,7 +5952,7 @@ int ha_ndbcluster::rename_table(const char *from, const char *to)
#ifdef HAVE_NDB_BINLOG
if (share)
{
IF_DBUG(int ret=) rename_share(share, from);
int ret __attribute__((unused))= rename_share(share, from);
DBUG_ASSERT(ret == 0);
/* ndb_share reference temporary free */
DBUG_PRINT("NDB_SHARE", ("%s temporary free use_count: %u",

View file

@ -3390,14 +3390,14 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
if (share->flags & NSF_BLOB_FLAG)
{
my_ptrdiff_t ptrdiff= 0;
IF_DBUG(int ret =) get_ndb_blobs_value(table, share->ndb_value[0],
int ret __attribute__((unused))= get_ndb_blobs_value(table, share->ndb_value[0],
blobs_buffer[0],
blobs_buffer_size[0],
ptrdiff);
DBUG_ASSERT(ret == 0);
}
ndb_unpack_record(table, share->ndb_value[0], &b, table->record[0]);
IF_DBUG(int ret=) trans.write_row(originating_server_id,
int ret __attribute__((unused))= trans.write_row(originating_server_id,
injector::transaction::table(table,
TRUE),
&b, n_fields, table->record[0]);
@ -3429,7 +3429,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
if (share->flags & NSF_BLOB_FLAG)
{
my_ptrdiff_t ptrdiff= table->record[n] - table->record[0];
IF_DBUG(int ret =) get_ndb_blobs_value(table, share->ndb_value[n],
int ret __attribute__((unused))= get_ndb_blobs_value(table, share->ndb_value[n],
blobs_buffer[n],
blobs_buffer_size[n],
ptrdiff);
@ -3437,7 +3437,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
}
ndb_unpack_record(table, share->ndb_value[n], &b, table->record[n]);
DBUG_EXECUTE("info", print_records(table, table->record[n]););
IF_DBUG(int ret =) trans.delete_row(originating_server_id,
int ret __attribute__((unused))= trans.delete_row(originating_server_id,
injector::transaction::table(table,
TRUE),
&b, n_fields, table->record[n]);
@ -3452,7 +3452,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
if (share->flags & NSF_BLOB_FLAG)
{
my_ptrdiff_t ptrdiff= 0;
IF_DBUG(int ret =) get_ndb_blobs_value(table, share->ndb_value[0],
int ret __attribute__((unused))= get_ndb_blobs_value(table, share->ndb_value[0],
blobs_buffer[0],
blobs_buffer_size[0],
ptrdiff);
@ -3480,7 +3480,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
if (share->flags & NSF_BLOB_FLAG)
{
my_ptrdiff_t ptrdiff= table->record[1] - table->record[0];
IF_DBUG(int ret =) get_ndb_blobs_value(table, share->ndb_value[1],
int ret __attribute__((unused))= get_ndb_blobs_value(table, share->ndb_value[1],
blobs_buffer[1],
blobs_buffer_size[1],
ptrdiff);
@ -3488,7 +3488,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
}
ndb_unpack_record(table, share->ndb_value[1], &b, table->record[1]);
DBUG_EXECUTE("info", print_records(table, table->record[1]););
IF_DBUG(int ret =) trans.update_row(originating_server_id,
int ret __attribute__((unused))= trans.update_row(originating_server_id,
injector::transaction::table(table,
TRUE),
&b, n_fields,
@ -3792,7 +3792,7 @@ restart:
{ C_STRING_WITH_LEN("mysqld startup") },
{ C_STRING_WITH_LEN("cluster disconnect")}
};
IF_DBUG(int error=)
int error __attribute__((unused))=
inj->record_incident(thd, INCIDENT_LOST_EVENTS, msg[incident_id]);
DBUG_ASSERT(!error);
break;
@ -4107,7 +4107,7 @@ restart:
DBUG_PRINT("info", ("use_table: %.*s",
(int) name.length, name.str));
injector::transaction::table tbl(table, TRUE);
IF_DBUG(int ret=) trans.use_table(::server_id, tbl);
int ret __attribute__((unused))= trans.use_table(::server_id, tbl);
DBUG_ASSERT(ret == 0);
}
}
@ -4123,7 +4123,7 @@ restart:
(int) name.length, name.str));
#endif
injector::transaction::table tbl(table, TRUE);
IF_DBUG(int ret=) trans.use_table(::server_id, tbl);
int ret __attribute__((unused))= trans.use_table(::server_id, tbl);
DBUG_ASSERT(ret == 0);
/*
@ -4193,7 +4193,7 @@ restart:
else
{
// set injector_ndb database/schema from table internal name
IF_DBUG(int ret=)
int ret __attribute__((unused))=
i_ndb->setDatabaseAndSchemaName(pOp->getEvent()->getTable());
DBUG_ASSERT(ret == 0);
ndb_binlog_thread_handle_non_data_event(thd, i_ndb, pOp, row);

View file

@ -1200,14 +1200,14 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
*/
if (description_event->event_type_permutation)
{
IF_DBUG({
int new_event_type=
description_event->event_type_permutation[event_type];
DBUG_PRINT("info",
("converting event type %d to %d (%s)",
event_type, new_event_type,
get_type_str((Log_event_type)new_event_type)));
});
#ifndef DBUG_OFF
int new_event_type=
description_event->event_type_permutation[event_type];
DBUG_PRINT("info",
("converting event type %d to %d (%s)",
event_type, new_event_type,
get_type_str((Log_event_type)new_event_type)));
#endif
event_type= description_event->event_type_permutation[event_type];
}
@ -3609,10 +3609,12 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
*/
if (post_header_len)
{
#ifndef DBUG_OFF
// Allows us to sanity-check that all events initialized their
// events (see the end of this 'if' block).
IF_DBUG(memset(post_header_len, 255,
number_of_event_types*sizeof(uint8)););
memset(post_header_len, 255,
number_of_event_types*sizeof(uint8));
#endif
/* Note: all event types must explicitly fill in their lengths here. */
post_header_len[START_EVENT_V3-1]= START_V3_HEADER_LEN;
@ -3666,11 +3668,9 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver)
post_header_len[HEARTBEAT_LOG_EVENT-1]= 0;
// Sanity-check that all post header lengths are initialized.
IF_DBUG({
int i;
for (i=0; i<number_of_event_types; i++)
assert(post_header_len[i] != 255);
});
int i;
for (i=0; i<number_of_event_types; i++)
DBUG_ASSERT(post_header_len[i] != 255);
}
break;

View file

@ -583,7 +583,7 @@ terminate_slave_thread(THD *thd,
EINVAL: invalid signal number (can't happen)
ESRCH: thread already killed (can happen, should be ignored)
*/
IF_DBUG(int err= ) pthread_kill(thd->real_id, thr_client_alarm);
int err __attribute__((unused))= pthread_kill(thd->real_id, thr_client_alarm);
DBUG_ASSERT(err != EINVAL);
#endif
thd->awake(THD::NOT_KILLED);
@ -1087,7 +1087,7 @@ static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info)
if (io_slave_killed(thd, mi))
{
if (info && global_system_variables.log_warnings)
sql_print_information(info);
sql_print_information("%s", info);
return TRUE;
}
return FALSE;

View file

@ -5079,8 +5079,8 @@ greedy_search(JOIN *join,
the interleaving state to the one of the non-extended partial plan
on exit.
*/
IF_DBUG(bool is_interleave_error= )
check_interleaving_with_nj (best_table);
bool is_interleave_error __attribute__((unused))=
check_interleaving_with_nj (best_table);
/* This has been already checked by best_extension_by_limited_search */
DBUG_ASSERT(!is_interleave_error);
@ -15045,7 +15045,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
Item *pos;
List_iterator_fast<Item> li(all_fields);
Copy_field *copy= NULL;
IF_DBUG(Copy_field *copy_start);
Copy_field *copy_start __attribute__((unused));
res_selected_fields.empty();
res_all_fields.empty();
List_iterator_fast<Item> itr(res_all_fields);
@ -15058,7 +15058,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
goto err2;
param->copy_funcs.empty();
IF_DBUG(copy_start= copy);
copy_start= copy;
for (i= 0; (pos= li++); i++)
{
Field *field;

View file

@ -5423,7 +5423,7 @@ binlog:
}
VOID(pthread_mutex_unlock(&LOCK_open));
IF_DBUG(int result=)
int result __attribute__((unused))=
store_create_info(thd, table, &query,
create_info, FALSE /* show_database */);