mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* configure.in: check whether backtrace(3) works well or not.
* vm_dump.c: set HAVE_BACKTRACE 0 if BROKEN_BACKTRACE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a16c76f7c5
commit
e233ca15e0
3 changed files with 68 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Feb 19 04:26:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* configure.in: check whether backtrace(3) works well or not.
|
||||||
|
|
||||||
|
* vm_dump.c: set HAVE_BACKTRACE 0 if BROKEN_BACKTRACE.
|
||||||
|
|
||||||
Mon Feb 18 16:30:18 2013 Akinori MUSHA <knu@iDaemons.org>
|
Mon Feb 18 16:30:18 2013 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
* lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
|
* lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
|
||||||
|
|
58
configure.in
58
configure.in
|
@ -2433,6 +2433,64 @@ AS_CASE(["$target_cpu-$target_os"],
|
||||||
fi])
|
fi])
|
||||||
AC_CHECK_FUNCS(backtrace)
|
AC_CHECK_FUNCS(backtrace)
|
||||||
|
|
||||||
|
if test "x$ac_cv_func_backtrace" = xyes; then
|
||||||
|
AC_CACHE_CHECK(for broken backtrace, rb_cv_broken_backtrace,
|
||||||
|
[AC_TRY_RUN([
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <execinfo.h>
|
||||||
|
|
||||||
|
#define TRACE_SIZE 256
|
||||||
|
|
||||||
|
void sigsegv(int signum, siginfo_t *info, void *ctx){
|
||||||
|
void *trace[TRACE_SIZE];
|
||||||
|
int n = backtrace(trace, TRACE_SIZE);
|
||||||
|
if (n > 0) {
|
||||||
|
fprintf(stdout, "backtrace:%d\n",n);
|
||||||
|
} else {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
stack_t ss;
|
||||||
|
ss.ss_sp = malloc(SIGSTKSZ);
|
||||||
|
if (ss.ss_sp == NULL) {
|
||||||
|
fprintf(stderr, "cannot allocate memory for sigaltstack\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
ss.ss_size = SIGSTKSZ;
|
||||||
|
ss.ss_flags = 0;
|
||||||
|
if (sigaltstack(&ss, NULL) == -1) {
|
||||||
|
fprintf(stderr, "sigaltstack failed\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
struct sigaction sa;
|
||||||
|
memset(&sa, 0, sizeof(struct sigaction));
|
||||||
|
sigemptyset(&sa.sa_mask);
|
||||||
|
sa.sa_sigaction = sigsegv;
|
||||||
|
sa.sa_flags |= SA_SIGINFO;
|
||||||
|
sa.sa_flags |= SA_ONSTACK;
|
||||||
|
sigaction(SIGSEGV, &sa, NULL);
|
||||||
|
int *a = NULL;
|
||||||
|
a[0] = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
rb_cv_broken_backtrace=no,
|
||||||
|
rb_cv_broken_backtrace=yes,
|
||||||
|
rb_cv_broken_backtrace=no)])
|
||||||
|
if test "$rb_cv_broken_backtrace" = yes; then
|
||||||
|
AC_DEFINE(BROKEN_BACKTRACE, 1)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_WITH(valgrind,
|
AC_ARG_WITH(valgrind,
|
||||||
AS_HELP_STRING([--without-valgrind],[disable valgrind memcheck support]),
|
AS_HELP_STRING([--without-valgrind],[disable valgrind memcheck support]),
|
||||||
[], with_valgrind=yes)
|
[], with_valgrind=yes)
|
||||||
|
|
|
@ -427,6 +427,10 @@ rb_vmdebug_thread_dump_state(VALUE self)
|
||||||
#ifndef HAVE_BACKTRACE
|
#ifndef HAVE_BACKTRACE
|
||||||
#define HAVE_BACKTRACE 0
|
#define HAVE_BACKTRACE 0
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BROKEN_BACKTRACE
|
||||||
|
# undef HAVE_BACKTRACE
|
||||||
|
# define HAVE_BACKTRACE 0
|
||||||
|
#endif
|
||||||
#if HAVE_BACKTRACE
|
#if HAVE_BACKTRACE
|
||||||
# include <execinfo.h>
|
# include <execinfo.h>
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
|
|
Loading…
Add table
Reference in a new issue