-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the Google Breakpad crash reporting system to generate minimal
crash dump information when the server process (mysqld) crashes. The minidump file generated by breakpad contains a list of the executable and shared libraries loaded in the process, the state of the processor register and a stack trace for each thread, and miscellaneous information about the system and the reason for the dump. Minidumps are significantly smaller than core files, making them more practical for collection and processing. The option minidump_dir can be used to specify the path name of the directory in which to store minidumps. Also, a minidump can be generated at runtime by requesting the server to dump debug information with the mysqladmin debug command.
- Loading branch information
Davi Arnaut
committed
Apr 18, 2012
1 parent
a224896
commit f95c5a4
Showing
13 changed files
with
237 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Copyright (c) 2012, Twitter, Inc. All rights reserved. | ||
# | ||
# Locate Breakpad client library for Linux. | ||
# | ||
|
||
SET(_BREAKPAD_ROOT $ENV{BREAKPAD_ROOT} ${BREAKPAD_ROOT}) | ||
LIST(APPEND _BREAKPAD_ROOT_HINTS $ENV{BREAKPAD_ROOT}/src/ ${BREAKPAD_ROOT}/src/) | ||
|
||
FIND_PATH(BREAKPAD_INCLUDE_DIR client/linux/handler/exception_handler.h | ||
HINTS ${_BREAKPAD_ROOT_HINTS}) | ||
MARK_AS_ADVANCED(BREAKPAD_INCLUDE_DIR) | ||
|
||
FIND_LIBRARY(BREAKPAD_CLIENT_LIBRARY NAMES breakpad_client | ||
HINTS ${_BREAKPAD_ROOT_HINTS} PATH_SUFFIXES client/linux/) | ||
MARK_AS_ADVANCED(BREAKPAD_CLIENT_LIBRARY) | ||
|
||
INCLUDE(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Breakpad DEFAULT_MSG | ||
BREAKPAD_CLIENT_LIBRARY BREAKPAD_INCLUDE_DIR) | ||
|
||
IF(BREAKPAD_FOUND) | ||
SET(HAVE_BREAKPAD 1) | ||
SET(BREAKPAD_INCLUDE_DIRS ${BREAKPAD_INCLUDE_DIR}) | ||
SET(BREAKPAD_LIBRARIES ${BREAKPAD_CLIENT_LIBRARY}) | ||
ENDIF() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Displaying default value | ||
SELECT COUNT(@@GLOBAL.minidump_dir); | ||
COUNT(@@GLOBAL.minidump_dir) | ||
1 | ||
1 Expected | ||
# Check if Value can set | ||
SET @@GLOBAL.minidump_dir=1; | ||
ERROR HY000: Variable 'minidump_dir' is a read only variable | ||
Expected error 'Read only variable' | ||
SELECT COUNT(@@GLOBAL.minidump_dir); | ||
COUNT(@@GLOBAL.minidump_dir) | ||
1 | ||
1 Expected | ||
# Check if the value in GLOBAL Table matches value in variable | ||
SELECT @@GLOBAL.minidump_dir = VARIABLE_VALUE | ||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
WHERE VARIABLE_NAME='minidump_dir'; | ||
@@GLOBAL.minidump_dir = VARIABLE_VALUE | ||
1 | ||
1 Expected | ||
SELECT COUNT(@@GLOBAL.minidump_dir); | ||
COUNT(@@GLOBAL.minidump_dir) | ||
1 | ||
1 Expected | ||
SELECT COUNT(VARIABLE_VALUE) | ||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
WHERE VARIABLE_NAME='minidump_dir'; | ||
COUNT(VARIABLE_VALUE) | ||
1 | ||
1 Expected | ||
# Check if accessing variable with and without GLOBAL point to same variable | ||
SELECT @@minidump_dir = @@GLOBAL.minidump_dir; | ||
@@minidump_dir = @@GLOBAL.minidump_dir | ||
1 | ||
1 Expected | ||
# Check if minidump_dir can be accessed with and without @@ sign | ||
SELECT COUNT(@@minidump_dir); | ||
COUNT(@@minidump_dir) | ||
1 | ||
1 Expected | ||
SELECT COUNT(@@local.minidump_dir); | ||
ERROR HY000: Variable 'minidump_dir' is a GLOBAL variable | ||
Expected error 'Variable is a GLOBAL variable' | ||
SELECT COUNT(@@SESSION.minidump_dir); | ||
ERROR HY000: Variable 'minidump_dir' is a GLOBAL variable | ||
Expected error 'Variable is a GLOBAL variable' | ||
SELECT COUNT(@@GLOBAL.minidump_dir); | ||
COUNT(@@GLOBAL.minidump_dir) | ||
1 | ||
1 Expected | ||
SELECT minidump_dir = @@SESSION.minidump_dir; | ||
ERROR 42S22: Unknown column 'minidump_dir' in 'field list' | ||
Expected error 'Readonly variable' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--echo # Displaying default value | ||
SELECT COUNT(@@GLOBAL.minidump_dir); | ||
--echo 1 Expected | ||
|
||
--echo # Check if Value can set | ||
|
||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SET @@GLOBAL.minidump_dir=1; | ||
--echo Expected error 'Read only variable' | ||
|
||
SELECT COUNT(@@GLOBAL.minidump_dir); | ||
--echo 1 Expected | ||
|
||
--echo # Check if the value in GLOBAL Table matches value in variable | ||
|
||
SELECT @@GLOBAL.minidump_dir = VARIABLE_VALUE | ||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
WHERE VARIABLE_NAME='minidump_dir'; | ||
--echo 1 Expected | ||
|
||
SELECT COUNT(@@GLOBAL.minidump_dir); | ||
--echo 1 Expected | ||
|
||
SELECT COUNT(VARIABLE_VALUE) | ||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
WHERE VARIABLE_NAME='minidump_dir'; | ||
--echo 1 Expected | ||
|
||
--echo # Check if accessing variable with and without GLOBAL point to same variable | ||
SELECT @@minidump_dir = @@GLOBAL.minidump_dir; | ||
--echo 1 Expected | ||
|
||
--echo # Check if minidump_dir can be accessed with and without @@ sign | ||
|
||
SELECT COUNT(@@minidump_dir); | ||
--echo 1 Expected | ||
|
||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SELECT COUNT(@@local.minidump_dir); | ||
--echo Expected error 'Variable is a GLOBAL variable' | ||
|
||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SELECT COUNT(@@SESSION.minidump_dir); | ||
--echo Expected error 'Variable is a GLOBAL variable' | ||
|
||
SELECT COUNT(@@GLOBAL.minidump_dir); | ||
--echo 1 Expected | ||
|
||
--Error ER_BAD_FIELD_ERROR | ||
SELECT minidump_dir = @@SESSION.minidump_dir; | ||
--echo Expected error 'Readonly variable' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* Copyright (c) 2012, Twitter, Inc. 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 | ||
the Free Software Foundation; version 2 of the License. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ | ||
|
||
#include "my_config.h" | ||
#include "client/linux/handler/exception_handler.h" | ||
#include "my_stacktrace.h" | ||
|
||
/** | ||
Callback invoked after the minidump has been written. | ||
*/ | ||
|
||
static bool | ||
breakpad_dump_callback(const char *dump_path, | ||
const char *minidump_id, | ||
void *, | ||
bool succeeded) | ||
{ | ||
my_safe_printf_stderr("Minidump: %s/%s.dmp\n\n", dump_path, minidump_id); | ||
return succeeded; | ||
} | ||
|
||
|
||
/** | ||
Write minidump information to a file in the specified directory. | ||
@param dump_path Where the minidump file is created. | ||
*/ | ||
|
||
void my_write_minidump(const char *dump_path) | ||
{ | ||
bool status; | ||
|
||
my_safe_printf_stderr("Attempting to generate minidump information.\n"); | ||
|
||
status= google_breakpad::ExceptionHandler::WriteMinidump(dump_path, | ||
breakpad_dump_callback, NULL); | ||
|
||
if (! status) | ||
my_safe_printf_stderr("Minidump failed.\n\n"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* Copyright (c) 2012, Twitter, Inc. 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 | ||
the Free Software Foundation; version 2 of the License. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ | ||
|
||
#ifndef MINIDUMP_INCLUDED | ||
#define MINIDUMP_INCLUDED | ||
|
||
#if defined(HAVE_BREAKPAD) && !defined(EMBEDDED_LIBRARY) | ||
void my_write_minidump(const char *); | ||
#else | ||
static void my_write_minidump(const char *) {} | ||
#endif | ||
|
||
#endif /* MINIDUMP_INCLUDED */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters