Anton Ertl wrote:
> I don't see a good way to prevent such things in every case, so I
> would recommend leaving Gforth as it is (i.e., direct threaded), and
> closing the bug report.
I have found a way to prevent such things in general; the following
patch seems to fix the problem.
- anton
Index: engine/main.c
===================================================================
RCS file: /usr/local/lib/cvs-repository/src-master/gforth/engine/main.c,v
retrieving revision 1.40
diff -u -r1.40 main.c
--- main.c 2000/09/23 15:47:08 1.40
+++ main.c 2002/10/25 09:35:59
@@ -82,7 +82,7 @@
#endif
#ifdef HAS_DEBUG
-static int debug=0;
+int debug=0;
#else
# define debug 0
# define perror(x...)
Index: engine/signals.c
===================================================================
RCS file: /usr/local/lib/cvs-repository/src-master/gforth/engine/signals.c,v
retrieving revision 1.11
diff -u -r1.11 signals.c
--- signals.c 2000/09/23 15:47:08 1.11
+++ signals.c 2002/10/25 09:35:59
@@ -46,6 +46,7 @@
UCell cols=DEFAULTCOLS;
UCell rows=DEFAULTROWS;
+extern int debug;
#ifndef SA_NODEFER
#define SA_NODEFER 0
@@ -60,7 +61,7 @@
action.sa_sigaction=handler;
sigemptyset(&action.sa_mask);
- action.sa_flags=SA_RESTART|SA_NODEFER|SA_SIGINFO; /* pass siginfo */
+ action.sa_flags=SA_RESTART|SA_NODEFER|SA_SIGINFO|SA_ONSTACK; /* pass siginfo */
sigaction(sig, &action, NULL);
}
#endif
@@ -73,7 +74,7 @@
act.sa_handler=func;
sigemptyset(&act.sa_mask);
- act.sa_flags=SA_NODEFER;
+ act.sa_flags=SA_NODEFER|SA_ONSTACK;
if (sigaction(signo,&act,&oact) < 0)
return SIG_ERR;
else
@@ -355,6 +356,16 @@
};
int i;
void (*throw_handler)() = die_on_signal ? graceful_exit : signal_throw;
+ stack_t sigstack;
+ int sas_retval=-1;
+
+ sigstack.ss_size=SIGSTKSZ+50*sizeof(void*);
+ if ((sigstack.ss_sp = malloc(sigstack.ss_size)) != NULL) {
+ sigstack.ss_flags=0;
+ sas_retval=sigaltstack(&sigstack,(stack_t *)0);
+ }
+ if (debug)
+ fprintf(stderr,"sigaltstack: %s\n",strerror(sas_retval));
#define DIM(X) (sizeof (X) / sizeof *(X))
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]