Commit 86bcfa6c authored by Leif Walsh's avatar Leif Walsh

Merge branch 'backtrace'

parents cb030cb4 20b7dab6
...@@ -855,6 +855,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) { ...@@ -855,6 +855,7 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
printf("void db_env_set_num_bucket_mutexes(uint32_t) %s;\n", VISIBLE); 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("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_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("#if defined(__cplusplus) || defined(__cilkplusplus)\n}\n#endif\n");
printf("#endif\n"); printf("#endif\n");
......
...@@ -93,6 +93,8 @@ PATENT RIGHTS GRANT: ...@@ -93,6 +93,8 @@ PATENT RIGHTS GRANT:
#include <toku_portability.h> #include <toku_portability.h>
#include "toku_assert.h" #include "toku_assert.h"
#include <db.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#if defined(HAVE_MALLOC_H) #if defined(HAVE_MALLOC_H)
...@@ -138,11 +140,7 @@ void toku_assert_set_fpointers(int (*toku_maybe_get_engine_status_text_pointer)( ...@@ -138,11 +140,7 @@ void toku_assert_set_fpointers(int (*toku_maybe_get_engine_status_text_pointer)(
bool toku_gdb_dump_on_assert = false; bool toku_gdb_dump_on_assert = false;
void (*do_assert_hook)(void) = NULL; void (*do_assert_hook)(void) = NULL;
static void toku_do_backtrace_abort(void) __attribute__((noreturn)); void db_env_do_backtrace(void) {
static void
toku_do_backtrace_abort(void) {
// backtrace // backtrace
#if !TOKU_WINDOWS #if !TOKU_WINDOWS
int n = backtrace(backtrace_pointers, N_POINTERS); int n = backtrace(backtrace_pointers, N_POINTERS);
...@@ -171,6 +169,11 @@ toku_do_backtrace_abort(void) { ...@@ -171,6 +169,11 @@ toku_do_backtrace_abort(void) {
if (toku_gdb_dump_on_assert) { if (toku_gdb_dump_on_assert) {
toku_try_gdb_stack_trace(nullptr); toku_try_gdb_stack_trace(nullptr);
} }
}
__attribute__((noreturn))
static void toku_do_backtrace_abort(void) {
db_env_do_backtrace();
#if TOKU_WINDOWS #if TOKU_WINDOWS
//Following commented methods will not always end the process (could hang). //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