diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-01-25 14:00:13 -0700 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-01-25 14:00:13 -0700 |
commit | 33cff635fa353b817696c23bfaa17733342655ca (patch) | |
tree | 3624cfbdb38676f6964fe85a530dda9b1d8ded97 /sql | |
parent | b302ee39bc8e5f26f3fe95b47a3f42ad11cc5f40 (diff) | |
download | mariadb-git-33cff635fa353b817696c23bfaa17733342655ca.tar.gz |
Docs/manual.texi
updates for new code
sql/mysqld.cc
catch SIGBUS and SIGILL
print query and connection id on coredump if possible
Docs/manual.texi:
updates for new code
sql/mysqld.cc:
catch SIGBUS and SIGILL
print query and connection id on coredump if possible
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 0033c795f0f..f9c4d10f46f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1078,8 +1078,30 @@ static void init_signals(void) #ifdef HAVE_LINUXTHREADS static sig_handler write_core(int sig); + #ifdef __i386__ #define SIGRETURN_FRAME_COUNT 1 +#define PTR_SANE(p) ((char*)p >= heap_start && (char*)p <= heap_end) + +extern char* __bss_start; +static char* heap_start, *heap_end; + +inline static __volatile__ void print_str(const char* name, + const char* val, int max_len) +{ + fprintf(stderr, "%s at %p ", name, val); + if(!PTR_SANE(val)) + { + fprintf(stderr, " is invalid pointer\n"); + return; + } + + fprintf(stderr, "= "); + for(; max_len && PTR_SANE(val) && *val; --max_len) + fputc(*val++, stderr); + fputc('\n', stderr); +} + inline static __volatile__ void trace_stack() { uchar **stack_bottom; @@ -1136,7 +1158,18 @@ New value of ebp failed sanity check terminating backtrace\n"); ++frame_count; } - fprintf(stderr, "stack trace successful\n"); + fprintf(stderr, "stack trace successful, now will try to get some\n\ +variables. Some pointers may be invalid and cause dump abort\n"); + heap_start = __bss_start; + heap_end = (char*)sbrk(0); + print_str("thd->query", thd->query, 1024); + fprintf(stderr, "thd->thread_id = %ld\n", thd->thread_id); + fprintf(stderr, "successfully dumped variables, if you ran with --log\n \ +take a look at the details of what thread %ld did to cause the crash.\n\ +In some cases of really bad corruption, this value can be invalid \n", + thd->thread_id); + fprintf(stderr, "Please use the information above to create a repeatable\n\ +test case for the crash, and send it to bugs@lists.mysql.com\n"); } #endif #endif @@ -1195,6 +1228,8 @@ static void init_signals(void) sa.sa_handler=handle_segfault; #endif sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGBUS, &sa, NULL); + sigaction(SIGILL, &sa, NULL); (void) sigemptyset(&set); #ifdef THREAD_SPECIFIC_SIGPIPE sigset(SIGPIPE,abort_thread); |