diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2010-10-18 13:27:52 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2010-10-18 13:27:52 +0200 |
commit | f0e2d8ecd8ff9dfd940bd2c9223038e30c465800 (patch) | |
tree | 01cbf172208b6ccd3319a10828e980e63b765ce5 /include/my_dbug.h | |
parent | c20cbe5b4af9fc4735fb5d4a6b15ddfcb20ae37d (diff) | |
parent | 9074307102644d43b934ce52cc0661890098698b (diff) | |
download | mariadb-git-f0e2d8ecd8ff9dfd940bd2c9223038e30c465800.tar.gz |
Bug#52172 test binlog.binlog_index needs --skip-core-file to avoid leaving core files
For crash testing: kill the server without generating core file.
include/my_dbug.h
Use kill(getpid(), SIGKILL) which cannot be caught by signal handlers.
All DBUG_XXX macros should be no-ops in optimized mode, do that for DBUG_ABORT as well.
sql/handler.cc
Kill server without generating core.
sql/log.cc
Kill server without generating core.
Diffstat (limited to 'include/my_dbug.h')
-rw-r--r-- | include/my_dbug.h | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/include/my_dbug.h b/include/my_dbug.h index 19570ac2a67..e1cb3252601 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,8 +13,18 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _dbug_h -#define _dbug_h +#ifndef MY_DBUG_INCLUDED +#define MY_DBUG_INCLUDED + +#ifndef __WIN__ +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <signal.h> +#endif /* not __WIN__ */ #ifdef __cplusplus extern "C" { @@ -111,6 +121,20 @@ extern const char* _db_get_func_(void); #define DBUG_CRASH_VOID_RETURN \ DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return") +/* + Make the program fail, without creating a core file. + abort() will send SIGABRT which (most likely) generates core. + Use SIGKILL instead, which cannot be caught. + We also pause the current thread, until the signal is actually delivered. + An alternative would be to use _exit(EXIT_FAILURE), + but then valgrind would report lots of memory leaks. + */ +#ifdef __WIN__ +#define DBUG_SUICIDE() DBUG_ABORT() +#else +#define DBUG_SUICIDE() (_db_flush_(), kill(getpid(), SIGKILL), pause()) +#endif + #else /* No debugger */ #define DBUG_ENTER(a1) @@ -139,10 +163,11 @@ extern const char* _db_get_func_(void); #define DBUG_EXPLAIN_INITIAL(buf,len) #define DEBUGGER_OFF do { } while(0) #define DEBUGGER_ON do { } while(0) -#define DBUG_ABORT() abort() +#define DBUG_ABORT() do { } while(0) #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_SUICIDE() do { } while(0) #endif @@ -164,4 +189,5 @@ void debug_sync_point(const char* lock_name, uint lock_timeout); #ifdef __cplusplus } #endif -#endif + +#endif /* MY_DBUG_INCLUDED */ |