On 10/16/09 8:20 AM, Staale Smedseng wrote:
> #At file:///net/atum21.norway/export/home/tmp/ss156133/z/47391-50/ based on
> 2817 Staale Smedseng 2009-10-16
> Bug #47391 no stack trace printed to error log on
> solaris after a crash
> This patch adds a Solaris-specific version of
> print_stacktrace() which uses printstack(2). The symbol
> names are mangled, so use of c++filt may be required as
> described in the MySQL documentation.
OK to push. One minor comment below.
> === modified file 'sql/stacktrace.c'
> --- a/sql/stacktrace.c 2008-09-16 11:16:41 +0000
> +++ b/sql/stacktrace.c 2009-10-16 11:20:03 +0000
> @@ -226,6 +226,23 @@ end:
> stack trace is much more helpful in diagnosing the problem, so please do \n\
> resolve it\n");
> +#elif defined(__sun)
> +/* Use Solaris' symbolic stack trace routine. */
> +void print_stacktrace(gptr stack_bottom __attribute__((unused)),
> + ulong thread_stack __attribute__((unused)))
> + if (printstack(fileno(stderr)) == -1)
> + fprintf(stderr, "Error when traversing the stack, stack appears corrupt.\n");
> + else
> + fprintf(stderr, "Please read
> http://dev.mysql.com/doc/mysql/en/using-stack-trace.html and follow instructions on how to
> resolve the stack trace. Resolved\n\
> +stack trace is much more helpful in diagnosing the problem, so please do \n\
> +resolve it\n");
Please break the string:
fprintf(stderr, "Please read http://dev.mysql.com/doc/mysql/en/"
"using-stack-trace.html and follow instructions"
Also, you will have to adjust the patch when merging into 5.1 and up.
The stacktrace functionality has been moved to the mysys library and a
thing to keep an eye on is that the backtrace functions (backtrace,
backtrace_symbols and backtrace_symbols_fd) are available on Linux and
recent Solaris, so perhaps there should be a way to either use them or