exported db_env_do_backtrace to get toku stack and engine status Tokutek/mongo#987

This commit is contained in:
Leif Walsh 2014-03-03 14:25:01 -05:00
parent dfcffcc714
commit 20b7dab63b
2 changed files with 9 additions and 5 deletions

View file

@ -854,6 +854,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
printf("void db_env_set_num_bucket_mutexes(uint32_t) %s;\n", VISIBLE);
printf("int db_env_set_toku_product_name(const char*) %s;\n", VISIBLE);
printf("void db_env_try_gdb_stack_trace(const char *gdb_path) %s;\n", VISIBLE);
printf("void db_env_do_backtrace(void) %s;\n", VISIBLE);
printf("#if defined(__cplusplus) || defined(__cilkplusplus)\n}\n#endif\n");
printf("#endif\n");

View file

@ -93,6 +93,8 @@ PATENT RIGHTS GRANT:
#include <toku_portability.h>
#include "toku_assert.h"
#include <db.h>
#include <stdlib.h>
#include <stdio.h>
#if defined(HAVE_MALLOC_H)
@ -138,11 +140,7 @@ void toku_assert_set_fpointers(int (*toku_maybe_get_engine_status_text_pointer)(
bool toku_gdb_dump_on_assert = false;
void (*do_assert_hook)(void) = NULL;
static void toku_do_backtrace_abort(void) __attribute__((noreturn));
static void
toku_do_backtrace_abort(void) {
void db_env_do_backtrace(void) {
// backtrace
#if !TOKU_WINDOWS
int n = backtrace(backtrace_pointers, N_POINTERS);
@ -171,6 +169,11 @@ toku_do_backtrace_abort(void) {
if (toku_gdb_dump_on_assert) {
toku_try_gdb_stack_trace(nullptr);
}
}
__attribute__((noreturn))
static void toku_do_backtrace_abort(void) {
db_env_do_backtrace();
#if TOKU_WINDOWS
//Following commented methods will not always end the process (could hang).