debug environment variable refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
480c602bdc
commit
dea470cca4
16
main.c
16
main.c
@ -29,9 +29,21 @@ objcdummyfunction(void)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv, char **envp)
|
main(int argc, char **argv, char **envp)
|
||||||
{
|
{
|
||||||
#ifdef RUBY_GC_STRESS
|
#ifdef RUBY_DEBUG_ENV
|
||||||
RUBY_EXTERN int gc_stress;
|
RUBY_EXTERN int gc_stress;
|
||||||
gc_stress = getenv("RUBY_GC_STRESS") != NULL;
|
RUBY_EXTERN int enable_coredump;
|
||||||
|
char *str;
|
||||||
|
str = getenv("RUBY_DEBUG");
|
||||||
|
if (str) {
|
||||||
|
for (str = strtok(str, ","); str; str = strtok(NULL, ",")) {
|
||||||
|
if (strcmp(str, "gc_stress") == 0)
|
||||||
|
gc_stress = 1;
|
||||||
|
else if (strcmp(str, "core") == 0)
|
||||||
|
enable_coredump = 1;
|
||||||
|
else
|
||||||
|
fprintf(stderr, "unexpected debug option: %s\n", str);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
NtInitialize(&argc, &argv);
|
NtInitialize(&argc, &argv);
|
||||||
|
10
signal.c
10
signal.c
@ -993,6 +993,10 @@ init_sigchld(int sig)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef RUBY_DEBUG_ENV
|
||||||
|
int enable_coredump = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Many operating systems allow signals to be sent to running
|
* Many operating systems allow signals to be sent to running
|
||||||
* processes. Some signals have a defined effect on the process, while
|
* processes. Some signals have a defined effect on the process, while
|
||||||
@ -1065,12 +1069,18 @@ Init_signal(void)
|
|||||||
install_sighandler(SIGUSR2, sighandler);
|
install_sighandler(SIGUSR2, sighandler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef RUBY_DEBUG_ENV
|
||||||
|
if (!enable_coredump) {
|
||||||
|
#endif
|
||||||
#ifdef SIGBUS
|
#ifdef SIGBUS
|
||||||
install_sighandler(SIGBUS, sigbus);
|
install_sighandler(SIGBUS, sigbus);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGSEGV
|
#ifdef SIGSEGV
|
||||||
install_sighandler(SIGSEGV, sigsegv);
|
install_sighandler(SIGSEGV, sigsegv);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef RUBY_DEBUG_ENV
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifdef SIGPIPE
|
#ifdef SIGPIPE
|
||||||
install_sighandler(SIGPIPE, sigpipe);
|
install_sighandler(SIGPIPE, sigpipe);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user