diff options
author | unknown <davi@mysql.com/endora.local> | 2008-02-26 12:03:59 -0300 |
---|---|---|
committer | unknown <davi@mysql.com/endora.local> | 2008-02-26 12:03:59 -0300 |
commit | bf9bb656a65c18eb15ee475e5f58412c859ef76a (patch) | |
tree | 9599643f40672ed859b5baaf1e060a7b356498ab /dbug | |
parent | fd317533878a4a6537a4ad93c65d9d6b7305dfd1 (diff) | |
download | mariadb-git-bf9bb656a65c18eb15ee475e5f58412c859ef76a.tar.gz |
Bug#34424 query_cache_debug.test leads to valgrind warnings
Bug#34678 @@debug variable's incremental mode
The problem is that the per-thread debugging settings stack wasn't
being deallocated before the thread termination, leaking the stack
memory. The chosen solution is to push a new state if the current
is set to the initial settings and pop it (free) once the thread
finishes.
dbug/dbug.c:
Move dbug parser out of _db_set_ to a separate function and
make _db_set_ push a new stack if the corrent one is set to
the initial settings.
dbug/user.r:
Update DBUG_SET description.
mysql-test/t/disabled.def:
Re-enable test case which triggered the leak.
mysys/my_thr_init.c:
Pop a pushed state, nop if stack is empty.
sql/set_var.cc:
Handle incremental debug settings.
mysql-test/r/variables_debug.result:
Add new test case result for Bug#34678
mysql-test/t/variables_debug.test:
Add new test case for Bug#34678
Diffstat (limited to 'dbug')
-rw-r--r-- | dbug/dbug.c | 45 | ||||
-rw-r--r-- | dbug/user.r | 5 |
2 files changed, 38 insertions, 12 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c index 7f4292d18b1..666ab2b3e3c 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -412,15 +412,11 @@ void _db_process_(const char *name) cs->process= name; } + /* * FUNCTION * - * _db_set_ set current debugger settings - * - * SYNOPSIS - * - * VOID _db_set_(control) - * char *control; + * DbugParse parse control string and set current debugger setting * * DESCRIPTION * @@ -444,7 +440,7 @@ void _db_process_(const char *name) * */ -void _db_set_(CODE_STATE *cs, const char *control) +static void DbugParse(CODE_STATE *cs, const char *control) { const char *end; int rel=0; @@ -674,6 +670,35 @@ void _db_set_(CODE_STATE *cs, const char *control) /* * FUNCTION * + * _db_set_ set current debugger settings + * + * SYNOPSIS + * + * VOID _db_set_(control) + * char *control; + * + * DESCRIPTION + * + * Given pointer to a debug control string in "control", + * parses the control string, and sets up a current debug + * settings. Pushes a new debug settings if the current is + * set to the initial debugger settings. + */ + +void _db_set_(CODE_STATE *cs, const char *control) +{ + get_code_state_or_return; + + if (cs->stack == &init_settings) + PushState(cs); + + DbugParse(cs, control); +} + + +/* + * FUNCTION + * * _db_push_ push current debugger settings and set up new one * * SYNOPSIS @@ -685,7 +710,7 @@ void _db_set_(CODE_STATE *cs, const char *control) * * Given pointer to a debug control string in "control", pushes * the current debug settings, parses the control string, and sets - * up a new debug settings with _db_set_() + * up a new debug settings with DbugParse() * */ @@ -694,7 +719,7 @@ void _db_push_(const char *control) CODE_STATE *cs=0; get_code_state_or_return; PushState(cs); - _db_set_(cs, control); + DbugParse(cs, control); } /* @@ -717,7 +742,7 @@ void _db_set_init_(const char *control) CODE_STATE tmp_cs; bzero((uchar*) &tmp_cs, sizeof(tmp_cs)); tmp_cs.stack= &init_settings; - _db_set_(&tmp_cs, control); + DbugParse(&tmp_cs, control); } /* diff --git a/dbug/user.r b/dbug/user.r index e41367de321..19de840d0ad 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -730,8 +730,9 @@ warning will be given. The DBUG_POP macro has no arguments. 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 +Modifies the current debugger state on top of the stack or pushes +a new state if the current is set to the initial settings, 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. |