Commit 3da5abc0 authored by Leif Walsh's avatar Leif Walsh

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

parent 2b2dd84c
......@@ -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");
......
......@@ -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).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment